Master PXE Network Boot: Fast, Automated Linux Installations
This guide walks you through setting up a PXE server for scalable, automated Linux installations, covering DHCP, TFTP, boot program configuration, and integrating Kickstart unattended installation to eliminate manual setup steps.
PXE Efficient Batch Network Installation
1. Deployment
PXE (Preboot Execution Environment) is an Intel‑developed network boot technology that works in a client/server mode, allowing a client to download boot images and install files or an entire OS from a remote server.
Advantages of PXE batch deployment:
Scalability: install multiple servers simultaneously
Automation: install OS and configure services automatically
Remote: no need for CD, USB, or other installation media
Prerequisites for building a PXE network:
Server: DHCP service for address allocation and locating the boot program; TFTP service for boot program download.
Client: NIC supports PXE, motherboard supports network boot.
(1) Set up PXE remote installation server
1. Prepare Linux installation source
systemctl stop firewalld systemctl disable firewalld setenforce 0 sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
Publish the installation source via FTP and create a YUM repository.
mkdir /media/cdrom mount /dev/cdrom /media/cdrom dnf -y install vsftpd mkdir /var/ftp/euler cp -rf /media/cdrom/* /var/ftp/euler vim /etc/vsftpd/vsftpd.conf anonymous_enable=YES
systemctl start vsftpd
2. Install and enable TFTP service
TFTP is provided by the tftp-server package; edit /etc/xinetd.d/tftp to set disable = no and start the service.
dnf -y install tftp-server vim /etc/xinetd.d/tftp
3. Prepare Linux kernel and initramfs
Copy vmlinuz and initrd.img from the installation CD (directory images/pxeboot) to the TFTP root.
cd /media/cdrom/images/pxeboot cp vmlinuz initrd.img /var/lib/tftpboot cd /media/cdrom/isolinux cp ldlinux.c32 libcom32.c32 /var/lib/tftpboot/
4. Prepare PXE boot program
Install syslinux and copy pxelinux.0 to the TFTP root.
dnf -y install syslinux cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot
5. Install and enable DHCP service
Configure DHCP to assign IP addresses and point clients to the PXE boot file.
dnf -y install dhcp vim /etc/dhcp/dhcpd.conf systemctl start dhcpd systemctl enable dhcpd
Key DHCP options include the TFTP server address (netx‑server) and the boot file name (filename).
6. Configure boot menu
Create the directory /var/lib/tftpboot/pxelinux.cfg and edit the default file with appropriate kernel and initrd entries.
mkdir /var/lib/tftpboot/pxelinux.cfg vim /var/lib/tftpboot/pxelinux.cfg/default
(2) Verify PXE network installation
After the PXE server is ready, boot a client (bare metal or virtual machine). Ensure the BIOS boot order is set to Network. The client will obtain an IP via DHCP, download pxelinux.0 via TFTP, and follow the boot menu.
Selecting “auto” proceeds to the graphical installer; “linux text” starts a text‑mode installer; “linux rescue” enters rescue mode.
2. Implement Kickstart unattended installation
PXE removes the need for physical media, but manual language, keyboard, and source selection remain. Using a Kickstart answer file automates these steps.
(1) Edit Kickstart file
url --url="ftp://192.168.10.101/euler"
lang zh_CN.UTF-8
keyboard us
network --bootproto=dhcp --device=ens160 --activate
authselect --enableshadow --passalgo=sha512
selinux --enforcing
rootpw --iscrypted j9T46wHHCdZ1EXPI8G8Ms9rE20JnYOkuLkXzyrq4nbwS98
timezone Asia/Shanghai
autopart --type=lvm --fstype=ext4
bootloader --location=mbr
clearpart --all --initlabel
%packages --nocore
@^minimal-environment
kernel
grub2
efibootmgr
%end
%post
systemctl disable firewalld
# enable root SSH login if needed
%end
rebootPlace ks.cfg in the FTP directory and reference it from the PXE boot menu.
(2) Enable batch unattended installation
Add the ks=... parameter to the default boot menu to point to the Kickstart file.
vim /var/lib/tftpboot/pxelinux.cfg/default
Now each PXE‑booted client will automatically install Linux according to the Kickstart configuration without manual intervention.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
