PXE Server Setup

  • Install the tftp server and pxe server.

    yum install tftp-server pxe
        
  • Get the pxelinux boot loader.

    The pxelinux boot loader is bundled in the syslinux tar file. Retrieve this from http://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-2.00.tar.gz. (Or latest version in that directory.)

  • Copy the boot loader into place.

    After expanding the compressed tar archive, copy the file 'pxelinux.0' into your tftpboot area. As in the following example:

        cp syslinux-2.00/pxelinux.0 /tftpboot/X86PC/UNDI/linux-install/
        
  • Create the pxelinux configuration directory.

    The boot loader expects a directory to be present in the same directory it was loaded from. It expects this directory to be named pxelinux.cfg, and looks for a file in that directory based on the IP address of the machine. If it does not find a file whose name is based on the IP address, it will look for a file named default.

  • Create configuration files.

    Here is an example pxelinux configuration file named default.

    serial 0 9600 0xab3
    default localboot
    timeout 100
    prompt 1
    display display.msg
    
    label localboot
    	LOCALBOOT 0
    
    label 7.3
    	kernel vmlinuz-7.3
    	append initrd=initrd-7.3.img lang= lowres devfs=nomount ramdisk_size=8192 console=ttyS0,9600
        
  • Create the display message file.

    In the above pxelinux configuration file, there was a display.msg reference with the display keyword. Below is an example file:

    PXE Booting to install Red Hat Linux.
    
    Current images are:
    Localboot -- Exit PXE, boot locally
    
    7.3 --- For Red Hat Linux 7.3 interactive installation
        
  • Make available the kernel and initrd.

    The kernel and initrd images are available from the images/pxeboot directory of the install image. (The install image is either on the CD or the base of the individual version's filesystem tree on an ftp/http/file server.) For example, to retrieve the images from the campus DULUG install server, go to http://install.dulug.duke.edu/pub/linux/dulug-7.3/i386/images/pxeboot/. In this directory, get the files vmlinuz and initrd-everything.img. These are the installation kernel and initial ram disk, respectively, for the 7.3 distribution of Red Hat Linux.

  • Rename the files to suit the boot loader configuration.

    The filenames of the kernel and the initial RAM disk must match the configuration entries in the pxelinux configuration file. To suit the running example:

       mv initrd-everything.img initrd-7.3.img
       mv vmlinuz ../vmlinuz-7.3
        
  • Configure the PXE server configuration file.

    With the Red Hat Linux RPM, the PXE server is configured by default to work with the NBP (Network Boot Prompt), which does not work with this example. Additionally, this example opts to have workstations boot off the network by default, load the pxelinux, and then time out to local boot from the pxelinux boot loader.

    The two sections that need to be changed look like:

    [X86PC/UNDI/linux-install/ImageFile_Name]
    0
    2
    linux
        

    and

    [X86PC/UNDI/MENU]
    0,Local Boot
    13,Remote Install Linux
    # 14,Remote Boot Linux
        

    Those sections should look like:

     
    [X86PC/UNDI/linux-install/ImageFile_Name]
    0
    0
    pxelinux
        

    and

    [X86PC/UNDI/MENU]
    #0,Local Boot
    13,Remote Install Linux
    # 14,Remote Boot Linux
        
  • Confirm that the appropriate services are accessible.

    The main services that must be started and accessible for the PXE booting process are:

    tftpd
    xinetd (for tftpd)
    pxe

    The way to check is to use chkconfig.

    [root linux-install]# /sbin/chkconfig --list tftp
    tftp           	off
    [root linux-install]# /sbin/chkconfig tftp on
    [root linux-install]# /sbin/chkconfig --list xinetd
    xinetd         	0:off	1:off	2:off	3:on	4:on	5:on	6:off
    [root linux-install]# /sbin/chkconfig --list pxe
    pxe            	0:off	1:off	2:off	3:off	4:off	5:off	6:off
    [root linux-install]# /sbin/chkconfig pxe on
      

    In the above example, tftp was not configured to start by default, nor was pxe. However, xinetd was. To configure tftp and pxe to start automatically, chkconfig <service> on was run. Since tftp is a part of xinetd, as long as xinetd is running, nothing past the chkconfig tftp on needs to be done to use the tftp service. However, pxe must be started at this point to begin using it prior to a reboot. The below example illustrates confirming that xinetd is running as well as starting pxe.

    [root etc]# /sbin/service xinetd status
    xinetd (pid 821) is running...
    [root etc]# /sbin/service pxe status
    pxe is stopped
    [root etc]# /sbin/service pxe start
    Starting pxe:                                              [  OK  ]
      
  • Add the PXE entries to /etc/services.

    While not required, it may be helpful to add the PXE service entries to the /etc/services file.

    pxe   67/udp
    pxe 4011/udp