CentOS

A Beginner’s Guide to Kickstart

When there are only one or two hosts to install, setting up Red Hat-based systems from virtual or physical media is simple. Furthermore, when a system administrator is required to set up numerous Linux computers, Kickstart can give a comparatively simple and fully automated approach. It is simple to set up countless alternative Kickstart settings, each with its configuration of deployment.

The topmost enterprises utilize Kickstart to deploy Red Hat server images that can then be tweaked as needed. For Kickstart, an administrator needs to set it up as a web server, at least one Kickstart configuration file, and an installation media. An active DHCP server is also required so that after obtaining a valid DHCP address, new clients can find their Kickstart server and get Kickstarted. Moreover, Kickstart utilizes different installation channels such as local media and NFS, etc.

In this guide, we will cover these 14 points related to Kickstart:

  1. What Is Kickstart?
  2. The Primary Purpose of the Kickstart File
  3. What Are Kickstart Installations?
  4. Kickstart Installation Workflow
  5. Creating a Kickstart file
  6. Checking the Integrity of a Kickstart File
  7. Kickstart File Changes
  8. Generating a Kickstart File
  9. Kickstart File Availability
  10. Installation Source Availability
  11. Start the Kickstart Installation
  12. Maintenance of a Kickstart File
  13. Kickstart Maintenance Tools Installation
  14. Kickstart User Guide

So let’s get this journey started!

What Is Kickstart?

Kickstart is responsible for installing an entire operating system from a specified list known as the Kickstart file. Your choices for installation are automatically stored in a Kickstart file named “anaconda-ks.cfg“. Whenever you install an operating system on Fedora, CentOS, RHEL, or another Red Hat-based Linux distribution, “/root/anaconda-ks.cfg” is the location of this Kickstart file in the root user’s home directory.

After an installation has been completed using Kickstart, check out the Kickstart file, and you will notice that it has all entries you made during the installation. Keyboard and timezone locale settings, disc partitioning information, networking information, package options, Installation type, and so forth are all examples of these entries.

The Primary Purpose of the Kickstart File:

The primary purpose of the Kickstart file is to enable the system administrator to do all installations related to the Linux network. Another benefit of the Kickstart file is developing servers based on a tried and tested design. This feature is very useful if you frequently need to create many servers with the same operating system. This file also permits the user to specify instructions to be executed even after the installation, such as account creation. The most common way to using a Kickstart file is to place it in some exported NFS directory. After that, make it available over a web server, but other possibilities exist as well.

What Are Kickstart Installations?

Now, let’s understand the core concept of Kickstart installation. These files give you permission for the entire or partial automation of the installation procedure. It includes answers to all of the queries that any installation application often asks, such as how the drives should be partitioned, what time zone the system should use, and which software should be installed. As a result, offering a prepared Kickstart file as the installation starts permits you to complete the installation automatically, without the need for any user participation. These installations are highly beneficial when you want to install CentOS on numerous machines simultaneously.

Kickstart files are accessible by other individual computers and are placed on a single server system in the installation process. When using a single Kickstart file, this type of installation allows users to install CentOS on multiple machines. Thus, making it useful for system and network administrators.

All Kickstart execution log files and scripts are saved in the “/temp” directory in order to play a role in debugging installation difficulties.

Kickstart Installation Workflow:

A local hard disc, local DVD or an HTTP, HTTPS, FTP, or NFS server can all be used to Kickstart an installation. Now, we will give you a high-level overview of how to use Kickstart:

  • The first thing you have to do is to create a Kickstart file. You can make this file by yourself or use a created file resulted from a manual installation. The Kickstart file generators are also utilized for this purpose.
  • Utilize an NFS, HTTP, or even an FTP server to permit the Kickstart file, which will be available to the installation process on a network location, hard disc, or removable media.
  • Make a bootable medium that is going to be utilized to start the installation.
  • Permit the installation process to access the source of installation.
  • By using the Kickstart file and removable media, start your installation procedure.
  • The installation will complete automatically if the Kickstart file comprises all necessary sections and commands. If an error occurs or any of these required sections are missing, the installation must be completed manually.

Creating a Kickstart File

The “anaconda installer” automatically creates a Kickstart file when an RHEL installation is completed. This Kickstart file will be saved in the user home directory named “/root/anaconda-ks.cfg“.

A Kickstart file can be created by using any of these three methods:

Method 1: Start From the Beginning

Until this moment, we can define the Kickstart file as a simple text file with a lot of self-explanatory information. You can choose from extensive Kickstart selection options. Some of the options are obligatory. Using an existing Kickstart file as a template is the simplest way to generate a Kickstart file.

Method 2: Perform a Standard RHEL/CentOS Installation

It is possible that you created a Kickstart file without knowing at the time when you installed CentOS. It was automatically based on the answers you provided during the installation. The Kickstart file should be found in the root directory named “anaconda-ks.cfg“. This file can be utilized as a template if you want to create your Kickstart files.

Method 3: Using the Kickstart Graphical User Interface (GUI) Tool

System-config-Kickstart is a helpful program that allows you to generate your Kickstart files by utilizing the simple GUI. For that, you have to install the Kickstart Generator tool first.

Checking the Integrity of a Kickstart file:

To ensure that your Kickstart file is valid, use the command-line tool known as “ksvalidator“. This tool is convenient when you need to make a lot of modifications to a Kickstart file.

ksvalidator /path/to/Kickstart.ks

Kickstart File Changes:

With the underlying principles of Kickstart installs, it manages to remain consistent. Still, the settings and commands can vary between RHEL significant releases. The “ksverdiff” command is utilized to show the variation between two Kickstart syntax versions. This command becomes helpful when you want to update an already existing kickstart file to a new one. You can write out the following command to see the syntax changes between RHEL 7 and RHEL 8.

In this command, the -f option indicates the release with which to begin the comparison. Then, the -t option specifies the release with which to conclude it.

$ ksverdiff -f RHEL7 -t RHEL8

Generating a Kickstart File:

The Kickstart file is utilized for automating the installation process of the RHEL operating system.

It offers all of the information related to the installation through the Kickstart configuration file. This helps the installer speed up the installation while also proving a non-interactive capability for large-scale deployment.

Example:

Here, we are showing you the main syntax of a Kickstart file:

rootpw --plaintext YOURPASSWORD
URL --url="ftp://PATH_TO_PACKAGE_SERVER"
text
%packages
@core
%end
timezone YOUR TIMEZONE
clearpart --all
part / --fstype="xfs" --grow

The Kickstart file which is given above will run a text-based simple RHEL installation utilizing a Red Hat anaconda installer. Now, let us understand the functionality of these options one by one:

  • URL –url=”ftp:/PATH_TO _PACKAGE _SERVER”: This option will assign the source of the installation file, which can be a network path or a directory.
  • @core: You can utilize this option for installing the group of the core package. Single, multiple packages or groups can be defined with this option. You have to add one package or group per line.
  • % timezone “your timezone”: Here, you can declare your time zone as a value for this option.
  • part /–fstype=”xfs”–grow: In the Kickstart file, utilize this option to create a partition and then expand it to the maximum size before mounting it under /.
  • rootpw –plaintext YOURPASSWORD: This option will let you set your root password, which will be “YOURPASSWORD” in our case.
  • % packages: With this option, you can start the packages list
  • % end: End your packages list with “%end” option.
  • clearpart –all: Use this option to clear all existing partitions and preparing the disk.
  • text: You can also use the Anaconda installer for proceeding with a text-based installation.

In addition to the previously mentioned settings, the following list will offer you some other options that you can use in the Kickstart file to fine-tune your RHEL installation:

  • lang en_AU: You can then set the value of the language parameter to “en AU”.
  • firewall –disabled: Use this option to turn off the firewall settings.
  • network –bootproto=dhcp –device=eth0: You can assign the network interface to eth0 and configure it to get network settings over DHCP.
  • bootloader –location=mbr: Utilize this option to set your location of boot loader installation to master boot record.
  • keyboard ‘us’: You can add the information about the keyboard.
  • SELinux –disabled: Use this option to disable SELinux.
  • reboot: This option will allow you to reboot the newly installed system after the installation is completed.

Utilizing an Already Created Kickstart File:

Another option for creating a new Kickstart file customized to your needs is to execute a fresh RHEL installation. Once the installation is complete, the installer will record all of your choices and build a Kickstart file located in the root’s home directory ( /root/anaconda-ks.cfg ).

Kickstart File Generator:

A system administrator can utilize Kickstart to build a single Kickstart file that contains all of your choices during an RHEL installation procedure. As the Kickstart file is created, it can be included via network or boot media for quick and consistent system configuration.

The Kickstart file generator tool guides you through the procedure of developing RHEL 5, 6, 7, or RHEL 8 Kickstart files that are suitable according to your individual deployment needs. With this program, you may construct extensive Kickstart files with unique package selections, file system layouts, network setups, and installation scripts. A new security option is also available that now permits you to deploy systems with a well-managed security system. Another thing about this application is that this application will select sensible defaults for less sophisticated customization.

Once you’ve finished configuring your system, click the “Download” button to get the Kickstart file, which you can then be bind over the network or with installation media.

Kickstart File Availability:

You should save the Kickstart file to one of the following locations:

  • On any hard drive that is linked to the installation system
  • On any removable medium such as a DVD, or a USB flash drive
  • On a network share that is accessible for the installation system

A Kickstart file is typically copied to a hard disc or portable media or shared over a network. First of all, utilize a PXE server using the Kickstart installs to boot the system. This method is a network-based technique. Then, download the software packages from the remote repositories and the Kickstart file from the particular network location. You have to make the installation source accessible for the installation process. However, rather than the installation tree or ISO image, the Kickstart file is used.

Installation Source Availability:

The Kickstart installation must have access to any installation source to install the packages that your system requires. Either use the installation tree or the RHEL installation DVD ISO image as the source. A duplicate of the binary RHEL DVD with the same directory structure is called an installation tree.

  • If you are installing via the network (HTTP, FTP, or NFS), you’ll need to make the binary DVD ISO image or the installation tree available which depends on the protocol that has been utilized.
  • If you are installing hard drives by utilizing either a flash drive or the hard drive itself, you have to ensure that the binary RHEL DVD ISO images exist on the hard drive in the system.
  • ● Before proceeding with the Kickstart installation, you have to insert the RHEL installation DVD into your system. That’s how you perform a DVD-based installation.

Start the Kickstart Installations:

Kickstart installations can be initiated using one of these three methods given below:

Method 1: Using PXE

These servers can boot 64-bit ARM systems, IBM Power Systems servers, Intel 64, and AMD64 systems. The PXE server permits you to start the installation automatically when you specify the boot option in the boot loader’s configuration file. If you use this method, there is also a possibility to automate the installation, including the boot procedure.

This procedure is a general guide. Specific procedures vary depending on the architecture of your system, and the architectures do not provide all options.

Note:

  • First of all, you will need a PXE server for the system boot and permit the installation process to start.
  • A Kickstart file must be present at any location that is accessible for the system to be installed.

Method:

  • On your PXE server, add the “inst.ks=” boot option to the relevant line in the configuration file of the boot loader. Your system hardware and architecture determine the file syntax and name.
  • The network server is utilized for starting the installation.

Using the Kickstart file installation parameters, the installation will begin immediately. The installation is automated if the Kickstart file is legitimate and comprises all essential commands.

Method 2: Manual Installation

This method describes how to manually start a Kickstart installation, which necessitates some user intervention. Utilize the boot option “inst.ks=location“, when you want to start the installation. Here you can replace the location value with your Kickstart file location. The architecture of your system determines the specific method of defining the boot option.

Note:

You have a Kickstart file ready to install at an accessible location of our system.

Method:

  • Utilize local media to start the system (a USB flash drive, a DVD, or a CD).
  • Now, declare your boot configuration settings at the boot prompt.
  • Check the boot options you have added and start the installation process.

The installation process used the settings added in the kickstart file. Then, installation is automated from this point forward if the Kickstart file is legitimate and contains all essential commands.

Method 3: Using a Local Volume

This method will start the Kickstart installation process by placing a Kickstart file with a particular name on a labeled local volume.

Note:

  • As soon as the installation software starts, a disc holding this volume must be present on the machine.
  • It would help prepare a volume with the label OEMDRV, having Kickstart file “ks.cfg” in its root.

Method:

  • We utilize local media to start the system (a USB flash drive, a DVD, or a CD).
  • Now, declare your boot configuration settings at the boot prompt.
  • Suppose a virtual repository exists on a network. In that case, you may need to use the “ip=” option for the network configuration. Using the DHCP protocol, by default the installer will try to configure all of the network devices.
  • You may require to add the “inst.repo=” option to access a software source from which relevant packages will be installed. The installation source should be declared in the Kickstart file if you do not use this option.
  • Begin the installation by checking the boot options you have added.

To initiate automated Kickstart installation, the Kickstart file is immediately identified.

Maintenance of a Kickstart File:

On Kickstart files, you can execute automated checks. For that, you have to double-check the validity of a new or existing error causing the Kickstart file.

Kickstart Maintenance Tools Installation:

You must first install the package that contains the Kickstart maintenance tools to utilize them. Write out the following command for establishing the “pyKickstart” package on your CentOS system.

$ sudo yum install pyKickstart

Kickstart User Guide:

To get more information about Kickstart, write out the following command:

$ rpm -qd pyKickstart

Conclusion:

The topmost enterprises utilize Kickstart to deploy the Red Hat server image that can then be tweaked, as needed. Kickstart installations allow you to partially or entirely automate the installation procedure. These files include answers to all of the queries that any installation application often asks, such as how the drives should be partitioned, what time zone the system should use, and which software should be installed. In this guide, we have covered 14 important points related to Kickstart. Do you want to automate the installation process? Feel free to try Kickstart!

About the author

Talha Saif Malik

Talha is a contributor at Linux Hint with a vision to bring value and do useful things for the world. He loves to read, write and speak about Linux, Data, Computers and Technology.