实验是在虚拟机上实现,在真实的生产环境下的无人值守安装,需要根据具体情况自行进行调整。
实验前,已经预装了一台CentOS 6.5 32位的虚拟机,使用的是NAT模式,IP地址为192.168.206.131,网关是192.168.206.2。
我们要在无人值守安装服务端实现如下配置:
tftp服务器:192.168.206.131
nfs服务器:192.168.206.131
dhcp服务器:192.168.206.131
先将软件进行安装:
yum install -y tftp tftp-server xinetd dhcp syslinux nfs-utils rpcbind
1.配置tftp:
vim /etc/xinetd.d/tftp // 内容如下:service tftp{socket_type = dgramprotocol = udpwait = yesuser = rootserver = /usr/sbin/in.tftpdserver_args = -s /tftpbootdisable = no// 只需要更改蓝色字体的这一部分per_source = 11cps = 100 2flags = IPv4}修改完后要启动tftpd服务service xinetd start
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/images/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 informationauth --useshadow --enablemd5# System bootloader configurationbootloader --location=mbr# Clear the Master Boot Recordzerombr# Partition clearing informationclearpart --all --initlabel# Use graphical installgraphical# Firewall configurationfirewall --enabled# Run the Setup Agent on first bootfirstboot --disable# System keyboardkeyboard us# System languagelang en_US# Installation logging levellogging --level=info# Use NFS installation medianfs --server=192.168.206.131 --dir=/install# Network informationnetwork --bootproto=dhcp --device=eth0 --onboot=on#Root passwordrootpw --iscrypted $1$BYSimLw0$I515yLiKzudlwkIskBqQE1# SELinux configurationselinux --disabled# System timezonetimezone Asia/Shanghai# Install OS instead of upgradeinstall# X Window System configuration information#xconfig --defaultdesktop=GNOME --depth=32 --resolution=800x600reboottext# Disk partitioning informationpart /boot --bytes-per-inode=4096 --fstype="ext3" --size=100part swap --bytes-per-inode=4096 --fstype="swap" --size=256part / --bytes-per-inode=4096 --fstype="ext3" --grow --size=1%packages --ignoremissing@editors@graphics@x-software-development@development-libs@development-toolskernel-devele2fsprogskernel
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模式,开启后,开始自动安装。
使用PXE+DHCP+Apache+Kickstart无人值守安装CentOS5.8 x86_64 http://www.linuxidc.com/Linux/2012-12/76913p4.htm
Linux PXE无人值守安装出现 PXE-E32:TFTP OPen timeout的解决办法 http://www.linuxidc.com/Linux/2014-03/98986.htm
RHCE认证之无人值守安装Linux系统(FTP+TFTP+DHCP+Kickstart+PXE) http://www.linuxidc.com/Linux/2013-10/91013.htm