Configure PXE Boot Server for Rocky Linux 8 Kickstart Installation

Rocky Linux is now in GA.

Pre-requisites

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 8 FTP Installation Media

Download the DVD version of Rocky Linux 8 ISO image.

$ sudo yum install curl -y
$ curl -# -O https://download.rockylinux.org/pub/rocky/8/isos/x86_64/Rocky-8.4-x86_64-dvd1.iso

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

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

Verify:

$ curl ftp://10.11.1.20/pub/pxe/Rocky8/
dr-xr-xr-x    4 0        0              38 Jun 20 16:15 AppStream
dr-xr-xr-x    4 0        0              38 Jun 20 16:15 BaseOS
dr-xr-xr-x    3 0        0              18 Jun 20 16:15 EFI
-r--r--r--    1 0        0            2204 Jun 19 14:22 LICENSE
-r--r--r--    1 0        0             883 Jun 20 16:15 TRANS.TBL
dr-xr-xr-x    3 0        0              76 Jun 20 16:15 images
dr-xr-xr-x    2 0        0             256 Jun 20 16:15 isolinux
-r--r--r--    1 0        0              86 Jun 20 16:13 media.repo

Create Rocky Linux Kickstart File

This is the kickstart file /var/ftp/pub/pxe/rocky8-k8s-ks.cfg that I use for my Rocky Linux 8 Kubernetes servers (a 16GB disk required).

#version=RHEL8
# https://access.redhat.com/labs/kickstartconfig/
# System authorisation information
auth --useshadow --passalgo=sha512
# Use network installation
url --url="ftp://10.11.1.20/pub/pxe/Rocky8/BaseOS"
repo --name="AppStream" --baseurl=ftp://10.11.1.20/pub/pxe/Rocky8/AppStream

# Use graphical install
graphical
# Keyboard layouts
keyboard --vckeymap=gb --xlayouts='gb'
# System language
lang en_GB.UTF-8
# SELinux configuration
selinux --enforcing
# Firewall configuration
firewall --enabled --ssh
firstboot --disable

# Network information
network  --bootproto=dhcp --device=eth0 --nameserver=10.11.1.2,10.11.1.3 --noipv6 --activate
# Reboot after installation
reboot
ignoredisk --only-use=vda

# Root password
rootpw --iscrypted $6$7YZ0gnLkLPrl6rRO$NTjTQx1nesw5JLjtiAVdn3UBSbahUBGDFSiGGfrMNfGBum5aFs.TQcNX1SEuoWX/TmQ/ZMfiMnyHDs9uu9VH9.
# System timezone
timezone Europe/London --isUtc
# System bootloader configuration
bootloader --location=mbr --timeout=1 --boot-drive=vda
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel

# Disk partitioning information
#autopart --type=lvm
part /boot --fstype="xfs" --ondisk=vda --size=1024 --label=boot --asprimary
part pv.01 --fstype="lvmpv" --ondisk=vda --size=15359
volgroup vg_os pv.01
logvol /tmp  --fstype="xfs" --size=1024 --label="lv_tmp" --name=lv_tmp --vgname=vg_os
logvol /  --fstype="xfs" --size=14331 --label="lv_root" --name=lv_root --vgname=vg_os

%packages
@^minimal-environment

%end

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

%end

%anaconda
pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty
pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok
pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty
%end

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

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

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

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

label Install Rocky Linux 8 K8s Node
  kernel /networkboot/Rocky8/vmlinuz
  append initrd=/networkboot/Rocky8/initrd.img inst.repo=ftp://10.11.1.20/pub/pxe/Rocky8 inst.ks=ftp://10.11.1.20/pub/pxe/rocky8-k8s-ks.cfg

Perform a Network Boot

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

Leave a Reply

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