How to Set Up a PXE Boot Server: A Sysadmin's Not-So-Secret Playbook

March 6, 2026

How to Set Up a PXE Boot Server: A Sysadmin's Not-So-Secret Playbook

Ever watched a tech movie where a hacker types furiously and suddenly, *poof*, a hundred identical computers spring to life? While the dramatic typing is optional, the magic behind that—booting many machines over the network—is very real. It's called PXE (Preboot eXecution Environment) booting. This tutorial is for you: the curious homelab enthusiast, the aspiring sysadmin, or the IT professional tired of running around with USB sticks. By the end, you'll have your own digital cloning factory, letting you install or rescue systems over the network with a few clicks. No magic required, just a bit of configuration and a willingness to laugh at error messages.

Who This Is For & What You'll Learn

This guide is perfect for anyone who manages more than one computer. Whether you're a DevOps engineer automating infrastructure, a small business owner setting up a computer lab, or just a tech geek who loves efficiency, you'll learn how to:

  • Understand the core components of network booting (DHCP, TFTP, HTTP).
  • Configure a Linux server (we'll use Ubuntu) as a PXE host.
  • Serve a Linux installer (like Ubuntu) over the network.
  • Direct client machines to boot from your server instead of their local drives.
Think of it as teaching your computers to listen to a central conductor instead of playing their own solo tunes.

Gear Up: Your Pre-Flight Checklist

Before we start, let's gather our tools. You'll need:

  • A Server: Any spare machine or virtual machine running Ubuntu Server 22.04 LTS. It needs a static IP address on your local network (let's use 192.168.1.100 for this guide).
  • Network: A switched network (a simple home router is fine). The server and client machines must be on the same subnet.
  • A Client Test Machine: A physical PC or VM that supports PXE boot in its BIOS/UEFI (almost all modern ones do).
  • Your Brain & Terminal: A sense of humor for debugging and a command-line window ready to go.
Insider Tip: Do this in an isolated lab network first. Mistakenly broadcasting boot instructions to your roommate's gaming PC mid-match is a surefire way to become unpopular.

Step 1: The DHCP Dance - Assigning Addresses with a Hint

PXE starts with DHCP. When a client boots, it shouts, "I need an IP address!" A normal DHCP server just gives an address. Our server needs to also whisper, "Psst... your boot files are over there at this TFTP server."

First, install the DHCP server: sudo apt update && sudo apt install isc-dhcp-server -y

Now, let's configure it. Edit the main config file: sudo nano /etc/dhcp/dhcpd.conf

Clear out or comment the existing lines and add a configuration like this (adjust for your network!):

authoritative;
subnet 192.168.1.0 netmask 255.255.255.0 {
    range 192.168.1.150 192.168.1.200;
    option routers 192.168.1.1;
    option subnet-mask 255.255.255.0;
    option domain-name-servers 8.8.8.8;
    # The Magic PXE Lines:
    next-server 192.168.1.100; # Your server's static IP
    filename "boot/grub/x86_64-efi/core.efi"; # For UEFI clients
}
Save and exit. Then, tell the DHCP server which network interface to listen on: sudo nano /etc/default/isc-dhcp-server Set INTERFACESv4="ens33" (replace 'ens33' with your server's interface name; find it with `ip a`).

Finally, start the service: sudo systemctl restart isc-dhcp-server. Check it's happy with sudo systemctl status isc-dhcp-server.

Step 2: The TFTP & HTTP File Delivery Service

The client now knows where to ask for files. We need to set up the "file waiter" (TFTP for small boot files) and the "buffet table" (HTTP for the large OS installer images).

Install the packages: sudo apt install tftpd-hpa apache2 -y

Configure TFTP: Edit its config: sudo nano /etc/default/tftpd-hpa. Ensure it looks like this:

TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/srv/tftp"
TFTP_ADDRESS=":69"
TFTP_OPTIONS="--secure"
Create the directory and set permissions: sudo mkdir -p /srv/tftp && sudo chown -R tftp:tftp /srv/tftp Restart: sudo systemctl restart tftpd-hpa.

Prepare Apache (HTTP): We'll just use the default web root. We'll put our OS images here later.

Step 3: Fetching & Serving the Boot Magic (GRUB & OS Image)

This is where we get the actual bootloader and OS. We'll use the versatile GRUB bootloader and an Ubuntu ISO.

1. Install GRUB for TFTP: sudo apt install grub-efi-amd64 grub-efi-amd64-bin grub-common -y

2. Copy the GRUB modules and core image to the TFTP directory: sudo mkdir -p /srv/tftp/boot/grub/x86_64-efi sudo cp -r /usr/lib/grub/x86_64-efi/* /srv/tftp/boot/grub/x86_64-efi/ sudo grub-mknetdir --net-directory=/srv/tftp --subdir=boot/grub

3. Download and extract an Ubuntu Netboot Image: cd /tmp wget https://archive.ubuntu.com/ubuntu/dists/jammy/main/installer-amd64/current/legacy-images/netboot/netboot.tar.gz sudo tar -xf netboot.tar.gz -C /srv/tftp/

4. Get the full Ubuntu ISO for HTTP installation: cd /var/www/html sudo wget https://releases.ubuntu.com/22.04.3/ubuntu-22.04.3-live-server-amd64.iso

Step 4: Crafting the GRUB Menu - The Boot Butler

We need to tell GRUB what to offer the client. Create a menu file: sudo nano /srv/tftp/boot/grub/grub.cfg

Add a simple menu entry to boot the Ubuntu installer over HTTP (faster than TFTP):

menuentry "Install Ubuntu 22.04 Jammy (HTTP)" {
    set gfxpayload=keep
    linux /ubuntu-installer/amd64/linux url=http://192.168.1.100/ubuntu-22.04.3-live-server-amd64.iso ---
    initrd /ubuntu-installer/amd64/initrd.gz
}
This tells the client to fetch the kernel (`linux`) and initial ramdisk (`initrd`) from your TFTP server, but then pull the entire ISO from your HTTP server. Clever, right?

Step 5: The Moment of Truth - Booting a Client

Take your test client machine. Enter its BIOS/UEFI setup (usually by mashing F2, F12, or Del during startup).

1. Enable "Network Boot" or "PXE Boot" as a boot option. 2. Ensure it's set as the first boot device, or manually select it from the boot menu. 3. Save and exit. The machine should reboot, get an IP from your server, download GRUB, and present you with your custom menu. 4. Select "Install Ubuntu 22.04 Jammy (HTTP)" and watch as it loads the installer from your network.

If you see the Ubuntu installer screen, pour yourself a drink—you've just built a digital assembly line!

Common Pitfalls & Troubleshooting

  • "No DHCP offers received": Your server's firewall (ufw) is probably blocking DHCP (port 67) or TFTP (port 69). Run sudo ufw allow from 192.168.1.0/24 to allow your whole subnet, or specifically allow the ports.
  • Client gets IP but fails with "TFTP timeout": Double-check the next-server IP in dhcpd.conf and that the TFTP service is running. The filename path in DHCP must match your GRUB core location exactly.
  • GRUB loads but says "file not found": Paths in grub.cfg are case-sensitive and relative to the TFTP root. Triple-check them.
  • It works in the lab but not on my main network: You likely have another DHCP server (your home router) interfering. Either disable DHCP on the router for your test or, better, always test in an isolated network.

Where to Go From Here: Level Up Your Setup

Congratulations, sysadmin! You've unlocked a core infrastructure skill. To truly automate like a pro, consider these next steps:

  • Automated Installations (Kickstart/Preseed): Create answer files so the OS installs itself without any manual questions.
  • Multiple OS Menus: Add entries for system rescue disks (like GParted Live), different Linux distros, or even Windows installation (though that's a more complex beast).
  • Diskless Workstations: Configure clients to run entirely from the network, with their root filesystem hosted on the server via NFS.
  • Tools like Cobbler or Foreman: These are full-blown provisioning systems that wrap PXE, DHCP, and package repos into a slick web interface for managing entire data centers.
The world of automated provisioning is now your oyster. Remember, the goal is to work smarter, not harder—so you can save your energy for solving the *real* important problems, like deciding which terminal color scheme is most productive.

AngetechnologyLinuxopen-source