Installing an operating system on each server manually consumes too much time and can cause errors. PXE (Preboot Execution Environment) with Kickstart automation allows your servers automatically download the OS from a central server over the network, configure themselves, and reboot. In this guide, you will learn Automated OS Setup with PXE and Kickstart.
When you combine PXE boot with Kickstart scripts, there is no need for USB drives, no clicking through installers, and no manual steps.
This guide will show you how to set up a complete PXE deployment server on RHEL 9, configure DHCP, TFTP, and HTTP servers, create a Kickstart automation file, and deploy multiple machines in minutes.
Whether you're managing a small cluster or a large cluster at PerLod Hosting, this technique is essential for scaling your infrastructure efficiently.
Prerequisites for Automated OS Setup with PXE and Kickstart
In this article, you will learn to set up a central deployment server that allows other servers in the same network to boot from the network and automatically install the OS.
Here is what you need for this guide:
Server: A flexible dedicated server or VM with a static IP address like 192.168.100.10 running AlmaLinux 9 or any RHEL 9, like Rocky Linux 9.
Client: A bare-metal server or VM connected to the same network, configured to boot from Network (PXE) in BIOS/UEFI.
ISO File: The AlmaLinux 9 minimal ISO.
Install Required Services for PXE Kickstart Baremetal Provisioning
A PXE boot server requires three core services working together, including:
DHCP assigns IP addresses to clients requesting a network boot.
TFTP transfers the bootloader (firmware files) to the booting machine.
HTTP hosts the OS installation files and Kickstart automation script.
As a root user, run the following commands to update the system packages and install these required services:
Open Firewall Ports and Adjust SELinux in PXE Server
Before PXE clients can access the services, the PXE server must allow the required network traffic. You must open the firewall for DHCP, TFTP, and HTTP so clients can get an IP address, download the boot files, and access the installation source.
Also, SELinux can block TFTP/HTTP access if the correct labels aren’t set. You can temporarily set SELinux to Permissive mode for this guide.
In production, it's better to keep Enforcing and applying proper SELinux rules.
Allow traffic for DHCP (67/UDP), TFTP (69/UDP), and HTTP (80/TCP) by using the commands below:
Now that DHCP and TFTP can boot the client, the installer still needs a place to download the OS packages and read the Kickstart file from. You can turn your PXE server into a simple HTTP repo by mounting the AlmaLinux ISO and copying its contents into Apache’s web directory.
If you don't download the ISO image, you can use the commands below to download it:
Then, restore permissions so Apache can read them:
Bash
chmod-R755/var/www/html/almalinux9umount/mnt
Now every PXE client can pull the full installer content directly from:
Bash
http://PXE-SERVER-IP/almalinux9/
This makes deployments fast, consistent, and easy to scale.
Configure UEFI PXE Boot Files
Most modern dedicated servers boot in UEFI mode, so your PXE setup must provide the correct UEFI boot chain over TFTP.
You can copy the signed UEFI bootloader files, including Shim and GRUB, with the installer kernel (vmlinuz) and initramfs (initrd.img) into your TFTP root so the client can boot the installer and then continue the automated Kickstart install.
Create the UEFI-specific directory with the command below:
Bash
mkdir-p/var/lib/tftpboot/uefi
Copy the bootloaders from the ISO content we just extracted with the commands below:
Note: The UEFI firmware typically downloads BOOTX64.EFI, which then loads grubx64.efi, and GRUB reads a grub.cfg file (commonly placed alongside them under a uefi/ directory).
Configure DHCP for PXE Boot
DHCP is what makes PXE discoverable. When a client boots from the network, it first asks for an IP address, and the DHCP server replies with both an IP lease and the information needed to start the boot process (the PXE server address and the boot file name).
At this point, you can configure DHCP to point clients to your PXE server and to deliver the correct UEFI bootloader by detecting the client's architecture type.
This ensures modern UEFI servers boot correctly, while still allowing an optional legacy BIOS fallback if you need it.
Edit /etc/dhcp/dhcpd.conf file as shown below:
Bash
# /etc/dhcp/dhcpd.conf# Global optionsoptionspacepxelinux;optionpxelinux.magiccode208=string;optionpxelinux.configfilecode209=text;optionpxelinux.pathprefixcode210=text;optionpxelinux.reboottimecode211=unsignedinteger32;optionarchitecture-typecode93=unsignedinteger16;subnet192.168.100.0netmask255.255.255.0{range192.168.100.100192.168.100.200;optionrouters192.168.100.1;optionsubnet-mask255.255.255.0;optiondomain-name-servers8.8.8.8;# PXE Server IP (This server)next-server192.168.100.10;# Logic to detect UEFI clientsifoptionarchitecture-type=00:07{filename"uefi/BOOTX64.EFI";}elseifoptionarchitecture-type=00:09{filename"uefi/BOOTX64.EFI";}else{# Legacy BIOS fallback (optional, requires pxelinux.0)filename"pxelinux.0";}}
Once you're done, restart DHCP with the command below:
Bash
systemctlrestartdhcpd
Create a Kickstart File for Unattended Installation
Kickstart is the automation part of your PXE deployment, which pre-answers the installer questions such as language, disk layout, network, packages, users, and post-install actions, so the installation runs fully unattended.
In this step, you can generate a secure hashed root password, write your ks.cfg, and host it over HTTP so every PXE-booted server can fetch it during installation.
Generate an encrypted root password with the command below:
Bash
opensslpasswd-6MySecurePassword123
Create /var/www/html/ks.cfg file and add the following script to the file:
Bash
# /var/www/html/ks.cfg# Use text mode installtext# Don't run the Setup Agent on first bootfirstboot--disable# Keyboard layoutskeyboard--vckeymap=us--xlayouts='us'# System languagelangen_US.UTF-8# Network information# "link" automatically picks the first active linknetwork--bootproto=dhcp--device=link--ipv6=auto--activatenetwork--hostname=localhost.localdomain# Root password (paste the output of openssl passwd -6 here)rootpw--iscrypted$6$randomsalt$hashedpasswordstring...# System timezonetimezoneAsia/Dubai--isUtc# Installation source (Point to your HTTP server)url--url="http://192.168.100.10/almalinux9/"# Bootloader configurationbootloader--location=mbr--append="rhgb quiet crashkernel=auto"# Clear the Master Boot Recordzerombr# Remove all existing partitionsclearpart--all--initlabel# Disk Partitioning (Automatic LVM)autopart--type=lvm# Reboot after installationreboot# Packages to install%packages@^minimal-environmentkexec-toolsvimcurl%end# Post-installation script (optional)%postecho"Welcome to your new server">/etc/motd%end
Once you are done, you can check for any syntax errors by installing the pykickstart tool and running the command below:
Bash
ksvalidator/var/www/html/ks.cfg
Create the GRUB PXE Menu
After the client downloads the UEFI boot files over TFTP, GRUB takes control and needs a boot menu that tells the installer kernel where to find your installation source and your Kickstart file.
At this point, you can create a Grub file with two choices, including an unattended install and a manual install for interactive setups.
Create /var/lib/tftpboot/uefi/grub.cfg file and add the following content to the file:
ip=dhcp: Tells the kernel to request an IP during boot.
inst.ks=…: Points to the automation script.
inst.repo=…: Points to the installation files.
Test PXE with Kickstart Deployment
Now that everything is configured, you can restart services, do a quick permissions sanity check, and then PXE-boot a client to confirm the deployment works.
Restart the services with the commands below:
Bash
systemctlrestartdhcpdhttpd
Ensure /var/lib/tftpboot and /var/www/html are readable.
Boot the Client:
Turn on the dedicated server or VM.
Enter BIOS or Boot Menu.
Select PXE and Network Boot.
During boot:
You should see the client get an IP (DHCP).
It will download BOOTX64.EFI (TFTP).
The GRUB menu will appear.
Once the timer expires or you press Enter, it will load the kernel, fetch the ks.cfg file from HTTP, and automatically start formatting the drive.
Troubleshooting Common PXE Issues
Here are the most common PXE errors and their solutions:
Issue1. Client times out / skips PXE:
If the client doesn’t get an IP fast enough, it usually falls back to the next boot device. Start by confirming the DHCP service is running and actually listening on the correct interface, especially if the PXE server has multiple NICs or VLANs.
Check DHCP status and logs with the commands below:
Bash
systemctlstatusdhcpdjournalctl-udhcpd
Verify the client’s MAC is not blocked upstream.
Confirm the DHCP scope matches the client subnet and that the server’s firewall allows DHCP.
Issue 2. TFTP “File not found”:
This almost always means DHCP is pointing to a file that doesn’t exist under the TFTP root, or GRUB is referencing paths incorrectly.
Check TFTP logs with the command below:
Bash
journalctl-utftp
Ensure the boot filename matches your folder layout. For example, uefi/BOOTX64.EFI must exist under /var/lib/tftpboot/uefi/.
In grub.cfg, use paths relative to the TFTP root, for example:
If you can open a shell in the installer environment, test connectivity to the PXE server IP and HTTP URLs.
Confirm firewall allows HTTP and DHCP, and that routing is correct for that subnet.
Conclusion
At this point, you have a fully automated bare-metal server deployment pipeline, which is one of the most powerful tools in any IT infrastructure. PXE with Kickstart setup handles DHCP, network boot, OS installation, partitioning, package selection, and post-install configuration without a single manual click.
DHCP discovers and directs network clients to your PXE server.
TFTP transfers the UEFI bootloader chain.
HTTP delivers the OS installer packages and automation scripts.
Kickstart removes human interaction entirely.
We hope you enjoy this guide on Automated OS Setup with PXE and Kickstart. Subscribe to our X and Facebook channels to get the latest articles.
No. PXE with Kickstart is exclusive to Linux systems, including RHEL, AlmaLinux, Debian, Ubuntu, etc.
The installer usually drops to a shell. You can fix the Kickstart, reboot the client, and try again.
Yes, but you'll need a DHCP relay agent that forwards PXE requests to your central DHCP server.
We use cookies to run PerLod and to understand how the site is used. You can accept everything, or open Manage to turn individual categories off. Cookie policy.