PXE (Network Boot) installation Server on CentOS/RHEL 7.x
The Preboot eXecution Environment (PXE, sometimes pronounced as pixie) specification describes a standardized client-server environment that boots a software assembly, retrieved from a network, on PXE-enabled clients. On the client side it requires only a PXE-capable network interface controller (NIC), and uses a small set of industry-standard network protocols such as DHCP and TFTP.
The concept behind the PXE originated in the early days of protocols like BOOTP/DHCP/TFTP, and as of 2015 it forms part of the Unified Extensible Firmware Interface (UEFI) standard. Given fast and reliable local area networks (LANs), PXE is the most frequent choice for operating system booting, installation and deployment.
Install required packages for PXE Setup
To install and Configure pxe server on centos 7.x we need the following packages.
Configure DHCP Server for PXE
Install dhcp package then a sample configuration file of dhcp server is created at "/usr/share/doc/dhcp*/dhcpd.conf.example", though the configuration file of dhcp is at '/etc/dhcp/dhcpd.conf'.
Copy the following lines into the file '/etc/dhcp/dhcpd.conf', replace the ip subnet and other details as per your environment.
Edit and Config tftp server (/etc/xinetd.d/tftp)
TFTP (Trivial File Transfer Protocol ) is used to transfer files from data server to its clients without any kind of authentication. In case of PXE server setup tftp is used for bootstrap loading. To config tftp server, edit its configuration file '/etc/xinetd.d/tftp', change the parameter ‘disable = yes' to 'disable = no' and leave the other parameters as it is.
tftp root directory "/var/lib/tftpboot"
Run the following commands to copy required network boot files in '/var/lib/tftpboot/'
Mount CentOS 7.x ISO file and copy its contents to local ftp server
Run the following commands to mount iso file and copy its contents in ftp server’s directory '/var/ftp/pub'
Copy Kernel file (vmlimz) and initrd file from mounted iso file to '/var/lib/tftpboot/networkboot/'
Create kickStart & PXE menu file.
Before creating kickstart file, let's first create the root password in an encrypted string because we will using that encrypted password string in kickstart file
System default kickstart file is placed under /root/anaconda-ks.cfg. and we will be creating a new kickstart under the folder /var/ftp/pub with the name'centos7.cfg'
Copy the following content into the new kickstart file. Please modify the kickstart file as per your needs.
Create a PXE menu file (/var/lib/tftpboot/pxelinux.cfg/default), copy the following contents into the pxe menu file.
Start and enable xinetd, dhcp and vsftpd service.
Use the fllowing commands to start and enable xinetd, dhcp and vsftpd.
If your SELinux is enabled, then set the following selinux rule for ftp server.
Open the ports in the OS firewall using following firewall-cmd commands
Boot the clients with pxe boot option.