Automated bash script to build a customized AlmaLinux 9 ISO with unattended installation via Kickstart configuration.
✅ Automated Download – Fetches latest AlmaLinux 9 ISO from official mirrors
✅ Customizable Installation – Integrate your Kickstart configuration
✅ Dual Boot Support – BIOS (Legacy) and UEFI boot options included
✅ Colored Output – Clear, scannable progress with color-coded logging
✅ Error Handling – Comprehensive validation and automatic cleanup on failure
✅ Dependency Checking – Verifies all required tools before execution
✅ Sudo Management – Pre-flight sudo access validation
- OS: Linux (tested on AlmaLinux, RHEL, Fedora, Ubuntu)
- Storage: ~15 GB free space (ISO + working directory)
- User: Sudo access (required for mount/unmount operations)
wget # For downloading the ISO
rsync # For efficient directory copying
xorriso # For ISO image generation
sudo # For privileged operationsAlmaLinux / RHEL / Fedora:
sudo dnf install -y wget rsync xorrisoUbuntu / Debian:
sudo apt-get install -y wget rsync xorriso- Clone the repository (or download the script):
git clone https://github.com/GenXStreamer/AlmaLinuxKickstartBuilder.git
cd AlmaLinuxKickstartBuilder- Make the script executable:
chmod +x build.sh- Create your Kickstart configuration: There is a ks-example.cfg to get you going
./build.shThe script will:
- ✓ Check for all dependencies
- ✓ Validate Kickstart file (
ks.cfg) - ✓ Download AlmaLinux 9 ISO if not present
- ✓ Mount the ISO and copy contents
- ✓ Add your Kickstart configuration
- ✓ Update GRUB bootloader with kickstart entry
- ✓ Generate a new ISO with both BIOS and UEFI boot support
- ✓ Output:
AlmaLinux-9-latest-kickstart.iso
╔═══════════════════════════════════════════════════════════╗
║ ║
║ AlmaLinux 9 Kickstart ISO Builder ║
║ ║
╚═══════════════════════════════════════════════════════════╝
[ℹ] Checking sudo access...
[✓] sudo access confirmed (no password required)
[ℹ] Checking required files...
[✓] Kickstart file found: ks.cfg
[✓] ISO file found: AlmaLinux-9-latest-x86_64-dvd.iso
... (build process) ...
[✓] Kickstart ISO created successfully!
Output: /home/user/AlmaKickstart/tmp/../AlmaLinux-9-latest-kickstart.iso
Size: 5.2G
Bootable: Yes (BIOS + UEFI)
[✓] All done!
Edit these in build.sh to customize:
BASE_URL="https://mirrors.ukfast.co.uk/sites/almalinux.org/9/isos/x86_64/"
ISO="AlmaLinux-9-latest-x86_64-dvd.iso"
KS="ks.cfg"
WORKDIR="${HOME}/AlmaKickstart/tmp"
MOUNTDIR="${HOME}/AlmaKickstart/mount"
OUTPUT="AlmaLinux-9-latest-kickstart.iso"The ks.cfg file controls the unattended installation. Example configurations:
Minimal Server (no GUI):
text
network --bootproto=dhcp --activate
rootpw --plaintext password123
firewall --disabled
selinux --disabled
timezone UTC
bootloader --location=mbr
zerombr
clearpart --all --initlabel
autopart --type=lvm
%packages
@core
openssh-server
%endFull Production Setup:
text
network --bootproto=static --ip=192.168.1.10 --netmask=255.255.255.0 --gateway=192.168.1.1 --nameserver=8.8.8.8 --activate
rootpw --plaintext rootpass123
user --name=deploy --password=deploypass --uid=1001 --groups=wheel
firewall --service=ssh
selinux --disabled
timezone UTC --utc
bootloader --location=mbr --append="rhgb quiet"
zerombr
clearpart --all --initlabel
part /boot --fstype=xfs --size=500
part / --fstype=xfs --size=10000 --grow
%packages
@core
@development
openssh-server
curl
wget
git
vim
%end
%post
echo "Post-installation tasks..."
%endFor comprehensive Kickstart documentation, see Red Hat Kickstart Documentation.
- ISO Download – Fetches the latest AlmaLinux 9 ISO from official mirrors
- Mount & Copy – Mounts ISO in loop mode and copies all contents to working directory
- Configuration – Embeds your
ks.cfgKickstart file into the ISO - Boot Entry – Adds a GRUB menu entry that automatically uses the Kickstart config
- ISO Generation – Uses
xorrisoto rebuild the ISO with both BIOS and UEFI support - Cleanup – Removes temporary working directories
# Linux/Mac
sudo dd if=AlmaLinux-9-latest-kickstart.iso of=/dev/sdX bs=4M status=progress
sudo sync
# Or use Etcher: https://www.balena.io/etcher/Simply attach the ISO as a boot device. The system will boot into the Kickstart installation menu with your custom entry available.
Upload the ISO through your server's remote management interface.
[✗] Failed to mount ISO
Solution: Ensure loop module is loaded:
sudo modprobe loop[✗] xorriso not found - please install it
Solution: Install xorriso package (see Prerequisites)
[✗] sudo access required but not available
Solution: Configure passwordless sudo or run script as root:
sudo ./build.shSolution: Ensure 15+ GB free space in your working directory:
df -h ${HOME}/AlmaKickstart/If the kickstart boot entry doesn't appear:
- Check
WORKDIR/EFI/BOOT/grub.cfgexists - Verify kickstart syntax:
ksvalidator ks.cfg - Manually edit the backup:
GRUBCFG.orig
.
├── build.sh # Main build script
├── ks.cfg # Your Kickstart configuration
├── README.md # This file
└── LICENSE # MIT License
Change the BASE_URL to use a different mirror:
BASE_URL="https://mirrors.almalinux.org/almalinux/9/isos/x86_64/"Comment out the cleanup line to inspect intermediate files:
# sudo rm -rf "$WORKDIR" "$MOUNTDIR"Before building, validate your configuration:
ksvalidator ks.cfgIf you only need to modify the Kickstart file:
# Edit ks.cfg
cp ks.cfg "$WORKDIR/ks.cfg"
cd "$WORKDIR"
# Rebuild ISO with xorriso command from build.sh- Download: 5–15 minutes (varies by bandwidth)
- ISO Build: 5–10 minutes (depends on disk speed)
- Total Time: 10–25 minutes first run
Using an SSD and a good internet connection significantly speeds up the process.
- UEFI Only Systems: Script includes BIOS + UEFI boot; works on both
- RHEL 8/9 Compatible: Modifications needed for other major versions
- Sudo Required: Some operations require elevated privileges
- Linux Only: Designed for Linux hosts (not macOS/Windows directly)
Found a bug or have a feature request? Please open an issue or submit a pull request!
MIT License – see LICENSE file for details.
Created for automated AlmaLinux deployments on infrastructure requiring unattended installation.
Questions? Open an issue on GitHub or check the Troubleshooting section above.