Setting up a PXE Boot Server
Setting up a PXE Boot server
In this article we will look at how to setup and configure a PXE (Preboot Execution Environment) boot server. A PXE boot server can be very useful for a variety of tasks, e.g. Speed up the installation of a distribution because you don’t have to change the media around. When using a PXE boot server in conjunction with ‘AutoYaST’ you can have a fully automated installation of SUSE Enterprise Linux.
In this section of the article we will need to install the TFTP server if it has not already been installed this can be done by using the YaST utility. The YaST software management module can be started by using two different commands, the first command is yast sw_single which will start a curses based interface and the second command is yast2 sw_single which will start a GUI (Graphical User Interface). In this article we will be using the yast sw_single command to install the PXE server.
Once you have started the YaST software management module you will need to search for the the keyword “atftp“. Once you have selected the “atftp” package you will need to search for the ‘syslinux’ package, once you have selected the two packages you can begin the installation when the installation has finished you can exit the YaST software module. The next step is to confirm that the “atftp” package has been installed successfully this can be done by issuing the rpm command followed by the -q qualifier as shown in Figure 1.1.
linux-zuew:~ # rpm -q atftp atftp-0.7.0-1.18 linux-zuew:~ # rpm -q syslinux syslinux-3.11-20.11
Figure 1.1: Querying the RPM database for the “pxe” and “atftp” package.
Once you have installed the two packages require to setup a PXE boot server you will need to install and configure a DHCP (Dynamic Host Configuration Protocol) server, in this article I will not explain how to setup and configure a DHCP server. However, you can read about setting up and configuring a DHCP server at .
When configuring your DHCP server you will need to add the ‘next-server’ directive to your DHCP configuration file, this directive should have the IP address of your TFTP server i.e. (next-server 192.168.0.1;). The second directive that needs to be added to your DHCP configuration file is ‘filename’ and it should have the value of ‘pxelinux.0’ i.e. (filename “pxelinux.0”;) this will enable PXE booting.
The first step to configure your TFTP server is to create a directory which will house the Linux boot images and the PXE boot server configuration files, this can be done by issuing the mkdir followed by the pathname as shown in Figure 2.1.
linux-zuew:~ # mkdir /srv/tftpboot
Figure 2.1: Creating the PXE configuration directory.
Once you have successfully created the directory you will need to tell the TFTP server where the directory is located this can be done by modifying the “atftpd” configuration file which is located within the /etc/sysconfig directory. The “atftpd” configuration file holds a directive called: “ATFTPD_DIRECTORY” this directive needs to be modified to point to the location of your PXE configuration file and your Linux images as shown in Figure 2.2.
... ATFTPD_DIRECTORY="/srv/tftpboot" ...
Figure 2.2: Setting the TFTP directory.
Once you have modified the “atftpd” configuration file you will need to make sure the TFTP servers can startup on subsequent reboots this can be done by using the chkconfig command as shown in Figure 2.2. If you haven’t already started the TFTP server you can do this by issuing the service command as shown in Figure 2.3.
linux-zuew:~ # chkconfig atftpd on
Figure 2.3: Setting the TFTP daemon to start on bootup.
linux-zuew:~ # service atftpd start Starting Advanced Trivial FTP server done
Figure 2.4: Starting the TFTP daemon.
In this section of the article we will look at setting up the PXE boot server. The first task that you need to do is create a directory called: “pxelinux.cfg” which will house the PXE configuration file as shown in Figure 2.5.
linux-zuew:~ # mkdir /srv/tftpboot/pxelinux.cfg
Figure 2.5: Creating the PXE configuration directory.
Once you have successfully created the PXE directory you will need to create a file called: “default” with similar syntax to the one shown in Figure 2.6. Table 1 explains what each line does.
PROMPT 1 DEFAULT local TIMEOUT 50 label local LOCALBOOT 0
Figure 2.6: PXE default configuration file.
|PROMPT 1||This line allows the client to choose a different booting method. The value of one allows the client to choose a different boot method.|
|DEFAULT local||This sets the default boot label.|
|TIMEOUT 50||Indicates how long to wait at the “boot:” prompt until booting automatically, in units of 1/10 s.|
|label local||This section defines a label called: “local” so at the boot prompt when ‘local’ is enter it execute the commands related to the local label.|
|LOCALBOOT 0||This boots the local hard disk and not an image stored on the network.|
Table 1: PXE default configuration explained.
Once you have created the PXE configuration file you will need to copy the “pxelinux.0” file to the root of the TFTP server as shown in Figure 2.7.
linux-zuew:~ # cp /usr/share/syslinux/pxelinux.0 /srv/tftpboot
Figure 2.7: Copying the PXE image to the TFTP root directory.
Once you have copied the “pxelinux.0” file to the TFTP root directory you can now move to another machine and boot from the network as shown in Figure 2.8.
Figure 2.8: PXE network boot prompt
As you can see from Figure 2.8 the PXE server is now functioning correctly.
Configuring SLES 10 SP2
In this section of the article we are going to setup the PXE boot server so that it will serve the SUSE Linux Enterprise Server 10 SP2 distribution. The first task that you need to do is create a directory called: “linux” within the /srv/tftpboot directory and then create a sub-directory called: “SLES10-SP2” as shown in Figure 3.1.
linux-zuew:~ # mkdir /srv/tftpboot/linux linux-zuew:~ # mkdir /srv/tftpboot/linux/SLES10-SP2
Figure 3.1: Creating the directories that will house all the distributions PXE will serve.
The reason for creating the two directories shown in Figure 3.1 is to keep the PXE server clean and manageable. Once you have created the two directories you will need to copy two files from the SUSE Linux Enterprise Server 10 SP2 DVD/CD these two files are “initrd” and “linux” and they need to be copied into the “SLES10-SP2” directory as shown in Figure 3.2.
linux-zuew:~ # cp /media/cdrom/boot/i386/loader/initrd /srv/tftpboot/linux/SLES10-SP2 linux-zuew:~ # cp /media/cdrom/boot/i386/loader/linux /srv/tftpboot/linux/SLES10-SP2
Figure 3.2: Copying SUSE boot images.
Once you have copied the two files to the “SLES10-SP2” directory you will need to modify the “pxelinux.cfg/default” configuration file to point to the SUSE Linux Enterprise Server distribution as shown in Figure 3.3.
... label SLES10-SP2 kernel linux/SLES10-SP2/linux append initrd=linux/SLES10-SP2/initrd
Figure 3.3: Appending the SUSE entry to the default configuration file.
Once you have saved the changes you can move to another machine and boot off the network. However, at the boot prompt you will need to enter ‘SLES10-SP2’ to begin the SUSE Linux Enterprise Server installation as shown in Figure 3.4.
Figure 3.4: Booting SLES10-SP2.
In this section of the article we will look at displaying a message to users when they connect to the PXE server. The first step is to create a text file which will hold the message which will be displayed to the user as shown in Figure 4.1.
Welcome to XYZ PXE server. The distributions provided by this PXE server are F1 – SUSE Linux Enterprise Server 10 SP2
Figure 4.1: PXE welcome message.
Once you have written your message you can save the text file within the /srv/tftpboot directory and with the name of “welcome.msg“. The next step is to modify the “pxelinux.cfg/default” configuration file to include the text message as shown in Figure 4.2.
... DISPLAY welcome.msg ...
Figure 4.2: Setting the “welcome.msg” file to be displayed.
Once you have modified the “pxelinux.cfg/default” configuration file you can move to another machine and choose the PXE boot option as shown in Figure 4.3.
Figure 4.3: The “welcome.msg” text file being displayed.
In this section of the article we will look at providing a help screen or a reminder to the user. In this article we will displaying a list of all SUSE Linux Enterprise distributions available, when the user has pressed the F1 key. The first task is to create a simple text file which holds useful information as shown in Figure 5.1.
SLES10-SP1 – Install SUSE Linux Enterprise Server 10 SP2 SLES10 - Install SUSE Linux Enterprise Server 10 SLED10-SP1 – Install SUSE Linux Enterprise Server 10 SP2 SLED10 - Install SUSE Linux Enterprise Desktop 10
Figure 5.1: “SLE.msg” contents.
Once you happy with the contents of your file you can save the file as “SLE.msg“. The next step is to modify the “pxelinux.cfg/default” configuration file and create a binding for the F1 key which will display the “SLE.msg” text shown in Figure 5.2.
... F1 SLE.msg ...
Figure 5.2: Bind the F1 key to the “SLE.msg” text file.
Once you have modified the “pxelinux.cfg/default” configuration file you can move to another machine and choose the PXE boot option, when the boot option loads you can press the F1 key which will display the “SLE.msg” file as shown in Figure 5.3.
Figure 5.3: Displaying the “SLE.msg” help file.
In this article we cover how to setup and configure a PXE boot server which will hopefully be useful in your environment. The PXE server in conjunction with AutoYaST can be very useful as it will allow you to fully automate your installation of SUSE across your entire network.