Are you looking for a tutorial on how to run Kickstart on Rocky Linux 9? Then this is the guide you’re looking for.
Kickstart is a way to automate Linux installation. If you’ve ever installed Linux by yourself, you know that you need to go through a few phases, answer some questions, and configure some settings to start the installation process.
This might be okay for a device or two. But think about a network that contains hundreds of devices where you want to install Linux. It would be too time-consuming and tiresome.
In this tutorial, we will cover everything you need to know to start the Kickstart installation on Rocky Linux 9.
Let’s get started!
How to Run Kickstart on Rocky Linux 9
We will show you the necessary steps for the process. We should divide the whole guide into a few sections.
Create a Kickstart File
In essence, the Kickstart installation uses a configuration file to read all the parameters used to install the Operating System. You can create this file using almost any text editor you like.
For this tutorial, we will use the Nano editor. Also, the name of the file doesn’t matter. Use a name that is easy to remember and type it. In this case, we will name it kickstart.cfg
. To create a file in Nano, use this command:
$ sudo nano kickstart.cfg
Output:
Now you need to write your configuration in this file. The file will contain several sections. You need to maintain a serial while writing each section. For example, the Command section comes first. You can also write Anaconda add-ons in this section.
After that comes the Packages section. You can specify which packages to install and which ones not to in this section.
After the Packages section, you can write the pre
, post
, and onerror
sections. These are optional sections that you can write in any order. Also, you must use %end
to end the %addon
, %packages
, %onerror
, %pre
, and %post
sections.
Let’s have a look at a sample Kickstart file so you can understand who to make one:
# Basic system installation info
install
# set installation language
lang en_US.UTF-8
# set keyboard
keyboard us
# enable firewall
firewall --enabled
# version=RockyLinux9
timezone Asia/Dhaka
# Network configuration
network --bootproto dhcp
# create a sudo capable user
user --name=newuser --password=12345 --groups=wheel
# set root password
rootpw --iscrypted 12345
# clear all existing storage (!)
zerombr
clearpart --all --initlabel
# automatically create default storage layout
autopart
# Included Packages
%packages
@base
@core
@development
vim
git
docbook*
-firefox
%end
Let’s try to understand what each part means. In the top section, we set the common installation settings asked during Linux installation, such as Language, Keyboard, Timezone, Network, etc.
Then we create a user for the system, give it a name and password, and add it to the wheel group. We also set a password for the root account. We handle disk partitioning as well.
In the next section, we write about the package groups and individual packages we’d like to include and exclude. You can even specify an entire environment installed here. So if you add @^Infrastructure Server
in this section, it will install all packages related to this environment.
You can use the ‘*’ sign as a wild card to install all packages that have that package name in common. So docbook*
will install docbook-dtds
, docbook-simple
, docbook-slides
and others. The ‘-’ sign is used to exclude a package from being installed. And finally, we end the section with %end
.
Once you’re done creating your configuration file, save it using “Ctrl + O” and then close the file with “Ctrl + X”.
Verify the Kickstart File
Now that you have created the Kickstart file, you need to validate it. For that purpose, we will use the pykickstart
tool, and then update your system with this command:
$ sudo dnf update
Output:
Once the update is finished, install the tool using this command:
$ sudo dnf install pykickstart
Output:
Once pykickstart
is already installed, we can start validating the Kickstart file we created earlier. Validate the file with this command:
$ ksvalidator ~/kickstart.cfg
Output:
If you get an error-free output like the screenshot above, the validation was successful. If not, you will receive which lines contain errors in the file. In that case, go back to the file and correct any errors.
Make the Kickstart File Available
We’ve created a Kickstart file and also validated it. Next, we will make it available, and we can do so by pasting it into an installation media or network server. You can use either of the following:
- DVD or USB flash drives which you can remove from the system
- Hard drives connected to the installation system
- A network share that can be accessed from the installation system
Make the Installation Source Available
The Kickstart file needs to make use of an installation source. This can be either an ISO image file or an installation tree.
If you’re using a DVD, you must burn the binary DVD ISO image onto that DVD. This way, you can easily create bootable optical media. Make sure that the DVD is in the drive before the installation starts.
For hard drives, you must have the ISO image in the top-level directory. If that’s not the case, you need to specify the image you’ll use in your Kickstart file. Connect the hard drive to the installation system and boot the installation program.
Installing from the network requires no physical media. But it does need prior setup. Try to use a TFTP server for this purpose.
Start the Kickstart Installation
In this last step, you need to boot the installation system. Upon boot, specify the location of your kickstart.cfg
file with this command:
$ linux ks=file:<path of the file>/kickstart.cfg
After this, the system will read from your Kickstart file and apply the configurations you wrote in it.
Final Thoughts
This tutorial shows you how to run Kickstart on Rocky Linux 9. This installation process is super useful—especially for System Administrators—if you don’t want any hassles whenever you want to install Linux. By following this tutorial, you will get a good grasp on how to apply this technique for Rocky Linux 9.
If this guide helped you, please share it.