PXE Boot Installation in Linux

What is PXE Boot?

PXE (Preboot Execution Environment) allows a computer to boot from a network interface, enabling the installation of operating systems without physical media.

Steps to Set Up PXE Boot in Linux

  1. Install Required Packages: Install a DHCP server, TFTP server, and optionally an HTTP/FTP server.
  2. sudo apt update
    sudo apt install isc-dhcp-server tftpd-hpa
                
  3. Configure DHCP Server: Edit the DHCP server configuration file to enable PXE boot.
  4. 
    # /etc/dhcp/dhcpd.conf
    subnet 192.168.1.0 netmask 255.255.255.0 {
        range 192.168.1.100 192.168.1.200;
        option routers 192.168.1.1;
        filename "pxelinux.0";
        next-server 192.168.1.10;
    }           
                
  5. Set Up TFTP Server: Place the PXE bootloader and configuration files in the TFTP root directory.
  6.  
    sudo cp /usr/lib/PXELINUX/pxelinux.0 /var/lib/tftpboot/
    sudo mkdir -p /var/lib/tftpboot/pxelinux.cfg
                
                
  7. Prepare Bootable Files: Add the Linux kernel and initrd files to the TFTP directory.
  8. sudo cp vmlinuz initrd.img /var/lib/tftpboot/
                
  9. Restart Services: Restart the DHCP and TFTP services to apply changes.
  10. 
    sudo systemctl restart isc-dhcp-server tftpd-hpa
                
                

Testing PXE Boot

Configure a client machine to boot from the network and verify that it loads the PXE boot menu.