一、安装软件
yum install httpd xinetd syslinux tftp-server dhcp -y

二、配置pxe
cd /usr/share/syslinux/
cp pxelinux.0 menu.c32 memdisk mboot.c32 chain.c32 /var/lib/tftpboot/
vi /etc/xinetd.d/tftp #change “disable=yes” to “no”
mount -o loop /dev/cdrom /mnt/
mkdir /var/lib/tftpboot/centos7_x64
cp -fr /mnt/* /var/lib/tftpboot/centos7_x64/
chmod -R 755 /var/lib/tftpboot/centos7_x64/
mkdir /var/lib/tftpboot/pxelinux.cfg
cat > /var/lib/tftpboot/pxelinux.cfg/default << 'HERE'
default menu.c32
prompt 0
timeout 300
ONTIMEOUT local

menu title ########## PXE Boot Menu ##########

label 1
menu label ^1) Install CentOS 7
kernel centos7_x64/images/pxeboot/vmlinuz
append initrd=centos7_x64/images/pxeboot/initrd.img method=http://192.168.57.14/centos7_x64 devfs=nomount

label 2
menu label ^2) Boot from local drive localboot
HERE

三、配置dhcp
cat /etc/dhcp/dhcpd.conf
subnet 192.168.57.0 netmask 255.255.255.0 {
range 192.168.57.100 192.168.57.200;
option domain-name-servers 192.168.57.14;
option routers 192.168.57.4;
default-lease-time 600;
max-lease-time 7200;
next-server 192.168.57.14;
tftp-root /var/lib/tftpboot;
filename "pxelinux.0";
}

四、配置http
ln -s /var/lib/tftpboot/centos7_x64 /var/www/html/

五、开启服务
systemctl restart xinetd
systemctl restart httpd
systemctl restart dhcpd
systemctl restart tftpd
systemctl enable xinetd
systemctl enable httpd
systemctl enable dhcpd
systemctl enable tftpd