Table of Contents
Red Hat Kickstart
Summary: How to work with Red Hat kickstart, the installation service for Red Hat.
Date: Around 2014
Refactor: 29 March 2025: Checked links and formatting.
Red Hat Kickstart is a method for a system administrator to create an answer file to answer the question usually asked during an installation. It is similar to jumpstart from Solaris or the unattend file for Windows installations. This page is about creating a kickstart file, modifying it to your needs and finally using it during an installation with a DVD.
Building a Kickstart File
The easiest way to create a kickstart file is using the graphical tool “system-config-kickstart”. It provides an easy way to setup the configurations but also has a few downsides. For example, you can't use it to setup LVM volumes. To start it simply type “system-config-kickstart” from the commandline. If you get an error stating that the command cannot be found it's probably not installed. Install it using the command “yum install system-config-kickstart”.
Overview command:
yum install system-config-kickstart system-config-kickstart
This will start this graphical tool:
You need to set a few things to get a working system:
- Set the root password and encrypt it
- Clear the MBR and initialize the disk
- Partitioning:
- /boot with filesystem ext4 of about 250 MB
- swap of about 512 MB
- / with filesystem ext4 and either set a size or decide to decide to allocate all remaining disk space to this filesystem
- Set the networkdevice eth0 to DHCP
- Install at least the Base package set
Here a screenshot of the partitioning configuration and the package selection:
Then save the kickstart file, which will give an example like this:
[root@localhost ~]# cat shifting.cfg #platform=x86, AMD64, or Intel EM64T #version=DEVEL # Firewall configuration firewall --disabled # Install OS instead of upgrade install # Use CDROM installation media cdrom # Root password rootpw --iscrypted $1$c29CNyiX$jWnvp1/pv0RvJsTJhnt5c/ # System authorization information auth --useshadow --passalgo=sha512 # Use graphical install graphical firstboot --disable # System keyboard keyboard us # System language lang en_US # SELinux configuration selinux --enforcing # Installation logging level logging --level=info # Reboot after installation reboot # System timezone timezone Europe/Amsterdam # Network information network --bootproto=dhcp --device=eth0 --onboot=on # System bootloader configuration bootloader --location=mbr # Clear the Master Boot Record zerombr # Partition clearing information clearpart --all --initlabel # Disk partitioning information part /boot --fstype="ext4" --size=250 part swap --fstype="swap" --size=512 part / --fstype="ext4" --grow --size=1 %packages @base %end
This is a very basic installation but will work. You can modify it using a text editor.
Note that the tool will automatically by default enable selinux but disable the firewall. Disabling the firewall is not possible during the manual installation but is with kickstart.
Edit Kickstart File
We just created a kickstart file with some very basic options. Of course it's possible to load the config file again and make some additional changes but sometimes it's just easier and faster to use a text editor.
These are some options you could do:
- Add a package group to the installation files
- Add a single package to the installation
- Add an installation line to some file
So if I would like to install the Development Tools package group, the gimp package and the time and date to the issue file I would ad these lines to kickstart file:
@Development Tools gimp %post date > /root/install-date %end
Note that adding the installation lines happens inside the %post part of the file. This is a new part since I did not add a post part using the system-config-kickstart utility.
This would now lead to the following file:
[root@localhost ~]# vim shifting.cfg [root@localhost ~]# cat shifting.cfg #platform=x86, AMD64, or Intel EM64T #version=DEVEL # Firewall configuration firewall --disabled # Install OS instead of upgrade install # Use CDROM installation media cdrom # Root password rootpw --iscrypted $1$c29CNyiX$jWnvp1/pv0RvJsTJhnt5c/ # System authorization information auth --useshadow --passalgo=sha512 # Use graphical install graphical firstboot --disable # System keyboard keyboard us # System language lang en_US # SELinux configuration selinux --enforcing # Installation logging level logging --level=info # Reboot after installation reboot # System timezone timezone Europe/Amsterdam # Network information network --bootproto=dhcp --device=eth0 --onboot=on # System bootloader configuration bootloader --location=mbr # Clear the Master Boot Record zerombr # Partition clearing information clearpart --all --initlabel # Disk partitioning information part /boot --fstype="ext4" --size=250 part swap --fstype="swap" --size=512 part / --fstype="ext4" --grow --size=1 %packages @base @Development Tools gimp %end %post date > /root/install-date %end
Syntax Checking
Note that when you edit the file using vim you get a little color coding which makes the file more readable and will show you syntax errors:
If you want something a little bit more professional you van have ksvalidator check the file:
[root@localhost ~]# ksvalidator shifting.cfg
If a syntax error was made ksvalidator will show you an error. It does not check the commands for example inside the post section. Only the syntax.
Make Kickstart File Available to Installer
There are several ways to provide the file to the installer. I will use the http method. For this I need a webserver, see here on how to deploy a webserver on Red Hat.
After installing the webserver, copy the kickstart file to the /var/www/html/
directory and make sure it's readable by the apache webserver.
Start the Installation With a Kickstart File
Start your system using the install ISO with Red Hat Enterprise Server. In this cased I used this media:
- rhel-server-6.5-x86_64-dvd.iso
When the server is booting and with the option “Install or Upgrade an existing system” highlighted, press tab. Now the following line appears:
vmlinuz initrd=initrd.img
Now add the location from the kickstart file:
vmlinuz initrd=initrd.img ks=http://192.168.25.128/shifting.cfg
The IP address shown is the IP address of my webserver which is hosting the kickstart file: