Configure PXE Boot Server for Rocky Linux 9 Kickstart Installation

Preparing to migrate homelab infrastructure from Rocky 8 to Rocky 9.


We are using our existing PXE boot homelab server in this article.

All commands to be run on the PXE boot server.

Download and Create Rocky Linux 9 FTP Installation Media

Download the DVD version of Rocky Linux 9 ISO image.

$ sudo yum install curl -y
$ curl -# -O

Mount the image and copy its content to the FTP location:

$ sudo mkdir -p /mnt/iso /var/ftp/pub/pxe/Rocky9
$ sudo mount Rocky-9.2-x86_64-dvd.iso /mnt/iso
$ sudo cp -prv /mnt/iso/* /var/ftp/pub/pxe/Rocky9/
$ sudo umount /mnt/iso


$ curl
drwxr-xr-x    4 0        0              38 May 14 19:16 AppStream
drwxrwxr-x    4 0        0              38 May 14 19:42 BaseOS
-rw-r--r--    1 0        0            5504 Jun 21 08:59 COMMUNITY-CHARTER
-rw-r--r--    1 0        0            1394 Jun 21 08:59 Contributors
drwxrwxr-x    3 0        0              18 May 12 00:24 EFI
-rw-r--r--    1 0        0             372 Jun 21 08:59 EULA
-rw-r--r--    1 0        0            2204 Jun 21 08:59 LICENSE
-rw-r--r--    1 0        0            1750 Jun 21 08:59 RPM-GPG-KEY-Rocky-9
-rw-r--r--    1 0        0            3159 Jun 21 08:59 RPM-GPG-KEY-Rocky-9-Testing
drwxrwxr-x    3 0        0              59 May 12 00:24 images
drwxrwxr-x    2 0        0             239 May 12 00:24 isolinux
-rw-r--r--    1 0        0             102 Jun 21 09:00 media.repo

Create Rocky Linux Kickstart File

This is the Packer kickstart file /var/ftp/pub/pxe/rocky9-packer-ks.cfg that I use for my Rocky Linux 9 Kubernetes servers (a 32GB disk required).

# This file was generated using the Kickstart Generator page, see below:

# Use network installation
url --url=""
repo --name="AppStream" --baseurl=""
# Disable Initial Setup on first boot
firstboot --disable

# Use text mode install
# Keyboard layouts
keyboard --vckeymap=gb --xlayouts='gb'
# System language
lang en_GB.UTF-8
# SELinux configuration
selinux --enforcing
# Firewall configuration
firewall --enabled --ssh
# Do not configure the X Window System

# Network information
network --bootproto=dhcp --device=eth0 --nameserver=, --noipv6 --activate
network --hostname=rocky9.localdomain

# System authorisation information
auth --useshadow --passalgo=sha512
# Root password
rootpw packer
# Root SSH public key
sshkey --username=root "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCzcZWKJVeDTioSe5x1M7WdNGgX4HQsZQeP92zK2LlP7vymnzts/IZz4I5r6Z0WwSMh9VxN9IABxsotdohiC9kroEdqUG9/OmljQhHNXnMOlAhnofJAnnEb7Tr1v1xGJllpQ135PNL+ECTIslQMBD68a2WZGLvJBPg/WSEsaD6oWwVnrldXIolvDaAKx3TnipwoEp/jcZ1KXTA6LuqdpG1XDI35pT8QF9bO79nv05nf9ypynJxMZZ66HcwiKnoNbyY/Xa2b1Yyv5WA+2kY821bKMaYiKRuwABZI/1M5kLLki6RZ9rvUG8FfiJVhhAJXOIguT1reBdQsBfxqLirotf2t8kOzGbKwwXIPqePtTlCFe0GKT5H6qe1x1kXBPF4+m2r2JPllhwcnNtPl5MVn9X/HQSDRgYtTPlXREuyLLWD1n4vpcka6YMrCulE9KJmnN1J++rRGLgeU47/lgFwKOfF0yugMyfTTrbYUffzBDBsV8mSelra/sm4ZwrkjOzNiSStUAHZ6WL4t2vNs94B61eVKHMFKFSbFKeQ79qEisJkQp4pOUJDmNohMZKquNThrwX5qhVsNFJ28mZfYvJrxn+ha2M3by9+WealubGy14FFGz5Ir7UWmL8IsB5Bq+USwiVxOy+TBecMUNyuy5H0ttX7gbkvo3mRF9h4apfcFlxtZlQ== [email protected]"
# System timezone
timezone Europe/London --utc

ignoredisk --only-use=vda
# System bootloader configuration
bootloader --location=mbr --timeout=1 --boot-drive=vda
# Clear the Master Boot Record
# Partition clearing information
clearpart --all --initlabel
# Reboot after installation

# Disk partitioning information
#autopart --type=lvm
part /boot --fstype="xfs" --ondisk=vda --size=1024 --label=boot --asprimary --fsoptions="rw,nodev,noexec,nosuid"
part pv.01 --fstype="lvmpv" --ondisk=vda --size=31743
volgroup vg_os pv.01
logvol /tmp  --fstype="xfs" --size=1024 --label="lv_tmp" --name=lv_tmp --vgname=vg_os --fsoptions="rw,nodev,noexec,nosuid"
logvol /  --fstype="xfs" --size=30716 --label="lv_root" --name=lv_root --vgname=vg_os

# dnf group info minimal-environment
# Alsa not needed in a VM
# Microcode updates cannot work in a VM
# Firmware packages are not needed in a VM
# Don't build rescue initramfs

%addon com_redhat_kdump --disable --reserve-mb='auto'

sed -i 's/^.*requiretty/#Defaults requiretty/' /etc/sudoers
sed -i 's/rhgb //' /etc/default/grub
# SSHD PermitRootLogin and enable the service
sed -i "s/#PermitRootLogin prohibit-password/PermitRootLogin yes/g" /etc/ssh/sshd_config
/usr/bin/systemctl enable sshd
# Update all packages
/usr/bin/yum -y update

Copy the content and save it as /var/ftp/pub/pxe/rocky9-packer-ks.cfg on the PXE boot server.

Copy initrd.img and vmlinuz from the Rocky Linux 9 installation media to /var/lib/tftpboot/networkboot/Rocky9/:

$ sudo mkdir -p /var/lib/tftpboot/networkboot/Rocky9
$ sudo cp -pv /var/ftp/pub/pxe/Rocky9/images/pxeboot/{initrd.img,vmlinuz} /var/lib/tftpboot/networkboot/Rocky9/

Update the PXE boot configuration file /var/lib/tftpboot/pxelinux.cfg/default with the following content:

label Install Rocky Linux 9 Server (Packer kickstart, no swap)
  kernel /networkboot/Rocky9/vmlinuz
  append initrd=/networkboot/Rocky9/initrd.img inst.repo= inst.ks=

Perform a Network Boot

Create a VM that uses Network Boot (PXE), start it and check the automated process.

2 thoughts on “Configure PXE Boot Server for Rocky Linux 9 Kickstart Installation

  1. hi,

    Little typo in the below section – line 1 you have /Rocky8, line 4 /Rocky9.

    Mount the image and copy its content to the FTP location:

    $ sudo mkdir -p /mnt/iso /var/ftp/pub/pxe/Rocky8
    $ sudo mount Rocky-9.2-x86_64-dvd.iso /mnt/iso
    $ sudo cp -prv /mnt/iso/* /var/ftp/pub/pxe/Rocky9/
    $ sudo umount /mnt/iso

Leave a Reply

Your email address will not be published. Required fields are marked *