I need to install some packages offline, what procedure to follow,
Implementation Plan for Offline Package Installation on RHEL 9
1.Use dnf-utils on a system with internet access to download all required packages and their dependencies from trusted RHEL 9 repositories.
2.Save all downloaded .rpm files to a designated directory /tmp/all-offline-libs
3.Transfer or mount this directory on the target offline system.
4.On the offline system, create a custom YUM repository pointing to the mounted directory by configuring a .repo file.
5.Use microdnf or dnf to install the packages offline from the local repository via a shell script.
This did not work any other way
Download the image into the local system.
I used RHEL 8.6 iso (DVD iso approx 10GB), download link - https://access.cdn.redhat.com/content/origin/files/sha256/8c/8cb0dfacc94b789933253d5583a2fb7afce26d3...
Create a mount point directory, example /isomount with permissions 555.
Mount the iso image in the VM using “mount -o loop rhel-8.0-x86_64-dvd.iso /isomount”
Or add an entry in the /etc/fstab as “/home/user/rhel-8.0-x86_64-dvd.iso /isomount iso9660 loop 0 0”
$ mount /isomount
Create a file “/etc/yum.repos.d/rhel8.repo” and copy the below data inside
[InstallMedia-BaseOS]
name=Red Hat Enterprise Linux 8 - BaseOS
metadata_expire=-1
gpgcheck=1
enabled=1
baseurl=file:///isomount/BaseOS/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[InstallMedia-AppStream]
name=Red Hat Enterprise Linux 8 - AppStream
metadata_expire=-1
gpgcheck=1
enabled=1
baseurl=file:///isomount/AppStream/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
$ yum clean all
$ yum repolist << We should see the new repos listed here.
Try installing any package, example “yum install -y httpd” it should work.
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.