In this article, I am going to show you how to configure CentOS 8 server as a PXE network boot server to boot CentOS 8 DVD installer via PXE and install CentOS 8 on your computer. So, let’s get started.

NOTE: Make sure to set SELinux to permissive mode on your CentOS 8 machine. Otherwise, the steps shown in this article won’t work. Covering SELinux is out of the scope of this article.

Network Topology:

Configuring PXE Network Boot Server on CentOS 8 centos

Figure 1: Network topology for PXE boot article

Here, linuxhint-s80 will be configured as a PXE boot server. It will also be assigned a static IP address 192.168.15.1. Other computers on the network will be able to boot into CentOS 8 installer from the PXE boot server.

Setting Up Static IP Address:

You must set up a static IP on your CentOS 8 machine before you move any further. For assistance on configuring a static IP address on your CentOS 8 machine, check my article Configuring Static IP on CentOS 8.

I will configure ens256 network interface for PXE booting on my CentOS 8 machine. It may be different for you. So, run the following command to find out the network interface you want to use.

Configuring PXE Network Boot Server on CentOS 8 centos

I used nmtui to configure ens256 interface for PXE booting as follows.

Configuring PXE Network Boot Server on CentOS 8 centos

Configuring DHCP and TFTP for PXE Booting:

You have to configure a DHCP and a TFTP server for PXE boot. You can use dnsmasq for that.

First, update the YUM package repository cache with the following command:

Configuring PXE Network Boot Server on CentOS 8 centos

Now, install the dnsmasq with the following command:

$ sudo dnf install -y dnsmasq

Configuring PXE Network Boot Server on CentOS 8 centos

dnsmasq should be installed.

Configuring PXE Network Boot Server on CentOS 8 centos

Now, rename the original /etc/dnsmasq.conf file to /etc/dnsmasq.conf.backup as follows:

$ sudo mv -v /etc/dnsmasq.conf /etc/dnsmasq.conf.backup

Configuring PXE Network Boot Server on CentOS 8 centos

Now, create an empty dnsmasq.conf file with the following command:

$ sudo vi /etc/dnsmasq.conf

Configuring PXE Network Boot Server on CentOS 8 centos

Now, type in the following lines in the dnsmasq.conf file and save it.

interface=ens256


bind-interfaces

domain=linuxhint.local


dhcp-range=ens256,192.168.15.100,192.168.15.240,255.255.255.0,8h


dhcp-option=option:router,192.168.15.1


dhcp-option=option:dns-server,192.168.15.1


dhcp-option=option:dns-server,8.8.8.8


enable-tftp


tftp-root=/netboot/tftp


dhcp-boot=pxelinux.0,linuxhint-s80,192.168.15.1


pxe-prompt=“Press F8 for PXE Network boot.”,5


pxe-service=x86PC,“Install OS via PXE”,pxelinux

Configuring PXE Network Boot Server on CentOS 8 centos

Now, create the required directory structure for PXE booting as follows.

$ sudo mkdir -pv /netboot/tftp/pxelinux.cfg

Configuring PXE Network Boot Server on CentOS 8 centos

Now, restart the dnsmasq service with the following command:

$ sudo systemctl restart dnsmasq

Configuring PXE Network Boot Server on CentOS 8 centos

dnsmasq service should be running.

$ sudo systemctl status dnsmasq

Configuring PXE Network Boot Server on CentOS 8 centos

Now, add the dnsmasq service to the system startup as follows:

$ sudo systemctl enable dnsmasq

Configuring PXE Network Boot Server on CentOS 8 centos

Installing and Configuring PXE Bootlaoder:

Now, you have to install the PXE bootloader files and copy them over to the TFTP root directory.

To install the PXE bootloader files, run the following command:

$ sudo dnf install -y syslinux

Configuring PXE Network Boot Server on CentOS 8 centos

Once syslinux is installed, copy the required files to the /netboot/tftp directory as follows:

$ sudo cp -v /usr/share/syslinux/{pxelinux.0,menu.c32,ldlinux.c32,libutil.c32}

/netboot/tftp/

Configuring PXE Network Boot Server on CentOS 8 centos

Installing Apache Web Server:

CentOS 8 support PXE booting over HTTP. So, you must use a web server to server the all the required files over HTTP in order to boot CentOS 8 installer via PXE. In this article, I will use Apache HTTP server.

You can install Apache HTTP server with the following command:

$ sudo dnf install -y httpd

Configuring PXE Network Boot Server on CentOS 8 centos

Apache HTTP server should be installed.

Configuring PXE Network Boot Server on CentOS 8 centos

Now, make a symbolic link /netboot/www of the /var/www/html directory for easier management of the PXE boot server as follows:

$ sudo ln -s /var/www/html /netboot/www

Configuring PXE Network Boot Server on CentOS 8 centos

Now, start the httpd service as follows:

$ sudo systemctl start httpd

Configuring PXE Network Boot Server on CentOS 8 centos

The httpd service should be running.

$ sudo systemctl status httpd

Configuring PXE Network Boot Server on CentOS 8 centos

Now, add the httpd service to the system startup with the following command:

$ sudo systemctl enable httpd

Configuring PXE Network Boot Server on CentOS 8 centos

Preparing CentOS 8 DVD for PXE Boot:

You can download CentOS 8 installer DVD image with the following command:

$ wget http://isoredirect.centos.org/centos/8/isos/x86_64/


CentOS-8.1.1911-x86_64-dvd1.iso

NOTE: The DVD image is about 7 GB in size. So, it will take a long time to download. That’s why, I used an older version of the DVD image I already had in my external hard drive. The process is the same for the new version of the DVD image. Just, make sure to replace the file name with the new one. That’s all.

Once you have CentOS 8 installer DVD downloaded, mount the DVD image in the /mnt directory as follows.

$ sudo mount -o loop CentOS-8-x86_64-1905-dvd1.iso /mnt

Configuring PXE Network Boot Server on CentOS 8 centos

Now, create the required directories for storing the CentOS 8 installer files and bootloader files as follows.

$ sudo mkdir -v /netboot/{tftp,www}/centos8

Configuring PXE Network Boot Server on CentOS 8 centos

Now, copy the contents of the ISO file to the /netboot/www/centos8/ directory as follows:

$ sudo rsync -avz /mnt/ /netboot/www/centos8

Configuring PXE Network Boot Server on CentOS 8 centos

The contents of the CentOS 8 installer DVD image should be copied to /netboot/www/centos8/ directory.

Configuring PXE Network Boot Server on CentOS 8 centos

Now, copy the initrd.img and vmlinuz files from the /netboot/www/centos8/images/pxeboot/ directory to the /netboot/tftp/centos8/ directory as follows:

$ sudo cp -v /netboot/www/centos8/images/pxeboot/{initrd.img,vmlinuz}

/netboot/tftp/centos8/

Configuring PXE Network Boot Server on CentOS 8 centos

Now, you can unmount the CentOS 8 installer DVD image and delete it if you want.

Configuring PXE Network Boot Server on CentOS 8 centos

$ rm CentOS-8-x86_64-1905-dvd1.iso

Configuring PXE Network Boot Server on CentOS 8 centos

Adding PXE Boot Entry for CentOS 8:

Now, you have to add a boot entry for CentOS 8 PXE booting on the /netboot/tftp/pxelinux.cfg/default file.

Open the configuration file /netboot/tftp/pxelinux.cfg/default for editing as follows.

$ sudo vi /netboot/tftp/pxelinux.cfg/default

Configuring PXE Network Boot Server on CentOS 8 centos

Now, type in the following lines in the /netboot/tftp/pxelinux.cfg/default file and save it.

default menu.c32


label install_centos8


menu label ^Install CentOS 8


menu default


kernel centos8/vmlinuz


append initrd=centos8/initrd.img ip=dhcp inst.repo=http://192.168.15.1/centos8/

Configuring PXE Network Boot Server on CentOS 8 centos

Configuring the Firewall:

Now, you have to open some ports from your firewall for the PXE boot server to work.

Allow the DHCP, HTTP, TFTP services through the firewall as follows.

$ sudo firewall-cmd –add-service={dhcp,http,tftp} –permanent

Configuring PXE Network Boot Server on CentOS 8 centos

Also allow the UDP port 4011 and 69 through the firewall as follows.

$ sudo firewall-cmd –add-port={4011/udp,69/udp} –permanent

Configuring PXE Network Boot Server on CentOS 8 centos

For the changes to take effect, run the following command:

$ sudo firewall-cmd –reload

Configuring PXE Network Boot Server on CentOS 8 centos

Installing CentOS 8 via PXE:

Now, on the PXE client where you want to install CentOS 8 over the network via PXE, go to the BIOS and select Network Boot.

Configuring PXE Network Boot Server on CentOS 8 centos

When you see the following message, press .

Configuring PXE Network Boot Server on CentOS 8 centos

Now, select Install OS via PXE and press .

Configuring PXE Network Boot Server on CentOS 8 centos

You will only have one option. So, just press .

Configuring PXE Network Boot Server on CentOS 8 centos

CentOS 8 installer is booting over the network via PXE.

Configuring PXE Network Boot Server on CentOS 8 centos

The CentOS 8 graphical installer should start. Now, you can install CentOS 8 as usual. If you need any assistance on installing CentOS 8, you may check my article How to Install CentOS 8 Server.

Configuring PXE Network Boot Server on CentOS 8 centos

CentOS 8 installer configuration window.

Configuring PXE Network Boot Server on CentOS 8 centos

CentOS 8 being installed.

Configuring PXE Network Boot Server on CentOS 8 centos

CentOS 8 installation completed.

Configuring PXE Network Boot Server on CentOS 8 centos

CentOS 8 installed over the network via PXE. It’s also running correctly.

Configuring PXE Network Boot Server on CentOS 8 centos

So, that’s how you configure PXE network boot server on CentOS 8 and boot CentOS 8 installer DVD image over the network via PXE. Thanks for reading this article.

About the author

Configuring PXE Network Boot Server on CentOS 8 centos

Linux Explorer

Linux Explorer — Always exploring Linux and learning to advance the state of the art.