Automating Bulk System Deployments with PXE Network Boot

  1. System Installation Fundamentals

1.1 Boot Methods for System Installation

  1. Local Hard Drive2. Optical Media (USB Drive)3. Network Boot (PXE)### 1.2 Operating System Installation Process
  • Boot Loader Initialization

The Boot Loader is a small program that executes before the operating system kernel. It initializes hardware devices, establishes memory space mapping, and prepares the system environment for kernel execution. This critical component bridges the gap between firmware initialization and operating system startup.

  • Boot Menu Loading

After the Boot Loader initializes, users typically encounter a boot menu presenting various installation options such as launching the installer or entering rescue mode. This menu may be provided by the Boot Loader itself or pre-configured by the installation program.

  • Kernel and initrd Image Loading
  • Root Filesystem Mounting and Installation Wizard Execution

The root filesystem contains all essential files and directories required for operating system operation. During installation, specialized wizards like Anaconda (used by Red Hat-based distributions) guide users through system configuration.

1.3 Linux Installation Media Components

The isolinux directory on the installation disc contains all necessary files for the boot process:- boot.cat: Functions similarly to GRUB stage 1, serving as the initial boot sector

  • isolinux.bin: The optical media boot loader, explicitly referenced during ISO image creation; part of the SYSLINUX project
  • isolinux.cfg: Boot menu configuration file, automatically loaded after isolinux.bin execution
  • vesamenu.c32: Graphical boot menu interface (SYSLINUX project); menu.c32 provides a text-based alternative
  • memtest: Memory diagnostic utility
  • splash.png: Background image for the boot menu
  • vmlinuz: Compressed kernel image
  • initrd.img: RAM filesystem containing essential drivers and utilities
  1. PXE Technology Overview

2.1 PXE Introduction

PXE (Preboot eXecution Environment) enables automated network-based system deployment. Developed by Intel, PXE operates in a client/server model allowing computers to boot and load installation files directly from a remote server via network interface card firmware.

PXE enables client machines to download boot images from remote servers and load installation files or complete operating systems通过网络启动, leveraging built-in network card boot ROM capabilities.

Setting up a complete PXE deployment infrastructure requires these prerequisites:

The client machine's network adapter must support PXE protocol (integrated BOOTROM chip), and the motherboard must support network boot; Network infrastructure must include a DHCP server to assign IP addresses and specify boot file locations; A TFTP server must provide引导镜像文件的下载.

PXE is fundamentally a boot mechanism rather than an installation method itself. The protocol consists of client and server components. PXE client resides in network card ROM, executing at boot time under BIOS control. The client downloads boot files from a remote server and executes them locally.

PXE deployment requires coordinated DHCP and TFTP server configuration. DHCP provides IP addressing for client machines, with specific PXE-related options. The TFTP client exists within PXE ROM, enabling direct file retrieval from TFTP servers.

2.2 PXE Advantages

  • Scalability: Simultaneous deployment to multiple servers
  • Automation: Hands-free installation with pre-configured services
  • Remote Deployment: Eliminates physical media requirements (CDs, USB drives)

2.3 Required Services for PXE

Service Purpose
DHCP IP address assignment for bare-metal machines; communicates TFTP server location
TFTP UDP-based lightweight file transfer for boot images; port 69
FTP/HTTP/NFS Software package delivery (TFTP unsuitable for large transfers)
SYSLINUX Lightweight bootloader (pxelinux.0) for network boot
SYSTEM-CONFIG-KICKSTART Automated installation configuration tool

2.4 PXE Boot Sequence

  1. DHCP Discovery: PXE client broadcasts DHCP request seeking IP assignment
  2. DHCP Response: Server provides IP address and TFTP server coordinates
  3. Bootloader Request: Client contacts TFTP server for pxelinux.0
  4. Bootloader Transfer: TFTP sends pxelinux.0 to client
  5. Boot Menu Display: System presents installation options
  6. Installation Source Request: Client connects to file server (FTP/HTTP/NFS) for OS images
  7. Installation Files Transfer: File server provides installation components
  8. Installation Wizard: User proceeds through setup prompts
  9. PXE Batch Deployment Implementation

PXE Server 192.168.77.79
Client Machines Uninstalled bare-metal systems

Begin by installing required services:

yum install tftp-server vsftpd syslinux dhcp -y

Network interface: ens37

3.1 DHCP Server Configuration

Copy the sample configuration template:

cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf

Modify the configuration file:

vim /etc/dhcp/dhcpd.conf

subnet 192.168.77.0 netmask 255.255.255.0 {
  range 192.168.77.100  192.168.77.200;
  option routers 192.168.77.2;
  next-server 192.168.77.79;
  filename "pxelinux.0";
}

Enable the service:

systemctl start dhcpd
systemctl enable dhcpd

3.2 TFTP Server Configuration

TFTP (Trivial File Transfer Protocol) provides a lightweight file transfer mechanism using UDP. While lacking advanced features like directory listing or authentication, its minimal memory footprint makes it ideal for embedded systems and network boot scenarios.

Step 1: Configure TFTP under xinetd supervision

vim /etc/xinetd.d/tftp

Install xinetd if not present:

yum install xinetd -y

Step 2: Deploy PXE bootloader

cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/

The pxelinux.0 file serves as a binary指引程序 that orchestrates the installation process.

Note: The system-config-kickstart package must be installed for /usr/share/syslinux/ directory presence.

Step 3: Copy kernel and initialization images

Mount the installation media:

mount /dev/cdrom /mnt
cd /mnt/images/pxeboot/

Transfer boot files to TFTP root:

cp initrd.img vmlinuz /var/lib/tftpboot/

Step 4: Activate services

systemctl start xinetd
systemctl enable xinetd
systemctl start tftp
systemctl enable tftp

Step 5: Create boot menu configuration

The pxelinux.0 bootloader automatically searches for configuration in pxelinux.cfg/default:

mkdir /var/lib/tftpboot/pxelinux.cfg
vim /var/lib/tftpboot/pxelinux.cfg/default

default auto
prompt 1

label auto
      kernel vmlinuz
      append initrd=initrd.img method=ftp://192.168.77.79/centos7

label linux text
      kernel vmlinuz
      append text initrd=initrd.img method=ftp://192.168.77.79/centos7

label linux rescue
      kernel vmlinuz
      append rescue initrd=initrd.img method=ftp://192.168.77.79/centos7

3.3 FTP Server Configuration

Set up the installation repository:

yum -y install vsftpd
mount /dev/cdrom /mnt
mkdir /var/ftp/centos7
cp -rf /mnt/* /var/ftp/centos7
systemctl start vsftpd

Final Verification: Ensure all services are active and firewall rules permit traffic:

systemctl start dhcpd
systemctl start tftp
systemctl start vsftpd
systemctl start xinetd

  1. Kickstart Automated Installation

4.1 Kickstart Overview

Kickstart enables fully unattended installations by capturing all configuration parameters typically prompted during manual setup. The installer generates a configuration file (ks.cfg) containing predefined answers. Subsequent installations read this file automatically, eliminating manual intervention.

When a Kickstart file contains all required parameters, operators simply specify the ks.cfg location and the installation proceeds autonomously, concluding with configured reboot actions.

4.2 Deployment Procedure

Install the configuration generator:

yum install system-config-kickstart -y

Configure a local repository for package availability:

mkdir /etc/yum.repos.d/bak
mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak
cat > /etc/yum.repos.d/local.repo << 'EOF'
[local]
name=local
baseurl=ftp://192.168.77.79/centos7
enabled=1
gpgcheck=0
EOF

The system generates ks.cfg automatically. Verify the configuration file at /var/ftp/ks.cfg.

Add package selections at the end of the configuration:

%packages
@^graphical-server-environment
@base
@core
@desktop-debugging
@development
@dial-up
@fonts
@gnome-desktop
@guest-agents
@guest-desktop-agents
@hardware-monitoring
@input-methods
@internet-browser
@multimedia
@print-client
@x11
chrony
%end

4.3 Kickstart Configuration Reference

The ks.cfg file comprises three primary sections: configuration commands, package specifications, and scripts.

**Configuration Section** **Command** **Description**
**Command Section** keyboard Keyboard layout setting
lang System language configuration
zerombr Clear Master Boot Record
clearpart Remove existing partitions
part Define new partitions
rootpw Root user password
timezone System timezone
text Text-mode installation
network Network interface configuration
firewall Firewall settings
selinux SELinux policy
reboot Auto-reboot post-installation
**Package Section** %packages Package list delimiter
@^environment-group Install environment group
@group-name Install specific group
package-name Install individual package
-package-name Exclude specific package
**Script Section** %pre Pre-installation script
%post Post-installation script

4.4 Sample Kickstart Configurations

Minimal Installation Configuration:

install
keyboard 'us'
rootpw --iscrypted $1$9Rn8W7vF$npbKh8CeIbTxjwHUlcW4n0
url --url="ftp://192.168.77.79/centos7"
lang en_US
auth  --useshadow  --passalgo=sha512
text
firstboot --disable
selinux --disabled
firewall --disabled
network  --bootproto=dhcp --device=ens33
reboot
timezone Asia/Shanghai
bootloader --location=mbr
zerombr
clearpart --all --initlabel
part / --fstype="xfs" --grow --size=1
part swap --fstype="swap" --size=2048
part /boot --fstype="xfs" --size=300

%packages
@base
@^gnome-desktop-environment
%end

Graphical Installation with Post-Configuration:

install
keyboard 'us'
rootpw --iscrypted $1$d7Ivo70y$R6meNEYHLhc6/gb8OeLOd1
lang zh_CN
auth  --useshadow  --passalgo=sha512
graphical
firstboot --disable
selinux --disabled
nfs --server=192.168.77.79 --dir=centos7
firewall --disabled
network  --bootproto=dhcp --device=ens33
halt
timezone Asia/Shanghai
bootloader --location=mbr
zerombr
clearpart --all --initlabel
part / --fstype="xfs" --grow --size=1

%post --interpreter=/bin/bash
mkdir /etc/yum.repos.d/bak
mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak
cat > /etc/yum.repos.d/local.repo << 'EOF'
[local]
name=local
baseurl=ftp://192.168.77.79/centos7
enabled=1
gpgcheck=0
EOF
%end

%packages
@base
@^gnome-desktop-environment
%end

4.5 Integrating Kickstart with PXE Boot Menu

Modify the default boot configuration to include Kickstart parameters:

vim /var/lib/tftpboot/pxelinux.cfg/default

When prompt is set to 0, the system automatically executes ks.cfg (fully unattended); setting it to 1 requires manual configuration.

default auto
timeout=600
label auto
        kernel vmlinuz
        append initrd=initrd.img method=ftp://192.168.77.79/centos7 ks=ftp://192.168.77.79/ks.cfg

label linux text
        kernel vmlinuz
        append text initrd=initrd.img method=ftp://192.168.77.79/centos7 ks=ftp://192.168.77.79/ks.cfg

label linux rescue
        kernel vmlinuz
        append rescue initrd=initrd.img method=ftp://192.168.77.79/centos7 ks=ftp://192.168.77.79/ks.cfg

The ks= paramter specifies the Kickstart configuration location, enabling fully automated deployments across multiple target systems.

Tags: PXE network-boot DHCP tftp kickstart

Posted on Sun, 01 Nov 2026 16:33:25 +0000 by billy2shoe