Install image mode for Red Hat Enterprise Linux using kickstart

This learning exercise covers configuring a kickstart config file, hosting it on a server, and bootstrapping systems with the specified configurations. Additionally, it outlines procedures for managing and applying system updates, either automatically or on-demand. Read more about kickstart installation here.

Download image mode for RHEL image

Prerequisites:

  • Download Installation Media: Locate and download the 9.4  Boot ISO compatible with your system architecture from the Red Hat developer site.
  • Create Kickstart Configuration File: Develop your Kickstart configuration. Below is a sample file that you can modify to suit your needs.


Step-by-step guide:

Kickstart configuration example

In the following Kickstart file, update the boot container image URL as per your requirement. Additionally, for the "root" user, replace "<your-key-here>" with your actual key.

# enable text mode
text
# network configuration
network --bootproto=dhcp --device=link --activate
# Partioning Setup
clearpart --all --initlabel --disklabel=gpt
reqpart --add-boot
part / --grow --fstype xfs
# --- Container Image Installation --
ostreecontainer --url quay.io/[your_account]/[your_image]:[your_tag]
# --- Basic Security ---
firewall --disabled # Disable the firewall (consider hardening this later)
services --enabled=sshd # Enable SSH service for remote access
# --- Root User SSH Key (If Desired)---
rootpw --iscrypted locked #Disable direct root password login
# Add SSH key for root (replace with your key)
sshkey --username root "<your-key-here>" 
# --- System Reboot ---
reboot

Hosting the kickstart file

Upload the kickstart configuration file to a web server that is accessible from the virtual machine.

Alternative hosting options

  • Local HTTP Server: If a web server is unavailable, execute the following command in the directory containing your Kickstart file to host it using Python's HTTP server module:
python -m http.server
  • Embedded kickstart File: Alternatively, embed the Kickstart file directly into an installer ISO using the mkksiso utility from the lorax package. This method is ideal for USB installations:
mkksiso --ks /PATH/TO/KICKSTART /PATH/TO/ISO /PATH/TO/NEW-ISO

Deployment

  1. Boot the target system: Boot the target system using the installation media.
  2. Append kernel arguments: During boot, append the following to the kernel arguments (consult system documentation for specific instructions) to direct the installer to your Kickstart file: 

    inst.ks=http://path_to_my_kickstart
  3. If you are using Red Hat Enterprise Linux or Fedora with GNOME Boxes to run your virtual machines, execute the following command to initiate deployment:

    vmlinuz initrd=initrd.img inst.ks=http://<your-ip>/kickstart.kickstart.cfg

    For more information, please refer to the following Figure 1.

Interrupting the boot process to define the URL of the kickstart file.
Figure 1: Defining the kickstart.cfg file URL in GRUB.
  1. Initiate boot process: Press Ctrl+X or follow the on-screen prompt to initiate the boot process using these settings.

Post-Installation Updates

Following installation, monitor and manage updates by observing the system service:

systemctl status bootc-fetch-apply-updates.timer

Alternatively, apply updates immediately with:

bootc upgrade

Refer to the provided URL for details on enabling automatic updates and further configuration options.

Summary

This hands-on learning exercise provides developers with a step-by-step process for deploying image mode for Red Hat Enterprise Linux via Kickstart, which is ideal for bare-metal installations using ISO, PXE, or USB drives.

It covers crafting a Kickstart config file, hosting it on a server, and bootstrapping systems with the specified configurations. Additionally, it outlines procedures for managing and applying system updates, either automatically or on-demand. Read more about kickstart installation here.

Previous resource
Overview: Install image mode for Red Hat Enterprise Linux using kickstart