安装前准备:关闭防火墙和SELINUX,DHCP服务器静态IP
安装软件包
httpd tftp-server dhcp syslinux system-config-kickstart
配置文件共享服务:
systemctl enable httpd
systemctl start httpd
mkdir /var/www/html/centos/{7,6}
mount /dev/sr0 /var/www/html/centos/7
mount /dev/sr1 /var/www/html/centos/6
准备kickstart文件
/var/www/html/ksdir/{ks6-desktop.cfg,ks7-pxe.cfg} 注意:权限
配置tftp服务
systemctl enable tftp.socket
systemctl start tftp.socket

配置DHCP服务
vim /etc/dhcp/dhcpd.conf
option domain-name "example.com";
default-lease-time 600;
max-lease-time 7200;
subnet 192.168.100.0 netmask 255.255.255.0 {
range 192.168.100.1 192.168.100.200;
filename "pxelinux.0";
next-server 192.168.100.100;
}
systemctl enable dhcpd
systemctl start dhcpd

准备相关文件(复制文件参考目录)
mkdir /var/lib/tftpboot/pxelinux.cfg/
cp /usr/share/syslinux/{pxelinux.0,menu.c32} /var/lib/tftpboot/
cp /misc/cd/isolinux/{vmlinuz,initrd.img} /var/lib/tftpboot/
cp /misc/cd/isolinux/isolinux.cfg/var/lib/tftpboot/pxelinux.cfg/default

[root@centos7 tftpboot]#tree .
.
├── 6
│   ├── initrd.img
│   └── vmlinuz
├── 7
│   ├── initrd.img
│   └── vmlinuz
├── menu.c32
├── pxelinux.0
└── pxelinux.cfg
    └── default

3 directories, 7 files

准备启动菜单

default menu.c32
timeout 600

menu title PXE INSTALL CentOS

label desktop
  menu label ^Install  Desktop CentOS 7
  kernel 7/vmlinuz
  append initrd=7/initrd.img ks=http://192.168.64.7/ksdir/ks7-pxe.cfg

label mini
  menu label Install ^Destkop CentOS 6
  kernel 6/vmlinuz
  append initrd=6/initrd.img  ks=http://192.168.64.7/ksdir/ks6-desktop.cfg

label local
  menu default
  menu label Boot from ^local drive
  localboot 0xffff
menu end