1,测试环境可以先关闭firewall 和Selinux:
[root@ser201 ~]# service iptables stop #确认iptables关闭
[root@ser201 ~]# setenforce 0 #关闭Selinux
2,安装相关软件
[root@ser201 ~]# yum -y install tftp-server #这里一定要写成tftp-server
[root@ser201 ~]# yum -y install dhcp
[root@ser201 ~]# yum -y install vsftpd
[root@ser201 ~]# yum -y install *kickstart
[root@ser201 ~]# yum -y install syslinux
3,tftp
3.1 [root@ser201 ~]# vim /etc/xinetd.d/tftp
# default: off
# description: The tftp server serves files using the trivial file transfer \
# protocol. The tftp protocol is often used to boot diskless \
# workstations, download configuration files to network-aware printers, \
# and to start the installation process for some operating systems.
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /var/lib/tftpboot #这里可以修改为你想要的路径
disable = no #修改成为no
per_source = 11
cps = 100 2
flags = IPv4
:wq
[root@ser201 ~]# service xinetd restart #需不需要chkconfig tftp on 跟据自己情况定,这里只是做做测试就不设开机启动了
3.2, cp 相关文件到/tftpboot目录下
我这里把ISO文件挂在/var/ftp/pub下面、 这里也是后面安装时所需安装文件的目录
[root@ser201 ~]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
#可以通过rpm -ql syslinux-4.02-4.el6.i686 |grep pxelinux.0
#来查找pxelinux.0的位置,当然首先你要确认已安装syslinux
[root@ser201 ~]# cp /var/ftp/pub/isolinux/* /var/lib/tftpboot/
[root@ser201 ~]# mkdir /var/lib/tftpboot/pxelinux.cfg
[root@ser201 ~]# cp /var/ftp/pub/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
[root@ser201 ~]# vim /var/lib/tftpboot/pxelinux.cfg/default
label linux
menu label ^Install or upgrade an existing system
menu default
kernel vmlinuz
append initrd=initrd.img ks=ftp://192.168.1.201/ks.cfg #这里指定KS的应答文件位置 (http方式的写法类似,NFS的格式为: ks=nfs:192.168.1.x:/ks/ks.cfg)
备注:需要注意文件及文件夹的权限:chmod 755 -R /ks /tftpboot
4,vsftp
[root@ser201 ~]# service vsftpd start
[root@ser201 ~]# service vsftpd status
5,dhcp
[root@ser201 ~]# vim /etc/dhcp/dhcpd.conf
[root@ser201 ~]# cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd.conf
#直接cp一下模板,然后修改为:
ddns-update-style interim;
ignore client-updates;
log-facility local7;
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.10 192.168.1.254;
option domain-name-servers 116.228.111.118;
option routers 192.168.1.201;
default-lease-time 600;
max-lease-time 7200;
next-server 192.168.1.201; #此处为TFTP server IP
filename "pxelinux.0"; #指定pxe引导文件名
}
[root@ser201 ~]# service dhcpd start
6,最后来配置ks.cfg文件
运行system-config-kickstart,根据需要配置。
如client遇到需要输入key,则需要添加key --skip.
配制好的文件保存至/var/ftp/ks.cfg。