Share on Social Media

In this tutorial, you will learn, how to setup a Linux PXE Server. #centlinux #linux #pxe

What is PXE Server? :

PXE (pronounced as pixie) is the abbreviation of Preboot eXecution Environment. It is a standardized specification of a client-server environment, where PXE-enabled clients can boot their machines by using PXE boot images retrieved from a preconfigured PXE Boot Server.

Problem Statement:

In this article, we will setup a Linux PXE server in RHEL 7, and add option to install Red Hat Enterprise Linux 7 therein.

Our PXE boot server requires different services such as DHCP, TFTP and FTP to function properly. Although, it is not necessary to configure all these services on a single machine, and if you have a running FTP server, you may place the required installation files on your existing FTP server. Similarly, if you have a DHCP server configured for your network, you may define the DHCP configurations therein.

However, for simplicity, we will configure all these services on the same machine.

Note: In this article, we are performing everything from CLI, therefore, it is highly recommended that, you should have Linux Pocket Guide: Essential Commands (PAID LINK) by O’Reilly Media for quick reference.

System Specification:

We have a Linux machine with following machine. We will setup it as the PXE boot server.

  • CPU – 2 Core (2.4 Mhz)
  • Memory – 2 GB
  • Storage – 50 GB
  • Operating System – RHEL 7.5
  • Hostname –
  • IP Address –

Configure DHCP Service:

Connect to using ssh.

Install DHCP server using yum.

# yum install -y dhcp

Configure DHCP service.

# cat >> /etc/dhcp/dhcpd.conf << EOF
> #DHCP configuration for PXE boot server
> ddns-update-style interim;
> ignore client-updates;
> authoritative;
> allow booting;
> allow bootp;
> allow unknown-clients;
> subnet
> netmask
> {
> range;
> option domain-name-servers;
> option domain-name "";
> option routers;
> option broadcast-address;
> default-lease-time 600;
> max-lease-time 7200;
> #PXE boot server
> next-server;
> filename "pxelinux.0";
> }

Start and enable dhcpd.service.

# systemctl start dhcpd.service && systemctl enable dhcpd.service
Created symlink from /etc/systemd/system/ to /usr/lib/systemd/system/dhcpd.service.

Allow DHCP service through Linux firewall. Also, proxy-dhcp port is required for propagation of TFTP server’s IP Address.

# firewall-cmd --permanent --add-service={dhcp,proxy-dhcp}
# firewall-cmd --reload

Configure TFTP Service:

Install TFTP (Trivial FTP) server using yum.

# yum install -y tftp-server

Start and enable tftp.service.

# systemctl start tftp.service && systemctl enable tftp.service

Allow TFTP service through Linux firewall.

# firewall-cmd --permanent --add-service=tftp
# firewall-cmd --reload

Configure FTP Service:

FTP Service is required to share the OS Installation media to PXE boot clients. Some system administrators use NFS instead of FTP service. However, if we use NFS then we have to configure Samba as well, when we are going to add Microsoft Windows OS installation options to our PXE boot server. Therefore, it is good to use a single common technology to share the OS installation media for different operating systems. HTTP is also a good alternative of FTP, and can be used to share OS installation media.

Install VSFTPD server using yum.

# yum install -y vsftpd

Start and enable vsftpd.service.

# systemctl enable vsftpd.service && systemctl start vsftpd.service
Created symlink from /etc/systemd/system/ to /usr/lib/systemd/system/vsftpd.service.

Allow FTP Service through Linux firewall.

# firewall-cmd --permanent --add-service=ftp
# firewall-cmd --reload

Installing Syslinux:

Syslinux package provides various bootloaders including FAT filesystem to boot into Microsoft Windows environment.

Install syslinux package via yum.

# yum install -y syslinux

Configure PXE Boot Server:

Copy necessary bootloaders (provided by syslinux) to /var/lib/tftpboot directory.

# cp -v /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
â/usr/share/syslinux/pxelinux.0â -> â/var/lib/tftpboot/pxelinux.0â

# cp -v /usr/share/syslinux/menu.c32 /var/lib/tftpboot/
â/usr/share/syslinux/menu.c32â -> â/var/lib/tftpboot/menu.c32â

# cp -v /usr/share/syslinux/mboot.c32 /var/lib/tftpboot/
â/usr/share/syslinux/mboot.c32â -> â/var/lib/tftpboot/mboot.c32â

# cp -v /usr/share/syslinux/chain.c32 /var/lib/tftpboot/
â/usr/share/syslinux/chain.c32â -> â/var/lib/tftpboot/chain.c32â

Create necessary directories.

# mkdir /var/lib/tftpboot/pxelinux.cfg
# mkdir -p /var/lib/tftpboot/networkboot/rhel7
# mkdir /var/ftp/pub/rhel7

Copy contents of RHEL 7.5 ISO to /var/ftp/pub/rhel7. we have mounted RHEL 7.5 ISO at /mnt/iso, therefore, we are using following command for copying contents of ISO file.

# cp -rf /mnt/iso/ /var/ftp/pub/rhel7

Copy boot images of RHEL 7.5 to /var/lib/tftpboot/networkboot/rhel7 directory.

# cp /var/ftp/pub/rhel7/images/pxeboot/{initrd.img,vmlinuz} /var/lib/tftpboot/networkboot/rhel7/

Configure PXE boot menu and add Red Hat Enterprise Linux 7 installation option therein.

# cat >> /var/lib/tftpboot/pxelinux.cfg/default << EOF
> default menu.c32
> prompt 0
> timeout 30
> menu title Ahmer's PXE Menu
> label Install RHEL 7.5
> kernel /networkboot/rhel7/vmlinuz
> append initrd=/networkboot/rhel7/initrd.img inst.repo=

Connect a new system to network and boot it. The new system will automatically obtain an IP Address from our DHCP Server and obtain the PXE boot menu from PXE Server and display it as follows:


Since, we have only one installation option so far, therefore, press <ENTER> to start installation.


We have successfully setup a PXE boot server in RHEL/CentOS 7. The installation process here is not automated. In our next article Kickstart: Automate PXE Client Installations, we will transform the same manual installation process to an automated installation with predefined configurations using Kickstart.

Conclusion – Setup a Linux PXE Server:

In this tutorial, you have learned, how on setup a Linux PXE Server.

24 thoughts on “How to Setup a Linux PXE Server”
  1. Every distro has different PXE configurations. I have demonstrated CentOS 7, CentOS 6 and Ubuntu 18. You can follow these guidelines to add other distros. But you have to do some R&D as well respective to the relevant distro.

  2. Nice article,
    I think I've followed the instruction as best as I could but when I try to PXE boot the client machine I get PXE-E18: server response timeout. TFTP, FTP, and DHCP are all working from same client. Any ideas? Thanks

  3. all step done. with no error.

    i tested in other vm machine. centos successfully installed. but next day , again i tested. on other vm machine.

    1. dhcp server assigned ip address
    2. install screen appeared
    3. only counter is working. like automatic boot. 3.2.1…. again automatic boot 3.2.1 .. this time no success. where is problem?

  4. i followed all step with no error. but when i start other vm. dhcp assigned ip address but stack on install redhat 7.5 and shows automatic boot in 3.2.1 counter with no success and repeat counter 3.2.1. i can't do anything

Leave a Reply