Share, , Google Plus, Pinterest,


Posted in:

Install and Configure PXE Server on CentOS 6

About PXE Server

PXE stands for Preboot eXecution Environment and is also pronounced as “pixie”. PXE environment enables a computer to boot only using a network interfacePXE protocol uses a server/client model and is a combination of DHCP and TFTP.

DHCP is used to find PXE servers and TFTP is used to download files to PXE client. These files are then stored into the client computer RAM memory and executed. PXE protocol client then boots independently of hard disks or operating systems.

PXE Server is commonly used, to boot installation media. In this scenario we will install and configure PXE server to boot 32bit CentOS 6 image and start network CentOS 6 installation on PXE client. PXE server will run on the same server as DHCP server!


  • DHCP Server
  • Network Card with PXE Option ROM (client)
  • DNS Server (recommended)


PXE Server
PXE Server

Let’s Install and Configure PXE Server!

1. Install Packages For PXE Server

[root@foo1 ~]# yum install tftp-server syslinux httpd -y

2. Create TFTP Server Directory

Create a new directory where you want to store TFTP server files. Copy TFTP server configuration files into it.

[root@foo1 ~]# mkdir /tftpboot
[root@foo1 ~]# cp /usr/share/syslinux/pxelinux.0 /tftpboot/
[root@foo1 ~]# cp /usr/share/syslinux/menu.c32 /tftpboot/
[root@foo1 ~]# cp /usr/share/syslinux/memdisk /tftpboot/
[root@foo1 ~]# cp /usr/share/syslinux/mboot.c32 /tftpboot/
[root@foo1 ~]# cp /usr/share/syslinux/chain.c32 /tftpboot/

3. Create PXE Server Configuration Directory

[root@foo1 ~]# mkdir /tftpboot/pxelinux.cfg

4. Edit TFTP Configuration File (/etc/xinetd.d/tftp)

Edit “server_args = -s /var/lib/tftpboot” line to point to the newly created TFTP server directory and “disable = yes” to no, to enable TFTP service.

[root@foo1 ~]# cat /etc/xinetd.d/tftp 
# default: off
# description: The tftp server serves files using the trivial file transfer 
#    protocol.  The tftp protocol is often used to boot diskless 
#    workstations, download configuration files to network-aware printers, 
#    and to start the installation process for some operating systems.
service tftp
    socket_type      = dgram
    protocol         = udp
    wait             = yes
    user             = root
    server           = /usr/sbin/in.tftpd
    server_args      = -s /tftpboot
    disable          = no
    per_source       = 11
    cps              = 100 2
    flags            = IPv4

5. Create CentOS 6 Boot Image Directory

Create CentOS 6 (or other desired distribution) boot image directory and mount or copy the linux ISO image contents into it.

[root@foo1 ~]# mkdir -p /tftpboot/centos6/i386
[root@foo1 ~]# mount -o loop CentOS-6.4-i386-bin-DVD1.iso /tftpboot/centos6/i386/

6. Create PXE Server Apache Configuration File

Apache (httpd) is used to transfer CentOS 6 installation ISO files to PXE client since it is faster and more reliable then TFTP Edit the directory path and IP address to reflect your configuration.

[root@foo1 ~]# cat /etc/httpd/conf.d/pxeboot.conf
Alias /centos6/i386 /tftpboot/centos6/i386

<Directory /tftpboot/centos6/i386>
 Options Indexes FollowSymLinks
 Order Deny,Allow
 Deny from all
 Allow from

7. Create PXE Server Configuration File

Edit the directory path and HTTP path to reflect your configuration.

[root@foo1 ~]# cat /tftpboot/pxelinux.cfg/default
default menu.c32
prompt 0
timeout 300

menu title ########## PXE Boot Menu ##########

label 1
menu label ^1) Install CentOS 6 i386
kernel centos6/i386/images/pxeboot/vmlinuz
append initrd=centos6/i386/images/pxeboot/initrd.img method= devfs=nomount

label 2 
menu label ^2) Boot from local drive localboot

8. Reconfigure DHCP Server

Append this at the end of your DHCP configuration file (/etc/dhcp/dhcpd.conf). Edit the IP address with your PXE Server IP address.

# GeekPeek.Net scripts - Added for PXE Server configuration
allow booting;
allow bootp;
option option-128 code 128 = string;
option option-129 code 129 = text;
filename "pxelinux.0";

9. Restart/reload all services

[root@foo1 ~]# /etc/init.d/xinetd restart
Stopping xinetd:                                           [  OK  ]
Starting xinetd:                                           [  OK  ]
[root@foo1 ~]# /etc/init.d/httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]
[root@foo1 ~]# /etc/init.d/dhcpd restart
Shutting down dhcpd:                                       [  OK  ]
Starting dhcpd:                                            [  OK  ]

We have successfully installed and configured our PXE Server.

  • Aris

    It is a good installation guide but I had to disable SE-Linux for it to work in the end.

  • Alex

    failed at step 4: file does not exist

    • Bob

      Hi Alex,
      s tftp-server package installed? can you run the following to check:
      # rpm -qi tftp-server
      if you get a message saying “package tftp-server is not installed” please return to step one.

      if it is installed then your tftp config file could be in a different location. run:
      # find / -iname tftp 2>/dev/null
      that will tell yo where it is.
      find will increase IO on your system so locate might be a better idea…..i leave that up to you

  • Joro

    Depending on the Centos installation – minimal, base server, database server… you need to yum install dhcp as well.