筆者是在虛擬機上操作的,首先需要做一個準備工作,就是預裝一臺linux的服務器。並且配置成nat上網的方式,vmware如何配置nat上網,請參考http://www.lishiming.net/thread-626-1-1.html。
此時,我的linuxIP爲192.168.205.3,網關和dns地址都爲192.168.205.2.
我們的目標是:
tftpd服務器: 192.168.205.3
dhcp服務器: 192.168.205.3
nfs服務器: 192.168.205.3
如果是虛擬機,請把你的CentOS光盤插到光驅中(或者設置一下虛擬光驅),這一步必須要做。
1. 搭建tftp服務器
yum install -y tftp tftp-server xinetd
vim /etc/xinetd.d/tftp // 內容如下:
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
disable = no // 只需要更改藍色字體的這一部分
per_source = 11
cps = 100 2
flags = IPv4
}
修改完後要啓動tftpd服務
service xinetd start
2. 配置dhcpd服務
yum install -y dhcp
cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf
vim /etc/dhcpd.conf // 請複製以下內容:
ddns-update-style interim;
ignore client-updates;
subnet 192.168.205.0 netmask 255.255.255.0 {
allow booting;
allow bootp;
allow unknown-clients;
option routers 192.168.205.2;
option subnet-mask 255.255.255.0;
option domain-name-servers 192.168.205.2;
option time-offset -18000; # Eastern Standard Time
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- you understand Netbios very well
# option netbios-node-type 2;
range dynamic-bootp 192.168.205.100 192.168.205.254;
default-lease-time 21600;
max-lease-time 43200;
next-server 192.168.205.3;
filename "pxelinux.0";
}
// 說明一下,我的服務器IP爲 192.168.205.3, 網關和dns都是192.168.205.2 , 所以該配置文件中的相關配置請注意一下
啓動dhcp服務 service dhcpd start
3. 配置支持pxe
cp /usr/lib/syslinux/pxelinux.0 /tftpboot
mkdir /install
mount /dev/cdrom /install
cd /install/p_w_picpaths/pxeboot/
cp initrd.img vmlinuz /tftpboot
mkdir /tftpboot/pxelinux.cfg
vim /tftpboot/pxelinux.cfg/default // 內容爲:
default linux
prompt 1
timeout 30
label linux
kernel vmlinuz
append initrd=initrd.img ks=nfs:192.168.205.3:/install2/ks.cfg
4. 配置 ks.cfg
mkdir /install2
vim /install2/ks.cfg // 內容如下:
#platform=x86, AMD64, or Intel EM64T
# System authorization information
auth --useshadow --enablemd5
# System bootloader configuration
bootloader --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
# Use graphical install
graphical
# Firewall configuration
firewall --enabled
# Run the Setup Agent on first boot
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
# Installation logging level
logging --level=info
# Use NFS installation media
nfs --server=192.168.205.3 --dir=/install
# Network information
network --bootproto=dhcp --device=eth0 --onboot=on
#Root password
rootpw --iscrypted $1$BYSimLw0$I515yLiKzudlwkIskBqQE1
# SELinux configuration
selinux --disabled
# System timezone
timezone Asia/Shanghai
# Install OS instead of upgrade
install
# X Window System configuration information
#xconfig --defaultdesktop=GNOME --depth=32 --resolution=800x600
reboot
text
# Disk partitioning information
part /boot --bytes-per-inode=4096 --fstype="ext3" --size=100
part swap --bytes-per-inode=4096 --fstype="swap" --size=256
part / --bytes-per-inode=4096 --fstype="ext3" --grow --size=1
%packages --ignoremissing
@editors
@graphics
@x-software-development
@development-libs
@development-tools
kernel-devel
e2fsprogs
kernel
5. 配置NFS
vim /etc/exports
/install * (ro,no_root_squash,sync)
/install2 *(ro,no_root_squash,sync)
啓動NFS服務:
service portmap restart //如果centos6,命令是 service rpcbind restart
service nfs restart
6. 創建一個新的虛擬機,設置網絡爲nat模式,默認就是使用dhcp方式安裝系統的。
//最後再,強調一下,這個只是我在虛擬機上試驗用的,如果你用做生成環境可能不太合適,相關的設置請自行修改。
自動安裝linux操作系統(kickstart)
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章
Linux核心技能与应用
wy53780
2020-04-23 14:02:05
Python與家國天下
豌豆花下貓
2019-02-24 22:22:40
linux上安裝Docker(非常簡單的安裝方法)
幸運券發放
2019-02-24 19:38:01
2019年Java面試-併發容器篇
王知無
2019-02-24 15:12:46
淺淡個人學習嵌入式Linux過程
wx5c317e5b736d2
2019-02-24 13:31:30
DHCP服務原理與搭建(Linux系統+路由器,二選一方案)
wx5c7174443c6f9
2019-02-24 13:23:18
Redis安裝與配置
劉遄
2019-02-24 13:12:51
Linux查看CPU和內存使用情況
wbzjacky
2019-02-24 13:12:37
相關Linux安全方面的知識點
slqbj
2019-02-24 13:02:39
忘記了Linux密碼,使用GRUB重新設置
slqbj
2019-02-24 13:02:39
Oracle11g 基於linux 6.3下安裝
love壁虎
2019-02-24 12:55:06
Oracle基於Linux 7下的安裝
love壁虎
2019-02-24 12:55:05
bat記錄遠程桌面連接登錄信息
jason1982
2019-02-24 12:57:09