Customizing the AlmaLinux Installer Media

By | 2022-Jan-06

This article shows you how to customize the AlmaLinux (or Red Hat Enterprise Linux, or Rocky Linux, or CentOS Linux) installer media to include a kickstart file and additional file assets. Commands prepended with # should be run as root while commands prepended with $ should be run as your regular user.

Prerequisites

  • A basic AlmaLinux workstation installation (temporary is fine).
  • The Alma Linux boot ISO in your user home directory.
  • A kickstart file in your user home directory (~/ks.cfg). Kickstart files are a complicated topic warranting their own article and are not detailed here.
  • An Assets subdirectory of your user home directory containing any additional files you want to be available during installation (wallpapers, configuration files, etc.)

Steps

Install required packages.

# dnf install createrepo genisoimage isomd5sum syslinux

Create a directory to mount the AlmaLinux ISO and a working directory.

# mkdir /mnt/almalinux
$ mkdir ~/almalinux-custom

Mount the ISO.

# mount -o loop ~/AlmaLinux-8.5-x86_64-boot.iso /mnt/almalinux

Copy the ISO contents to a working directory.

$ rsync -av --progress /mnt/almalinux/ ~/almalinux-custom/

Unmount the ISO.

# umount /mnt/almalinux

Copy the kickstart file.

$ cp ~/ks.cfg ~/almalinux-custom/

Copy the Assets directory to the root of the custom ISO and update the metadata.

$ cp -r ~/Assets ~/almalinux-custom/
$ createrepo -dpo ~/almalinux-custom ~/almalinux-custom/Assets/

Add kickstart to boot options to grub.cfg for UEFI boot and modify the boot order. Remove the strikethrough items and add the bold items.

$ nano ~/almalinux-custom/EFI/BOOT/grub.cfg
set default="1"
set default="0"

set timeout=60
set timeout=0

​​​​​​​menuentry 'Install AlmaLinux 8' --class fedora --class gnu-linux --class gnu --class os {
        linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=AlmaLinux-8-5-x86_64-dvd quiet inst.text inst.ks=cdrom:/ks.cfg inst.stage2=hd:LABEL=AlmaLinux-8-5-x86_64-custom
        initrdefi /images/pxeboot/initrd.img

Add kickstart options to isolinux.cfg for legacy BIOS boot and modify boot order. Remove the strikethrough items and add the bold items.

$ nano /mnt/almalinux-custom/isolinux/isolinux.cfg
​​​​​​​timeout 600
timeout 0

l​​​​​​​abel linux

  menu label ^Install AlmaLinux 8
  kernel vmlinuz
  append initrd=initrd.img inst.stage2=hd:LABEL=AlmaLinux-8-5-x86_64-dvd quiet inst.text inst.ks=cdrom:/ks.cfg inst.stage2=hd:LABEL=AlmaLinux-8-5-x86_64-custom

Create the custom ISO.

$ mkisofs -o /mnt/hgfs/data/AlmaLinux-8.5-x86_64-custom.iso -b isolinux/isolinux.bin -J -R -l -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -e images/efiboot.img -no-emul-boot -graft-points -V "AlmaLinux-8-5-x86_64-custom" /mnt/almalinux-custom/

Use isohybrid to enable writing to USB devices.

$ isohybrid --uefi ~/AlmaLinux-8.5-x86_64-custom.iso

Add the MD5 checksum.

$ implantisomd5 ~/AlmaLinux-8.5-x86_64-custom.iso

One thought on “Customizing the AlmaLinux Installer Media

  1. Pingback: Example AlmaLinux Kickstart – One Zero One

Comments are closed.