How to Install Debian Using PXE Network Boot
Categories:
5 minute read
When managing multiple systems or setting up headless servers, PXE (Preboot Execution Environment) network booting is an efficient way to install operating systems such as Debian. PXE booting allows a machine to boot from a network interface before accessing local storage, eliminating the need for physical media like USB drives or DVDs.
This guide will walk you through the process of setting up a PXE environment and using it to install Debian on a client machine. We’ll go step-by-step, covering everything from setting up your PXE server to completing the Debian installation on your target system.
What Is PXE Boot?
PXE (pronounced “pixie”) allows a computer to boot from its network card rather than from a local storage device. The PXE protocol relies on DHCP (Dynamic Host Configuration Protocol) to assign an IP address and TFTP (Trivial File Transfer Protocol) to download boot files.
PXE is particularly useful in the following scenarios:
- Installing OS on multiple systems without physical media
- Automating deployments
- Booting diskless systems
- Reinstalling or repairing systems remotely
Prerequisites
Before proceeding, make sure you have the following:
Hardware
- One PXE server (can be a Debian system)
- One or more PXE client machines (with PXE support in BIOS/UEFI)
- A local network (LAN)
Software on PXE Server
- A DHCP server (e.g.,
isc-dhcp-server
) - A TFTP server (e.g.,
tftpd-hpa
) - A web server (optional, but recommended for faster file transfers)
- PXELINUX (from SYSLINUX package)
- Debian installation files (Netboot image or ISO)
Let’s get started by setting up the PXE server.
Step 1: Setting Up the PXE Server
This example assumes the PXE server is running Debian (or a Debian-based distro). Root privileges are required for setup.
Update and Install Necessary Packages
sudo apt update
sudo apt install isc-dhcp-server tftpd-hpa syslinux pxelinux syslinux-common wget apache2
Directory Setup for TFTP
Create a TFTP root directory and link PXE bootloaders:
sudo mkdir -p /srv/tftp
cd /srv/tftp
sudo cp /usr/lib/PXELINUX/pxelinux.0 .
sudo mkdir pxelinux.cfg
sudo cp /usr/lib/syslinux/modules/bios/ldlinux.c32 .
Step 2: Configure DHCP Server
The DHCP server will assign IP addresses and point clients to the PXE bootloader.
Edit the DHCP configuration file:
sudo nano /etc/dhcp/dhcpd.conf
Example configuration snippet:
option domain-name "example.local";
option domain-name-servers 8.8.8.8;
default-lease-time 600;
max-lease-time 7200;
authoritative;
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.100 192.168.1.200;
option routers 192.168.1.1;
filename "pxelinux.0";
next-server 192.168.1.10; # IP of PXE server
}
Restart the DHCP server:
sudo systemctl restart isc-dhcp-server
Ensure it is enabled:
sudo systemctl enable isc-dhcp-server
Step 3: Configure the TFTP Server
Edit the TFTP configuration:
sudo nano /etc/default/tftpd-hpa
Set the following:
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/srv/tftp"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="--secure"
Restart and enable the service:
sudo systemctl restart tftpd-hpa
sudo systemctl enable tftpd-hpa
Step 4: Download Debian Netboot Files
Use the Debian netboot tarball to get kernel and initrd files.
cd /srv/tftp
sudo wget http://deb.debian.org/debian/dists/stable/main/installer-amd64/current/images/netboot/netboot.tar.gz
sudo tar -xvzf netboot.tar.gz
sudo cp -r debian-installer/amd64/* .
Your TFTP root should now contain linux
, initrd.gz
, and other boot files.
Step 5: Configure PXELINUX Boot Menu
Create the boot menu configuration file:
sudo nano /srv/tftp/pxelinux.cfg/default
Example PXELINUX configuration:
DEFAULT install
LABEL install
KERNEL linux
APPEND initrd=initrd.gz vga=normal
TEXT HELP
Boot and install Debian via network.
ENDTEXT
Optional: Add an automatic preseed file URL to the APPEND
line if you want unattended installation.
Step 6: (Optional) Host Debian Packages via HTTP
For faster installation, host a Debian mirror or mount ISO contents.
Mount ISO (if using full ISO image):
sudo mkdir /var/www/html/debian
sudo mount -o loop debian-12.5.0-amd64-netinst.iso /var/www/html/debian
Verify it’s accessible in a browser:http://<PXE_SERVER_IP>/debian/
If you’re using a preseed for automation, place it in /var/www/html/preseed.cfg
.
Step 7: PXE Boot the Client
Now that the PXE server is ready:
- Start the client machine.
- Enter BIOS/UEFI settings.
- Enable PXE or Network Boot.
- Set PXE as the first boot device.
- Reboot.
The client should contact the PXE server, download pxelinux.0
, display the Debian installer boot menu, and start the Debian network installation process.
Step 8: Completing the Debian Installation
Once booted, the Debian installer will:
- Ask for language and region
- Detect hardware
- Configure network via DHCP
- Let you partition the disk
- Install base system and GRUB
- Reboot into your new Debian system
If you’ve added a preseed file, some or all of these steps can be automated.
Troubleshooting PXE Boot Issues
Here are some common issues and solutions:
Problem | Solution |
---|---|
PXE-E53: No boot filename received | Check DHCP config for filename "pxelinux.0"; |
TFTP timeout | Ensure tftpd-hpa is running and firewall allows UDP port 69 |
Blank PXE menu | Check for missing pxelinux.cfg/default file |
Boot loops | Ensure correct initrd and linux paths in PXE config |
Client fails to boot | Check for architecture mismatch (BIOS vs UEFI) |
Automating Installation with Preseed
Preseed files allow for unattended installations. Add the following line to the APPEND
in your PXELINUX config:
APPEND initrd=initrd.gz auto=true priority=critical preseed/url=http://<PXE_SERVER_IP>/preseed.cfg
Create preseed.cfg
and host it under your web server directory (/var/www/html/
).
Advantages of PXE Booting Debian
- No need for physical media
- Faster deployment in large environments
- Great for headless systems or data centers
- Easily customizable with preseed files
- Reusable setup for other distributions
Final Thoughts
Installing Debian using PXE network boot may seem complex at first, but it offers incredible flexibility, especially for sysadmins managing multiple machines or virtual environments. Once configured, the PXE server can be reused for many installations, saving time and reducing physical hardware dependencies.
If you plan on deploying multiple Debian systems frequently, PXE booting with optional automation via preseed files is one of the most efficient and professional methods available.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.