RHEL Kickstart

Red Hat Enterprise Linux (RHEL) Kickstart is a powerful automation tool used for unattended or automated Red Hat Linux installations. It allows system administrators to create a single file, known as a Kickstart file, which contains all the commands and settings required to install RHEL on a system. This includes settings for disk partitioning, network configuration, package installation, post-install scripts, and more.

By using a Kickstart file, you can ensure that RHEL installations are consistent across multiple machines and reduce the time and potential for errors compared to manual installations. The Kickstart file can be placed on a bootable media, such as a CD, DVD, or USB drive, or it can be made available on a network via NFS, FTP, or HTTP.

To create a Kickstart file, you can manually write the configuration or use the Anaconda installer's graphical interface to generate a template during a manual installation. This file can then be modified as needed for future automated deployments.

Kickstart is particularly useful in large environments where many servers need to be set up in a consistent manner, or in situations where rapid deployment and configuration of systems are required.

 
Sample Kickstart file:
# Sample Kickstart file for RHEL

# Use graphical install
graphical

# Use CDROM installation media
cdrom

# System language
lang en_US.UTF-8

# Keyboard layouts
keyboard us

# Network configuration with DHCP
network --bootproto=dhcp --device=eth0 --onboot=on

# System timezone
timezone America/New_York --isUtc

# Root password (use a strong password here; this is a placeholder)
rootpw --iscrypted $1$SomeSalt$3/Pe4kVGqiybHF4F/cqJU0

# Skip creating a user for now
skipx

# Reboot after installation
reboot

# Disk partitioning information
autopart --type=lvm

# Use text mode install
text

# System bootloader configuration
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"

# Clear the Master Boot Record
zerombr

# Partition clearing information
clearpart --all --initlabel

# Base system installation
%packages
@base
@core
%end

# Post-installation script
%post
echo "Kickstart installation completed" > /root/kickstart_complete.txt
%end
 

This file sets up a basic system with the following configuration:

  • Graphical installation method using CDROM as the installation source.
  • English (US) language and keyboard layout.
  • DHCP for network configuration on eth0.
  • System timezone set to America/New York.
  • Encrypted root password (you need to replace the placeholder with an actual encrypted password).
  • Partitioning is handled automatically using LVM.
  • Text mode is specified, although a graphical method is initially chosen.
  • Installation of the base and core package groups.
  • A simple post-installation script that creates a file indicating completion.

Please note:

  • The rootpw line should contain a securely encrypted password. You can generate one using tools like openssl.
  • The %packages section can be customized to include or exclude specific packages.
  • You may need to adjust network settings, disk partitioning, and other configurations according to your environment and requirements.
  • Always test your Kickstart file in a non-production environment to ensure it behaves as expected before using it in a production scenario.
You should also read: