This document describes how to set up a PXE (Preboot Execution Environment) boot server on CentOS 9 to allow network-based installation of Debian 12. The server uses DHCP to assign IP addresses, TFTP to provide boot files, and HTTP to serve installation files.
- A CentOS 9 server with at least 10GB of free disk space
- A network where you can control DHCP (either by using a dedicated network or configuring your existing network)
- Client machines that support PXE boot or UEFI network boot
This setup assumes the following network configuration:
- Router: 192.168.0.69
- PXE Server: 192.168.0.100
- DHCP Range: 192.168.0.110 - 192.168.0.200
sudo dnf install dhcp-server tftp-server tftp syslinux httpd wget
Set a static IP for your PXE server:
# Replace 'ens33' with your network interface name
sudo nmcli connection modify ens33 ipv4.addresses 192.168.0.100/24 ipv4.gateway 192.168.0.69 ipv4.dns "8.8.8.8 8.8.4.4" ipv4.method manual
sudo nmcli connection down ens33 && sudo nmcli connection up ens33
Create the DHCP configuration file:
sudo vi /etc/dhcp/dhcpd.conf
Add the following configuration:
option space pxelinux;
option pxelinux.magic code 208 = string;
option pxelinux.configfile code 209 = text;
option pxelinux.pathprefix code 210 = text;
option pxelinux.reboottime code 211 = unsigned integer 32;
option architecture-type code 93 = unsigned integer 16;
default-lease-time 600;
max-lease-time 7200;
authoritative;
subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.110 192.168.0.200;
option routers 192.168.0.69;
option domain-name-servers 8.8.8.8, 8.8.4.4;
option broadcast-address 192.168.0.255;
class "pxeclients" {
match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
next-server 192.168.0.100;
filename "ipxe.efi";
}
}
Start and enable the DHCP service:
sudo systemctl enable --now dhcpd
Create a systemd override for the TFTP service:
sudo mkdir -p /etc/systemd/system/tftp.service.d
sudo vi /etc/systemd/system/tftp.service.d/override.conf
Add the following content:
[Service]
ExecStart=
ExecStart=/usr/sbin/in.tftpd -s /var/lib/tftpboot
Create the TFTP boot directory and set permissions:
sudo mkdir -p /var/lib/tftpboot
sudo chmod -R 755 /var/lib/tftpboot
sudo chown -R nobody:nobody /var/lib/tftpboot
Enable and start the TFTP service:
sudo systemctl daemon-reload
sudo systemctl enable --now tftp.socket
Download the iPXE boot file:
cd /tmp
wget https://boot.ipxe.org/ipxe.efi
sudo cp ipxe.efi /var/lib/tftpboot/
Create the iPXE script:
sudo vi /var/lib/tftpboot/autoexec.ipxe
Add the following content:
#!ipxe
dhcp
kernel http://192.168.0.100/debian12/debian-installer/amd64/linux
initrd http://192.168.0.100/debian12/debian-installer/amd64/initrd.gz
boot
Enable and start the HTTP server:
sudo systemctl enable --now httpd
Create a directory for Debian installation files:
sudo mkdir -p /var/www/html/debian12
Download and extract Debian installation files:
cd /tmp
wget https://deb.debian.org/debian/dists/bookworm/main/installer-amd64/current/images/netboot/netboot.tar.gz
tar -xzf netboot.tar.gz
sudo cp -r debian-installer/* /var/www/html/debian12/
Allow necessary services through the firewall:
sudo firewall-cmd --permanent --add-service=dhcp
sudo firewall-cmd --permanent --add-service=tftp
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --reload
If you encounter permission issues, you might need to modify SELinux settings:
sudo setenforce 0 # Temporarily disable SELinux
For a permanent change, edit /etc/selinux/config
and set SELINUX=permissive
.
-
Ensure all services are running:
sudo systemctl status dhcpd tftp.socket httpd
-
On a client machine, configure it to boot from the network through BIOS/UEFI settings.
-
Connect the client machine to the same network as your PXE server.
-
Boot the client machine and watch it receive an IP address, download the boot files, and start the Debian installer.
- No DHCP response: Check if your router's DHCP server is disabled and if your PXE server's DHCP service is running.
- TFTP errors: Verify file permissions in
/var/lib/tftpboot
and check if the TFTP service is running. - HTTP server issues: Ensure the Apache server is running and files are accessible.
- iPXE boot failure: Verify that the autoexec.ipxe script is correct and that the paths to kernel and initrd files are valid.
- DHCP logs:
sudo journalctl -u dhcpd
- TFTP logs:
sudo journalctl -u tftp
- HTTP logs:
sudo journalctl -u httpd
- Monitor network traffic:
sudo tcpdump -i any port 67 or port 68 or port 69 -n