實驗是在虛擬機上實現,在真實的生產環境下的無人值守安裝,須要根據具體狀況自行進行調整。
node
實驗前,已經預裝了一臺CentOS6.5 32位的虛擬機,使用的是NAT模式,IP地址爲192.168.206.131,網關是192.168.206.2。linux
咱們要在無人值守安裝服務端實現以下配置:ios
tftp服務器:192.168.206.131vim
nfs服務器:192.168.206.131服務器
dhcp服務器:192.168.206.131app
先將軟件進行安裝:less
yum install -y tftp tftp-server xinetd dhcp syslinux nfs-utils rpcbinddom
1.配置tftp:socket
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 ide
2.配置dhcp
cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcpd.conf
vim /etc/dhcpd.conf 複製以下的內容
ddns-update-style interim;
ignore client-updates;
subnet 192.168.206.0 netmask 255.255.255.0 {
allow booting;
allow bootp;
allow unknown-clients;
option routers 192.168.206.2;
option subnet-mask 255.255.255.0;
option domain-name-servers 192.168.206.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.206.100 192.168.206.254;
default-lease-time 21600;
max-lease-time 43200;
next-server 192.168.206.131;
filename "pxelinux.0";
}
啓動dhcp服務:service dhcpd start
3.配置支持PXE
cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
mkdir /install
mount /dev/cdrom /install
cd /install/p_w_picpaths/pxeboot/
cp initrd.img vmlinuz /var/lib/tftpboot/
mkdir /var/lib/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.206.131:/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.206.131 --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)
保存退出
service rpcbind start
service nfs start
6.無人值守安裝
新建一個虛擬機,設置爲nat模式,開啓後,開始自動安裝。