Creating a Custom Rocky Linux ISO
Knowledge:
Reading time: 10 minutes
Introduction¶
There are many reasons for creating an ISO. Perhaps you want to change the boot process, add specific packages at install time, or update particular configuration files.
This guide will instruct you on how to build your own Rocky Linux ISO.
Prerequisites¶
- Rocky Linux Minimal ISO image (the DVD image is not required).
kickstartfile to apply to the ISO.- Read the Lorax Quickstart and mkksiso documentation to become familiar with how to create an ISO.
Package installation and setup¶
- Install the
loraxpackage:
dnf install -y lorax
Building the ISO with a kickstart file¶
- Run the
mkksisocommand to add akickstartfile and then build a new ISO. Note that you need to run the command asrootor a user withsudoprivileges:
mkksiso --ks <PATH_TO_KICKSTART_FILE> <PATH_TO_ISO> <PATH_TO_NEW_ISO>
Adding a repository with its packages to an ISO image¶
- Make sure the repository you want to add has the
repodatadirectory inside of it. If not, you can create this using thecreaterepo_ccommand and install it withdnf install -y createrepo_c - Add the repository to your
kickstartfile, using the following syntax:
repo --name=extra-repo --baseurl=file:///run/install/repo/<REPOSITORY>/
- Add your repository using the
--addflag with themkksisotool:
mkksiso --add <LINK_TO_REPOSITORY> --ks <PATH_TO_KICKSTART_FILE> <PATH_TO_ISO> <PATH_TO_NEW_ISO>
- You can see additional details of this process using the
baseosrepository in the example below. - The
baseosrepository will be downloaded locally, along with all of its packages:
dnf reposync -p ~ --download-metadata --repo=baseos
- Then add the repository to your
kickstartfile:
repo --name=extra-repo --baseurl=file:///run/install/repo/baseos/
- Then point the
mkksisocommand directly to the repository directory and build the ISO:
mkksiso --add ~/baseos --ks <PATH_TO_KICKSTART_FILE> ~/<PATH_TO_ISO> ~/<PATH_TO_NEW_ISO>
Conclusion¶
Once your own ISO is built with your kickstart file, it makes it much easier to deploy hundreds of machines with the one image and not needing to configure each machine individually. To learn more about kickstart files, along with multiple examples, please check out the Kickstart Files and Rocky Linux guide.
Author: Howard Van Der Wal
Contributors: Steven Spencer, Ganna Zhyrnova