The initial state of the server ready
1, IP address configuration is as follows:
[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens32
2, hostname, firewall and selinux state as follows
iptables -F
systemctl stop firewalld
setenforce 0
FTP service deployment
1, install the FTP service, and install the copy source to the / var / ftp / centos7 directory:
[root@pxe ~]# yum -y install vsftpd
[root@pxe ~]# rpm -q vsftpd
vsftpd-3.0.2-10.el7.x86_64
[root@pxe ~]# mkdir /var/ftp/centos7
[root@pxe ~]# cp -ar /media/* /var/ftp/centos7/
[Root @ PXE ~] # to / var / ftp / centos7 /
2508 /var/ftp/centos7/EFI/BOOT/fonts
6028 /var/ftp/centos7/EFI/BOOT
6032 / var / ftp / centos7 / EFI
85652 /var/ftp/centos7/images/pxeboot
91924 /var/ftp/centos7/images
86028 /var/ftp/centos7/isolinux
286188 /var/ftp/centos7/LiveOS
3832540 /var/ftp/centos7/Packages
13236 / var / ftp / centos7 / repodata
4315992 / var / ftp / centos7 /
2. Start the FTP service, and is set to boot from the start
[root@pxe ~]# systemctl start vsftpd
[root@pxe ~]# systemctl enable vsftpd
Created symlink from /etc/systemd/system/multi-user.target.wants/vsftpd.service to /usr/lib/systemd/system/vsftpd.service.
TFTP service deployment
1 The TFTP service
[root@pxe ~]# yum -y install tftp-server
[root@pxe ~]# rpm -q tftp-server
tftp-server-5.2-12.el7.x86_64
2, modify the configuration file, open the TFTP service is disabled by default
[root@pxe ~]# vim /etc/xinetd.d/tftp
10 wait = no
14 disable = no
3, start the TFTP service, and is set to boot from the start.
[root@pxe ~]# systemctl start tftp 7.1(tftp.socket)
[root@pxe ~]# systemctl enable tftp
Created symlink from /etc/systemd/system/sockets.target.wants/tftp.socket to /usr/lib/systemd/system/tftp.socket.
[root@pxe ~]# netstat -anput|grep 69
udp6 0 0 69 ::: ::: * 1 / systemd
Prepare the relevant documents and PXE boot program
1, ready Linux kernel initialization image file
[root@pxe ~]# cd /var/ftp/centos7/isolinux/
[root@pxe isolinux]# cp vmlinuz initrd.img /var/lib/tftpboot/
[root@pxe isolinux]# ll /var/lib/tftpboot/
The total amount of 42 644
-r--r--r-- 1 root root 38508192 1月 25 23:22 initrd.img
-r-xr-xr-x 1 root root 5156528 1月 25 23:22 vmlinuz
2, ready to kickstart configuration file
Native /root/anaconda-ks.cfg as a template, the deployment of the rest of the server's operating system
[root@pxe isolinux]# cd /root
[root@pxe ~]# cp /root/anaconda-ks.cfg /var/ftp/ks.cfg
[root@pxe ~]# chmod 777 /var/ftp/ks.cfg
[root@pxe ~]# ll /var/ftp/ks.cfg
-rwxrwxrwx 1 root root 955 1月 25 23:26 /var/ftp/ks.cfg
Add the installation source cdrom modify ftp://192.168.200.10/centos7
[root@pxe ~]# vim /var/ftp/ks.cfg
5 url --url = ftp: //192.168.200.10/centos7 (specify the installation source)
6 #cdrom (sixth line comments point)
3, ready to PXE boot process, the boot menu file:
[root@pxe ~]# yum -y install syslinux
[root@pxe ~]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
[root@pxe ~]# ls /var/lib/tftpboot/
initrd.img pxelinux.0 vmlinuz
[root@pxe ~]# cp /var/ftp/centos7/isolinux/isolinux.cfg /var/lib/tftpboot/
[root@pxe ~]# chmod 644 /var/lib/tftpboot/isolinux.cfg
[root@pxe ~]# ll /var/lib/tftpboot/
The total amount of 42676
-r--r--r-- 1 root root 38508192 1月 25 23:22 initrd.img
-rw-r--r-- 1 root root 3032 1月 25 23:33 isolinux.cfg
-rw-r--r-- 1 root root 26771 1月 25 23:32 pxelinux.0
-r-xr-xr-x 1 root root 5156528 1月 25 23:22 vmlinuz
4. Create a pxe boot menu
[root@pxe ~]# mkdir /var/lib/tftpboot/pxelinux.cfg
[root@pxe ~]# mv /var/lib/tftpboot/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
[root@pxe ~]# ll -R /var/lib/tftpboot/
/var/lib/tftpboot/:
The total amount of 42672
-r--r--r-- 1 root root 38508192 1月 25 23:22 initrd.img
-rw-r--r-- 1 root root 26771 1月 25 23:32 pxelinux.0
drwxr-xr-x 2 root root 20 1月 25 23:36 pxelinux.cfg
-r-xr-xr-x 1 root root 5156528 1月 25 23:22 vmlinuz
/var/lib/tftpboot/pxelinux.cfg:
The total amount of 4
-rw-r--r-- 1 root root 3032 1月 25 23:33 default
5, modified pxe boot menu, specify the installation location of the source file location pxe and ks.cfg:
[root@pxe ~]# vim /var/lib/tftpboot/pxelinux.cfg/default
1 default linux check
2 prompt 0
3 timeout 600
65 append initrd=initrd.img inst.repo=ftp://192.168.200.10/centos7 inst.ks=ftp://192.168.200.10/ks.cfg
Deploy DHCP Service
1, install the DHCP Service
[root@pxe ~]# yum -y install dhcp
[root@pxe ~]# rpm -q dhcp
dhcp-4.2.5-42.el7.centos.x86_64
2, modify the DHCP configuration file
[root@pxe ~]# cat /usr/share/doc/dhcp*/dhcpd.conf.example > /etc/dhcp/dhcpd.conf
[root@pxe ~]# vim /etc/dhcp/dhcpd.conf
Preferred IPv4 DNS address provided host address, and set the default lease 6 hours, 12 hours maximum lease
7 option domain-name "pxe.yunban.cn";
8 option domain-name-servers 192.168.200.10;
10 default-lease-time 21600;
11 max-lease-time 43200;
Create a DHCP scope, define the address pool, specify the boot file location, and tftp service address
27 subnet 192.168.200.0 netmask 255.255.255.0 {
28 range 192.168.200.10 192.168.200.100;
29 next-server 192.168.200.10;
30 filename "pxelinux.0";
31 }
Set the host statement, the MAC address of the machine network card and IP address binding
65 host pxe.yunban.cn {
66 hardware ethernet mac address;
67 fixed-address 192.168.200.10;
68 }
Start the DHCP server
[root@pxe ~]# systemctl start dhcpd
[root@pxe ~]# systemctl enable dhcpd
Created symlink from /etc/systemd/system/multi-user.target.wants/dhcpd.service to /usr/lib/systemd/system/dhcpd.service.