Master PXE Network Boot: Fast Batch Linux Installation with Kickstart
This guide explains how to set up a PXE server for efficient batch network installation of Linux, covering DHCP, TFTP, FTP repository configuration, bootloader preparation, Kickstart unattended installation, and verification steps to automate OS deployment without manual media.
PXE High‑Efficiency Batch Network Installation
1. Deploy PXE Remote Installation Service
PXE (Preboot eXecution Environment) is an Intel‑developed network boot technology that works in a client/server mode, allowing a client to download a boot image and installation files or an entire operating system from a remote server.
Three advantages of PXE batch deployment:
Scale: install multiple servers simultaneously.
Automation: install the system and configure services automatically.
Remote: no need for CD, USB, or other installation media.
Prerequisites for building a PXE network:
Server: run DHCP to assign IP addresses and locate the boot program; run TFTP to provide the boot program download.
Client: network card must support PXE and the motherboard must support network boot.
1) Build the 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 set up 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
The TFTP service is provided by the tftp-server package; edit /etc/xinetd.d/tftp to change disable = yes to 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 (under images/pxeboot) to the TFTP root directory.
cd /media/cdrom/images/pxeboot cp vmlinuz initrd.img /var/lib/tftpboot cd /media/cdrom/isolinux/ cp ldlinux.c32 libcom32.c32 /var/lib/tftpboot/
ldlinux.c32 : part of SYSLINUX, loads the Linux kernel and initramfs during PXE boot.
libcom32.c32 : library of common functions used by SYSLINUX boot programs.
4. Prepare PXE bootloader
Install syslinux to obtain pxelinux.0 and copy it 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 TFTP server (example IP range 192.168.10.200‑250, server 192.168.10.101).
dnf -y install dhcp vim /etc/dhcp/dhcpd.conf
systemctl start dhcpd systemctl enable dhcpd
next-server : specifies the TFTP server address.
filename : specifies the PXE boot program file name.
6. Configure boot menu
Create the directory /var/lib/tftpboot/pxelinux.cfg and edit the default file to define kernel parameters.
mkdir /var/lib/tftpboot/pxelinux.cfg vim /var/lib/tftpboot/pxelinux.cfg/default
2. Implement Kickstart Unattended Installation
While PXE removes the need for physical media, manual steps such as language selection and source specification remain. Kickstart automates these by providing a response file ( ks.cfg) that the installer reads.
(1) Edit the Kickstart response file
vim /var/ftp/ks.cfg
url --url="ftp://192.168.10.101/euler"
# System language
lang zh_CN.UTF-8
keyboard us
# Network configuration (DHCP example)
network --bootproto=dhcp --device=ens160 --activate
# Root password (hashed)
authselect --enableshadow --passalgo=sha512
selinux --enforcing
rootpw --iscrypted j9T46wHHCdZ1EXPI8G8Ms9rE20JnYOkuLkXzyrq4nbwS98
# Timezone
timezone Asia/Shanghai
# Automatic partitioning (LVM, ext4)
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 (optional)
sed -i 's/^#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config
%end
reboot(2) Enable batch automatic installation
Add the Kickstart parameter to the PXE boot menu so that clients download ks.cfg automatically.
vim /var/lib/tftpboot/pxelinux.cfg/default
(3) Verify
After enabling the Kickstart file, each PXE‑booted client automatically downloads ks.cfg and proceeds with a fully unattended Linux installation.
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.
Raymond Ops
Linux ops automation, cloud-native, Kubernetes, SRE, DevOps, Python, Golang and related tech discussions.
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.
