In this article I will share the steps to create custom ISO using original RHEL/CentOS image. The original DVD of RHEL/CentOS is quiet huge (around 9Gb for RHEL 8.3), in production environment we normally create our own custom ISO with reduced number of packages and deliver the same to our clients and customers.
The steps from this article are verified for CentOS 8 but the same will also work for RHEL 8. But if you want to create custom ISO for RHEL/CentOS 7 then I would recommend to follow How to create customized bootable ISO image in RHEL/CentOS 7
Step 1: Access the original ISO Image
First of all you would need access to the original ISO DVD image which we will further customise and generate a small version of the same image with lesser rpm count. I will be using CentOS 8.2 for the demonstration of this article. I have already added the image on my Oracle VirtualBox VM and have mounted it on /mnt
:
~]# mount /dev/sr0 /mnt
mount: /mnt: WARNING: device write-protected, mounted read-only.
Step 2: Generate directory structure
Next we need to have same directory structure as used in the original DVD. But since we don't want to copy all the rpms from the original DVD, so we will exclude the folders which contains packages.
BaseOS/Packages
and AppStream/Packages
. So make sure you update your configuration based on your environment.I will create a base directory /data/custom_iso
under which I will copy the ISO content:
~]# mkdir /data/custom_iso
Since we are using CentOS 8, we will copy everything except BaseOS
and AppStream
directory from the original DVD.
~]# rsync -av --progress /mnt/ /data/custom_iso/ --exclude BaseOS --exclude AppStream
This will copy all the files and folders from ISO mounted on /mnt
into /data/custom
. But there are also some hidden files in the root folder of the ISO which also must be copied or else your ISO will never work.
~]# cp -vf /mnt/.??* /data/custom_iso/
'/mnt/.discinfo' -> '/data/custom_iso/.discinfo'
'/mnt/.treeinfo' -> '/data/custom_iso/.treeinfo'
These are the final content under my custom_iso
directory at this stage:
~]# ls -al total 48 drwxr-xr-x. 7 root root 4096 Feb 25 01:32 . drwxr-xr-x. 4 root root 4096 Feb 25 00:09 .. -r--r--r--. 1 root root 44 Feb 25 00:36 .discinfo dr-xr-xr-x. 3 root root 4096 Jun 9 2020 EFI dr-xr-xr-x. 3 root root 4096 Jun 9 2020 images dr-xr-xr-x. 2 root root 4096 Feb 24 23:18 isolinux -r--r--r--. 1 root root 87 Jun 9 2020 media.repo -r--r--r--. 1 root root 664 Jun 9 2020 TRANS.TBL -r--r--r--. 1 root root 1520 Feb 25 00:36 .treeinfo
Step 3: Create package list
This is the most tricky part unless you are planning to use all the rpms from the original DVD (in which case you can copy the entire directory into /data/custom_iso
in the previous step). I know of two methods which can be used to achieve this, you can add any more which you felt was more easier using the comment section.
Method 1: Getting list of packages using DNF/YUM
In this method we will get the list of packages for an individual group using YUM or DNF and then copy those packages into BaseOS/AppStream directory respectively. First you must decide the list of group(s) which you plan to install as part of your custom ISO. To get the list of available groups you can use:
]# dnf grouplist Last metadata expiration check: 0:00:06 ago on Thu 25 Feb 2021 11:15:49 AM IST. Available Environment Groups: Server Workstation KDE Plasma Workspaces Virtualization Host Custom Operating System Installed Environment Groups: Server with GUI Minimal Install Installed Groups: Container Management Headless Management GNOME Desktop Environment Hardware Support Available Groups: .NET Core Development RPM Development Tools Development Tools Graphical Administration Tools Legacy UNIX Compatibility Network Servers Scientific Support Security Tools Smart Card Support System Tools Fedora Packager Xfce Games and Entertainment Graphical Internet KDE (K Desktop Environment) Sound and Video
For example I want to have an ISO with rpms required to install "Minimal Environment
" group. So to get the list of rpms part of this group we can use:
~]# dnf groupinfo "Minimal Install" Last metadata expiration check: 0:02:31 ago on Thu 25 Feb 2021 11:15:49 AM IST. Environment Group: Minimal Install Description: Basic functionality. Mandatory Groups: Core Optional Groups: Guest Agents Standard
So looks like this group is composed of different sub groups, so we need to query these individual groups to get the list of packages:
~]# dnf groupinfo "Core" "Guest Agents" "Standard"
This will give you a long output with the list of following types of packages for individual groups:
- Optional Packages
- Default Packages
- Mandatory Packages
You can write a small script to get the list of packages and then copy those packages from the original DVD into respective folder of custom_iso
. As some of these packages will be part of BaseOS
repo while the others would be part of AppStream
repo so you must maintain the hierarchy.
Method 2: Bring up a new instance using respective ISO
I personally prefer this method as the success rate is much better to get a working list of packages. In this method we will install CentOS 8 on one of my VMs and then select the respective groups which you plan to include in your custom ISO.
Under the installation option stage:
You can select your preferred group:
I would not recommend selecting any extra add-on packages at this stage unless you know what you are doing. You can always manually install the packages later once the node is UP based on your requirement.
dnf groupinstall <group_name>
" once this node is installed. This would install the packages and all the dependencies from the provided group_name
. But it is important that you use offline repository for performing this step as if you use online repositories then you may not have access to those rpms in the DVD. In such case you can just download the respective rpm and dependent rpms from online repositories.Once this VM is installed with CentOS 8, you can go ahead and install any additional packages or groups based on your requirement:
# dnf install <pkg> # dnf groupinstall <group>
Next query the list of rpms from this newly created VM and store the output in a file and copy this file to your original node where you were creating the custom ISO:
~]# rpm -qa --queryformat %{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}'\n' > /tmp/rpms.txt
This will store the rpm along with the version, release and architecture format into /tmp/rpms.txt
. So without much hassle we have our list of rpms with all the dependencies.
Step 4: Copy rpms based on package list
Now that we have our package list with the list of packages we want in our custom ISO, we have to copy these rpms from the original DVD to our custom ISO. It would have been very easy in RHEL/CentOS 7 where we had a single location for all the packages but with RHEL/CentOS 8 now we have BaseOS
and AppStream
directory for the packages so we must make sure that rpms are copied to their respective directory.
At Step 2 we had skipped the copying of BaseOS
and AppStream
directory so let us manually create these directories to store the packages:
~]# mkdir -p /data/custom_iso/BaseOS/Packages /data/custom_iso/AppStream/Packages
Now to copy the rpms I have written a small script, this script assumes that the original DVD is mounted on /mnt
which contains all the rpms and we are storing the output in /data/custom_iso
~]# cat /tmp/copy_rpms_to_myiso.sh #!/bin/bash RPM_FILE="/tmp/rpms.txt" for pkg in `cat $RPM_FILE`; do RPM=`find /mnt/ -name $pkg*.rpm` if [[ $RPM =~ .*BaseOS.* ]];then cp -ap $RPM /data/custom_iso/BaseOS/Packages/ elif [[ $RPM =~ .*AppStream.* ]];then cp -ap $RPM /data/custom_iso/AppStream/Packages/ else echo "$pkg not found" fi done
This script will check if the individual rpm is from BaseOS
or AppStream
repository and then will copy the rpm into respective directory. If the script fails to find the rpm in both the repository then it will print the package name which was not found.
Let us execute this script:
~]# /tmp/copy_rpms_to_myiso.sh
If everything is correct then this step should copy all the packages into it's respective folder.
Step 5: Create repodata for Custom ISO
Now that we have all the required rpms in place under respective repo directory, next we must create repodata
for this individual repositories. To achieve this we will need createrepo
tool which you can install using yum or dnf:
~]# dnf install createrepo
Next we would need Comps.xml
file from the original DVD for both the repositories. This comps.xml contains the list of groups and the mapping packages for individual group, this file is normally referred by the installation medium to identify the available groups and add-on packages.
So copy the respective comps.xml and place it in your custom ISO
[root@centos8 custom_iso]# cp /mnt/BaseOS/repodata/*comps*.xml BaseOS/comps_base.xml [root@centos8 custom_iso]# cp /mnt/AppStream/repodata/*comps*.xml AppStream/comps_app.xml
Next create repo using these group xml file for both BaseOS
and AppStream
:
[root@centos8 custom_iso]# createrepo -g comps_app.xml AppStream/ Directory walk started Directory walk done - 29 packages Temporary output repo path: AppStream/.repodata/ Preparing sqlite DBs Pool started (with 5 workers) Pool finished [root@centos8 custom_iso]# createrepo -g comps_base.xml BaseOS/ Directory walk started Directory walk done - 360 packages Temporary output repo path: BaseOS/.repodata/ Preparing sqlite DBs Pool started (with 5 workers) Pool finished
This step will create repodata
directory with the required database files under /data/custom_iso/BaseOS
and /data/custom_iso/AppStream
directory:
[root@centos8 custom_iso]# ls -l BaseOS/repodata/ AppStream/repodata/ AppStream/repodata/: total 808 -rw-r--r--. 1 root root 10856 Feb 25 02:02 231deccd5b8e4dc32047ccbe4f6b0b0683a6b0253cc3e3dc89093b6ae9e522da-other.xml.gz -rw-r--r--. 1 root root 15238 Feb 25 02:02 39e06ef307b975417fcfd5ec9bc23c84495407c136e430837eda3508140e7964-other.sqlite.bz2 -rw-r--r--. 1 root root 19034 Feb 25 02:02 4d1f47a7d096fdbe9bdfccb84ea596be9a09ec6d51cf0b8b67f5c3663775261d-filelists.sqlite.bz2 -rw-r--r--. 1 root root 556980 Feb 25 02:02 636d97191c77227309938cd1eb97fce7139c880dd52a57d950d1094bd170ddfa-comps_app.xml -rw-r--r--. 1 root root 18477 Feb 25 02:02 8b15e126c078293ffb47e38f32c73ebf5c19878f920b696fac81e37f974aafaf-primary.sqlite.bz2 -rw-r--r--. 1 root root 9714 Feb 25 02:02 9e9d9bfebabb219028fc2fb1b479b1868dc30aecfd07ce7da75935183a9ba644-primary.xml.gz -rw-r--r--. 1 root root 116050 Feb 25 02:02 e9524923e26fe119880aa4929454fcff9ed8877f7e5ace47928805a5cbeeb920-comps_app.xml.gz -rw-r--r--. 1 root root 10460 Feb 25 02:02 fbc30afdbd054a4868d5d3fa10f91d647e95d833ebe0452a8fb15167708a643f-filelists.xml.gz -rw-r--r--. 1 root root 4316 Feb 25 02:02 repomd.xml BaseOS/repodata/: total 2680 -rw-r--r--. 1 root root 153383 Feb 25 01:38 38630dc278c0790d7a0ca019208c223dc9cdd384f265272e6b3489effa7ae63c-other.xml.gz -rw-r--r--. 1 root root 347027 Feb 25 01:38 586a8e96ad3b73414e5c6ae94a5e4f128a087fcb0ca9837674573a8d6cac4a9c-comps_base.xml -rw-r--r--. 1 root root 373357 Feb 25 01:38 77b091786d530232d4465543457fe73307a61d359dbd3704abb9656b38d3d339-filelists.sqlite.bz2 -rw-r--r--. 1 root root 426066 Feb 25 01:38 7c83828e61d655fa0908d64f69d9f0b88c72972efb880c5e0285d3f9dd7eb3ec-primary.xml.gz -rw-r--r--. 1 root root 185860 Feb 25 01:38 ae1b59594f9141e982cf97cab724c4f2c454814740edde657791bf1f2f75a7d2-other.sqlite.bz2 -rw-r--r--. 1 root root 78056 Feb 25 01:38 c1437f9c1bd0a3940a7ef97288dbfc6247fa71f9fded4689cc3d16213ad78897-comps_base.xml.gz -rw-r--r--. 1 root root 298383 Feb 25 01:38 d6b6730e96a51b83763e5e75109e603a5023b7237496fb3ee47567f65d700cfb-filelists.xml.gz -rw-r--r--. 1 root root 857212 Feb 25 01:38 e1c8b7e4a5d8da239510f494f92cb156db3722dcf4b1bf7b24553ab3c3974cf7-primary.sqlite.bz2 -rw-r--r--. 1 root root 3873 Feb 25 01:38 repomd.xml
Next we need to create modules file for AppStream
repository because if you check the repodata
in the original DVD, it will have one additional file:
[root@centos8 custom_iso]# ls -l /mnt/AppStream/repodata/*modules*
-r--r--r--. 1 root root 46270 Aug 16 2019 /mnt/AppStream/repodata/f8cbb89b908e10e2e01b6b5555a116ba365f96cd4b5aa8414aa5465f82a021fd-modules.yaml.gz
So we must add the modular metadata (modulemd
) using modifyrepo_c
inside the same repodata of our custom ISO. To achieve this we must copy the original modules.xml
from the source ISO:
[root@centos8 custom_iso]# cp /mnt/AppStream/repodata/*modules.yaml* AppStream/
Unzip the content of this file as it is in .gz
format:
[root@centos8 custom_iso]# cd AppStream
[root@centos8 AppStream]# gunzip f8cbb89b908e10e2e01b6b5555a116ba365f96cd4b5aa8414aa5465f82a021fd-modules.yaml.gz
[root@centos8 AppStream]# ls -l *modules*.yaml
total 876
-r--r--r--. 1 root root 281029 Feb 25 02:01 f8cbb89b908e10e2e01b6b5555a116ba365f96cd4b5aa8414aa5465f82a021fd-modules.yaml
We will rename the file for easier usage:
[root@centos8 AppStream]# cp f8cbb89b908e10e2e01b6b5555a116ba365f96cd4b5aa8414aa5465f82a021fd-modules.yaml modules.yaml
Next to add the modular metadata (modulemd
), run:
[root@centos8 custom_iso]# modifyrepo_c --mdtype=modules AppStream/modules.yaml AppStream/repodata/
This will create the respective modules.yaml
file inside AppStream/repodata
directory:
[root@centos8 custom_iso]# ls -l AppStream/repodata/
total 808
-rw-r--r--. 1 root root 10856 Feb 25 02:02 231deccd5b8e4dc32047ccbe4f6b0b0683a6b0253cc3e3dc89093b6ae9e522da-other.xml.gz
-rw-r--r--. 1 root root 15238 Feb 25 02:02 39e06ef307b975417fcfd5ec9bc23c84495407c136e430837eda3508140e7964-other.sqlite.bz2
-rw-r--r--. 1 root root 19034 Feb 25 02:02 4d1f47a7d096fdbe9bdfccb84ea596be9a09ec6d51cf0b8b67f5c3663775261d-filelists.sqlite.bz2
-rw-r--r--. 1 root root 556980 Feb 25 02:02 636d97191c77227309938cd1eb97fce7139c880dd52a57d950d1094bd170ddfa-comps_app.xml
-rw-r--r--. 1 root root 18477 Feb 25 02:02 8b15e126c078293ffb47e38f32c73ebf5c19878f920b696fac81e37f974aafaf-primary.sqlite.bz2
-rw-r--r--. 1 root root 9714 Feb 25 02:02 9e9d9bfebabb219028fc2fb1b479b1868dc30aecfd07ce7da75935183a9ba644-primary.xml.gz
-rw-r--r--. 1 root root 116050 Feb 25 02:02 e9524923e26fe119880aa4929454fcff9ed8877f7e5ace47928805a5cbeeb920-comps_app.xml.gz
-rw-r--r--. 1 root root 46270 Feb 25 02:02 f8cbb89b908e10e2e01b6b5555a116ba365f96cd4b5aa8414aa5465f82a021fd-modules.yaml.gz
-rw-r--r--. 1 root root 10460 Feb 25 02:02 fbc30afdbd054a4868d5d3fa10f91d647e95d833ebe0452a8fb15167708a643f-filelists.xml.gz
-rw-r--r--. 1 root root 4316 Feb 25 02:02 repomd.xml
So finally our repository configuration is completed, so let's move on to the next step.
Step 6: Add custom third party rpms (Optional)
Now you may have a requirement to also add some custom third party rpms into your custom CPIO which are not available in the vanilla DVD by default so let me show you the steps to add those to your custom ISO. But if you do not have any such requirement then you can skip this section.
It is strictly not recommended to modify default repos i.e. AppStream and BaseOS with custom rpms so we need to create a new repository for our custom rpms. Navigate inside custom_iso directory which we created earlier
[root@centos8 ~]# cd /data/custom_iso
Create a new directory with your repo name which you want to use, we will call it ExtraPackages
:
[root@centos8 custom_iso]# mkdir ExtraPackages; cd ExtraPackages
Now copy all your rpms to this path. Once you are done execute createrepo
to create all repodata content inside ExtraPackages
. This will create the required repository data files for perform installation using this repo.
[root@centos8 ExtraPackages]# createrepo . [root@centos8 ExtraPackages]# createrepo . [root@centos8 ExtraPackages]# # ls -l total 112 -rw-r--r-- 1 root root 64492 Feb 11 2021 perl-WWW-Curl-4.17-21.el8.x86_64.rpm -rw-r--r-- 1 root root 41932 Feb 11 2021 perl-Net-IP-1.26-20.el8.noarch.rpm drwxr-xr-x 2 root root 4096 Feb 11 2021 repodata
repodata
directory is inside the ExtraPackages
directory to consider that as a repo.
Step 7: Create kickstart configuration file
I hope you are aware that in RHEL/CentOS we use kickstart to automate the installation procedure. I have already written a detailed article on kickstart configuration along with a sample kickstart file. Here you can use the kickstart template from the VM which you might have created at Step 3 (Method-2) under /root/anaconda-ks.cfg
I will not be able to explain all the individual section of the kickstart as that is out of scope for this article, I have just placed a sample kickstart from my working node where I verified these steps:
#platform=x86, AMD64, or Intel EM64T #version=RHEL8 repo --name="AppStream" --baseurl=file:///run/install/repo/AppStream # Add additional repo name where you have added custom rpm repo --name="ExtraPackages" --baseurl=file:///run/install/repo/ExtraPackages # Only use sda disk ignoredisk --only-use=sda # System bootloader configuration bootloader --append="rhgb novga console=ttyS0,115200 console=tty0 panic=1" --location=mbr --driveorder="sda" --boot-drive=sda # Clear the Master Boot Record zerombr # Partition clearing information clearpart --all # Reboot after installation reboot # Use text mode install text # Use CDROM cdrom # Keyboard layouts keyboard --vckeymap=us --xlayouts='' # System language lang en_US.UTF-8 # Installation logging level logging --level=info # Network information network --bootproto=dhcp --device=enp0s3 --noipv6 --activate --hostname server1.example.com # Root password rootpw --iscrypted $1$oXhMRzpse6FeGBc1uF2JmG2xTeSWPL9 # System authorization information authselect --enableshadow --passalgo=sha512 # SELinux configuration selinux --disabled firstboot --disable # Do not configure the X Window System skipx # System services services --disabled="kdump,rpcbind,sendmail,postfix,chronyd" # System timezone timezone Asia/Kolkata --isUtc --ntpservers=10.43.12.34 # Disk partitioning information autopart --type=lvm %packages @^minimal-environment smartmontools sysstat tmux tuned zip %end %addon com_redhat_kdump --disable --reserve-mb='auto' %end
You can also add %pre and %post section in the kickstart to add your custom scripts and configurations.
Place this kickstart file in the home folder of the custom ISO i.e. /data/custom_iso
in our example:
[root@centos8 custom_iso]# ls -l ks.cfg
-rw-------. 1 root root 1845 Feb 25 01:32 ks.cfg
Step 8: Create/Modify the GRUB2 Menu
Next we will modify the GRUB2 splash screen which gives us the option to perform the installation, you could also modify the splash screen of the GRUB2 menu. We will use the default configuration file with little modification to support our customization.
Locate isolinux.cfg
under isolinux
directory of the custom ISO and modify the highlighted section:
FROM:
label linux
menu label ^Install CentOS Linux 8.0.1905
kernel vmlinuz
append initrd=initrd.img inst.stage2=hd:LABEL=CentOS-8-BaseOS-x86_64 quiet
TO:
label linux
menu label ^Install CentOS Linux 8
kernel vmlinuz
append initrd=initrd.img inst.repo=cdrom ks=cdrom:/ks.cfg quiet
If you have placed you kickstart file at a different location then you can modify the above entry accordingly.
Step 9: Create custom ISO
So finally we are at the final stages of this article. You are just one step away from having your own custom ISO. We require mkisofs
tool to create our custom ISO which is part of genisoimage
in RHEL/CentOS 8 so to install this you can use yum/dnf:
~]# dnf install genisoimage
Next use the following command to generate your ISO (assuming you are under /data/custom_iso
):
[root@centos8 custom_iso]# mkisofs -o /tmp/new.iso -b isolinux/isolinux.bin -c isolinux/boot.cat --no-emul-boot --boot-load-size 4 --boot-info-table -J -R -V "CentOS-8-2-2004-x86_64-dvd" .
Here this command will generate /tmp/new.iso
with the LABEL CentOS-8-2-2004-x86_64-dvd
.
Step 10: Validating the ISO
Now that we have our custom ISO ready, it is time to create a new VM using this image. Once the VM boots using the custom image, select the option to "Install CentOS Linux 8" and press TAB which will show you the isolinux.cfg
content which we modified in Step 7
Hit Enter to start the installation:
So as you see the installation has started successfully.
Summary
In this tutorial we learned how to create custom ISO with minimzed package list in RHEL/CentOS 8. You may feel some parts of this article complicate, specially the step where we generated our repodata. In such case you can always choose to take the default repodata
from the original DVD for both BaseOS and AppStream and that should also work but the repodata database will contain details of rpms which are actually not present in the DVD. Although this will not impact the functioning of the ISO. You can further enhance the steps by adding %pre scripts to prompt of user password or network details which can then be parsed into the kickstart.
If I want to add some configuration changes, like if I want to Harden my CentOS image which files should I then copy in my custom iso?
You can use %pre and %post to place any custom files based on your requirement
would this method work for Oracle Linux 7.8
OEL is also based on RHEL so it should work, you can give it a try.
Does this CentOS ISO file support UEFI secure boot?
I had tested this for legacy BIOS, for UEFI I think some changes would be required.
Wonderful, does it work for Rocky 9 too?- In your opinion is it easy to adapt it?
It should work, if you face any issues then you can post here.
Hi,
Thanks for your sharing.
So I have some questions.
In my case, if I built a system using Rhel7 with some custom software like BIND9, Apache2, MySQL,…and some Opensource
Now, I want to create a custom iso with the current system (include all software that i installed). And i will use this iso file to build in other server/
How can i do that ?
Thanks
You can do a rpm -qa on your system and then write a small script to copy the packages from official RHEL DVD and use step 6 from this article to add additional software like apache2 etc which are not part of official DVD.
thanks for your reply.
So Should i use linux live kit (https://www.linux-live.org/) or linux from scratch ?
Thanks
It is easier if you use the DVD which was used to bring up your source linux server or else you will have to figure out a way to use the same rpm with same version. If there is a change in version then you may face dependency issues during installation.
hi , how to make a iso with custom rpms? I want install some software such as docker, but I don’t know how to install it by using iso,could you help me,thanks very much.
Create a new directory to store your custom packages inside the home folder of the ISO. For example in this article,
/data/custom_iso
. Create a new directory such as/data/custom_iso/ExtraPackages
Now place all your rpm and dependent rpm here and then execute createrepo inside this directory to create repodata.
Now in your kickstart file add following line (next to repo –name=”AppStream”…)
With this a new repo will be added to your set of available repositories for your custom rpms.
if my custom rpms dependent some rpms that in the BaseOS or AppStream,should I move all of them to the ExtraPackages?
thanks so much~
No, that will be automatically picked by yum/dnf as they are also part of available repos
It that mean my custom rpms only can be installed after the system installed?such as add some command into the %post script?
could i modify the %package and install the custom rpms。
thanks~
No commands to be added in any section of kickstart. You just need to provide rpm name such as docker inside %packages section
do you have any social software?
I would like to ask you some more detailed questions,
thanks so much
You can send your query to admin@golinuxcloud.com
hello,I put the rmps about docker into a new direction,and how to make a respository,I send a email to you,please help me,thank you so much~
I have added an extra step 6 to cover this scenario. I hope this helps.
Hello,
I followed the steps outlined in the post but when I try to install the system, I’m getting the error:
“Problems in request: missing packages: tmux, grub, missing group: minimal”
Could you please help with this error?
It is possible with new release, the group name has changed from “minimal” to something else. It would be better to check this in any system which was brought up using CentOS of same release
Hi,
Please delete my previous question.
I follow your tutorial, and when I execute it on my server, there are some errors in Installation Source and Software Selection.
How to resolve the problem?
Please share image as attachment to admin@golinuxcloud.com
Hello, Thank you for the tutorial ! It helped me alot!
Just a quick question, you’re installaing new pakcages using “dnf install ” but later on you’re just copying rpm packages from the mounted DVD. How are you sure that those packages you installed using “dnf” are present in the mounted DVD ? Is there a solution to this problem ?
That’s a good question. I think I should have mentioned that, I have now updated my article with this information.
We should actually use offline repository for this operation or else we will end up downloading rpms and dependent rpms from web which can again be very hectic depending upon the count of rpms.
Hello,
Thank you !
Do you know of any efficient way to update the modules.yaml file with newer packages versions ?
Thank you !
I did mentioned the steps to update modules.yaml, are you facing any issues with those steps?
No it worked just fine.
I just wanted to use newer versions of some packages (example : freeradius-3.0.20-10 instead of freeradius-3.0.20-9 that exists in the DVD).
The problem is the modules.yaml contains the older versions and replacing erverything manually is complicated with a big number of packages.
PS: to find the repo of a package, i used “repoquery -i –latest-limit 1 | grep Repository” on rhel85
Ideally in such case it is better to create one additional repo and add that repo in the ks.cfg which will be part of the image by using
As Red Hat/CentOS doesn’t support modifying their base repositories, the steps I shared can be used for minimal changes but if you intend to use packages which are not part of the DVD then create one more folder inside the path where your images files are stored, place all the rpms and create a repo which you can add using above command.
During installation, anaconda will automatically pick the latest available rpm
Thanks ! That’s what I tried to do at first but I always had the “invalid checksum” error in installation even though I created the repodata folder using “createrepo”.
invalid checksum is reported when we have incorrectly modified defaullt repo. I have a working setup were I have added three additional repos in addition to BaseOs and AppStream (updates, EPELPackages and SomeAdditionalRepo)
My suggestion would be to revert back everything to default and just add the additional repos
I’ve followed this exactly and got the iso to load just fine as a DVD in VMware! awesome!, but when I load the iso onto a flash drive nothing shows up on real hardware, yet when I tested the exact same method of creating the flash drive with the vanilla iso it worked fine. My assumption is that I need to change something in the grub config, but I’m not sure what. Any ideas?
That is a nice observation, although I haven’t tried this scenario yet so can’t comment.
I will try to test this and if any modification required then will update this article.
Thanks for this tutorial! One comment (possible correction), in the ‘for’ loop script where you show copying rpms from the RHEL ISO. The ‘find’ command only searches in the BaseOS folder, yet your ‘if’ statement in the ‘for’ loop checks to see if “AppStream” or “BaseOS” are contained in the path. That didn’t make sense to me, since you’re only searching in “BaseOS”. You’ll never get a result with “AppStream” in the path unless you change the search path in the ‘find’ command.
Thank you for highlighting this, you are correct. The script will generally search inside /mnt and then map the PATH
I have performed the below and nothing gets copied into Base or AppStream.
It is a simple shell script, you can troubleshoot locally. I am not aware of your environment so can’t help just by looking at the error.