How to configure PXE boot server in Linux using Red Hat 6

PXE is an abbreviation for Preboot eXecution Environment which describes a client server standardized environment to boot from a network a software assembly on a client i.e. an Operating System. It is also pronounced as "pixie" and is mostly used to boot the client machine with a installation media stored on the PXE server using network interface.
In this article I will show you step by step guide to configure a PXE boot server using http and ftp in which you can use either one suiting your requirement.
I will be using Red Hat Linux 6 (32-bit) for my purpose
Server IP:


  • dhcp
  • tftp-server
  • syslinux
  • http/ftp (any one)

Install the required packages using yum

# yum -y install dhcp tftp-server syslinux http ftp vsftpd


Prepare installation media on PXE server

Next we need to copy all the files from the installation media(CD/DVD,ISO) to our PXE server.
You can also mount the media file on the PXE server in case you don't want to copy all the files but using that way you will only be able to configure your PXE server for one OS. For configuring multiple OS you will have to copy the OS files into separate directory for different OS.
In my case I want to confiure a PXE server to install CentOS 6.2
Let us create separate directory to save all the installation files

# mkdir -p /var/lib/tftpboot/images/centos/6/i386/
# mkdir -p /var/lib/tftpboot/images/centos/6/x86_64/

Next copy the installation files from the installation media.If you have iso images of the OS you can use WinSCP(on windows) to copy all the files. If the image is mounted on your Linux machine then you can copy using scp command.
To skip the lenghty process as of now we will just mount the dvd to relevant destination.

# mount /dev/sr0 /var/lib/tftpboot/images/centos/6/i386/

mount: block device /dev/sr0 is write-protected, mounting read-only
NOTE: In my case the cdrom is mounted on /dev/sr0 which can be different for you.

Configure HTTP/FTP server

You can use either of the mentioned servers for your purpose. But I will show you the configuration of all three so that you can choose any one as per your requirement.
HTTP server

# vi /etc/httpd/conf/httpd.conf
## At the end of the file add the following lines
    DocumentRoot /var/lib/tftpboot/images
    ErrorLog logs/
    CustomLog logs/ common
<Directory /var/lib/tftpboot/images>
AllowOverride None
Options Indexes FollowSymlinks
Order allow,deny
Allow from all

Restart the httpd services

# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]

Manually browse to the server ip ( and verify if you can see all the files.

FTP server

# vi /etc/vsftpd/vsftpd.conf

Manually browse to the server ip ( and verify if you can see all the files.

Restart the services

# /etc/init.d/vsftpd restart
Shutting down vsftpd:                                      [  OK  ]
Starting vsftpd for vsftpd:                                [  OK  ]


Configure TFTP server

Once these packages are installed copy the below files from the specified directory to /var/lib/tftpboot

# cp /usr/share/syslinux/pxelinux.0     /var/lib/tftpboot/
# cp /usr/share/syslinux/chain.c32     /var/lib/tftpboot/
# cp /usr/share/syslinux/menu.c32     /var/lib/tftpboot/
# cp /usr/share/syslinux/memdisk     /var/lib/tftpboot/
# cp /usr/share/syslinux/mboot.c32     /var/lib/tftpboot/

Next we will create the configuration file required for tftp server

# mkdir /var/lib/tftpboot/pxelinux.cfg

Create a new file "default" under "/var/lib/tftpboot/pxelinux.cfg" and add the below entry
For HTTP server

# vi /var/lib/tftpboot/pxelinux.cfg/default
DEFAULT menu.c32
MENU seperator
LABEL CentOS 6.2
KERNEL images/centos/6/i386/images/pxeboot/vmlinuz
APPEND initrd=images/centos/6/i386/images/pxeboot/initrd.img method= devfs=nomount
MENU seperator

Here two things which you need to change
KERNEL - defines the location from where the PXELINUX bootloader will load
APPEND - defines the location for PXE initrd image file to load
For FTP server
There is not much change for ftp server just replace the below line in the above file

APPEND initrd=images/centos/6/i386/images/pxeboot/initrd.img method= devfs=nomount

Enable the tftp service in xinetd

# vi /etc/xinetd.d/tftp
service tftp
        socket_type             = dgram
        protocol                = udp
        wait                    = yes
        user                    = root
        server                  = /usr/sbin/in.tftpd
        server_args             = -s /var/lib/tftpboot
        disable                 = no
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4

Restart the relevant services

# /etc/init.d/xinetd restart
Stopping xinetd:                                           [  OK  ]
Starting xinetd:                                           [  OK  ]

Make sure your tftp server is working
Login to any target node within the same subnet network where you are planning to perform the PXE installation
Install tftp client

# yum install tftp

or you can also install using rpm as below

# rpm -Uvh /tmp/tftp-5.2-13.el7.x86_64.rpm
warning: /tmp/tftp-5.2-13.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:tftp-5.2-13.el7                  ################################# [100%]

Connect to your TFTP server

# tftp

As we see it is connected properly

tftp> status
Connected to
Mode: netascii Verbose: off Tracing: off Literal: off
Rexmt-interval: 5 seconds, Max-timeout: 25 seconds

Next try to download a tftp file from the server

tftp> get linux-install/rhel7_64/vmlinuz
tftp> quit

Now check in the current path if the file exists

# ls vmlinuz

So our tftp is working properly


The same can be performed on localhost assuming you do not have any target node available to validate the TFTP, but it is always recommended to validate this from remote server as that way you can make sure there is no firewall or security policy which is blocking your tftp server from the client


Configure DHCP server

# vi /etc/dhcp/dhcpd.conf
option domain-name "";
option domain-name-servers;
default-lease-time 600;
max-lease-time 7200;
subnet netmask {
range dynamic-bootp;
option broadcast-address;
option routers;
  allow booting;
        allow bootp;
        filename "pxelinux.0";

In your dhcp server make sure you add these lines

filename "pxelinux.0";

as these define the address of your tftp server and the file to look for after getting the IP Address from dhcp server

Restart the relevant services

# service dhcpd restart
Shutting down dhcpd:                                       [  OK  ]
Starting dhcpd:                                            [  OK  ]

Make sure the services start after reboot

# chkconfig httpd on
# chkconfig xinetd on
# chkconfig dhcpd on


Iptables rules

For DHCP server

# iptables -I INPUT -m state --state NEW -p udp --dport 69 -j ACCEPT

For HTTP server

# iptables -I INPUT -m state --state NEW -p tcp --dport 80 -j ACCEPT

For FTP server

# iptables -I INPUT -m state --state NEW -p tcp --dport 21 -j ACCEPT

You are all set to test your PXE server. Boot a machine and select the option of Network Boot from Bios. You should see the below screen


Validate your selinux policy as it may block the TFTP and DHCP servics, for me it is disabled.

# getenforceDisabled

Related Articles:
What are the different types of Virtual Web Hosting in Apache
VSFTPD configuration
How to configure DHCP in Linux