Linux Kickstart and PXE Network Installation: RHCA Guide

Kickstart and PXE allow you to automate Linux installations — deploy dozens of identical servers without manual intervention. Essential for large-scale data center operations and RHCA.

What Is Kickstart?

Kickstart is a method for automating Linux installation. A kickstart file contains all installation answers — disk partitioning, packages, network, users — so the install runs unattended.

What Is PXE?

PXE (Preboot eXecution Environment) allows servers to boot from the network instead of a local disk. Combined with Kickstart, you can install Linux on bare-metal servers remotely.

Kickstart File Structure

# /root/anaconda-ks.cfg — auto-generated after every install
# Copy and modify it as your template

# Example kickstart file:
# vim /var/www/html/ks.cfg

#version=RHEL7
install
url --url="http://172.25.9.11/rhel7/"      # install source

lang en_US.UTF-8
keyboard us
timezone Asia/Kolkata --isUtc

network --bootproto=dhcp --device=eth0 --onboot=yes

rootpw --plaintext redhat                   # root password
auth --enableshadow --passalgo=sha512

selinux --disabled
firewall --disabled

bootloader --location=mbr --boot-drive=sda
clearpart --all --initlabel --drives=sda
part /boot --fstype="xfs" --size=500
part swap  --size=2048
part /     --fstype="xfs" --grow

%packages
@base
@core
vim
wget
%end

%post
echo "Installation complete" > /root/install.log
%end

Configure PXE Boot Server

# Packages needed:
# yum install tftp-server syslinux dhcp vsftpd -y

# Or with HTTP (recommended):
# yum install tftp-server syslinux httpd dhcp -y

# Step 1 — Set up TFTP:
# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
# cp /usr/share/syslinux/menu.c32 /var/lib/tftpboot/
# mkdir /var/lib/tftpboot/pxelinux.cfg

# Copy kernel and initrd from RHEL ISO:
# mount /iso/rhel7.iso /mnt/cdrom
# cp /mnt/cdrom/images/pxeboot/vmlinuz /var/lib/tftpboot/
# cp /mnt/cdrom/images/pxeboot/initrd.img /var/lib/tftpboot/

# Step 2 — Create PXE default config:
# vim /var/lib/tftpboot/pxelinux.cfg/default
default menu.c32
prompt 0
timeout 30

label RHEL7
  menu label Install RHEL 7
  kernel vmlinuz
  append initrd=initrd.img ks=http://172.25.9.11/ks.cfg

# Step 3 — Serve kickstart file via HTTP:
# mkdir /var/www/html/rhel7
# cp -av /mnt/cdrom/* /var/www/html/rhel7/
# cp /root/ks.cfg /var/www/html/
# systemctl start httpd; systemctl enable httpd

# Step 4 — Configure DHCP for PXE:
# vim /etc/dhcp/dhcpd.conf
subnet 172.25.9.0 netmask 255.255.255.0 {
    range 172.25.9.200 172.25.9.250;
    option routers 172.25.9.1;
    next-server 172.25.9.11;                # PXE server IP
    filename "pxelinux.0";                  # PXE boot file
}

# Step 5 — Start all services:
# systemctl start tftp dhcpd httpd
# firewall-cmd --permanent --add-service=tftp
# firewall-cmd --permanent --add-service=dhcp
# firewall-cmd --permanent --add-service=http
# firewall-cmd --reload

Client Boot Process

  1. Client powers on → BIOS selects network boot
  2. Client broadcasts DHCP request → gets IP + PXE server address
  3. Client downloads pxelinux.0 from TFTP server
  4. Boot menu appears → user selects RHEL install
  5. Kernel and initrd download over network
  6. Installer fetches kickstart file and runs unattended

Validate Kickstart File

# yum install pykickstart -y
# ksvalidator /root/ks.cfg           # check syntax