When Why and Benefit Install rpm / Update RHEL Locally
- Have a secure environment that will never be connected to the internet, but still needs to be updated
- Would like to upgrade server from RHEL 8.x to RHEL 8.y with out internet / proxy or satellite server
- Using local repo to install package in secure environment
Prerequisite
RedHat Installation DVD, You can download here https://developers.redhat.com/products/rhel/download Register at Developer 1 Year or Paid a Subscription
Require user with root permission
Mount RedHat DVD / ISO
- By ISO
- Upload an ISO file to target server
- Create folder in mnt such as
/mnt/dvd
- mount iso file with
/mnt/dvd
# sudo mkdir /mnt/dvd # sudo mount -o loop rhel-8.10-x86_64-dvd.iso /mnt/dvd mount: /mnt/dvd: WARNING: device write-protected, mounted read-only.
- By DVD
- Check Optical Drive By Using Command
lsblk
you can see optical drive that name with srxx such as sr0
# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 50G 0 disk ├─sda1 8:1 0 1G 0 part /boot └─sda2 8:2 0 49G 0 part ├─rhel_invsdevapp01-root 253:0 0 47G 0 lvm / └─rhel_invsdevapp01-swap 253:1 0 2.1G 0 lvm [SWAP] sr0 11:0 1 13.3G 0 rom
- Create folder in mnt such as
/mnt/dvd
# sudo mkdir /mnt/dvd
- mount Optical Drive (sr0) with
/mnt/dvd
# sudo mount /dev/sr0 /mnt/dvd mount: /mnt/dvd: WARNING: device write-protected, mounted read-only.
- Check Structure look like this
# cd /mnt/dvd # ls AppStream EFI extra_files.json images media.repo RPM-GPG-KEY-redhat-release BaseOS EULA GPL isolinux RPM-GPG-KEY-redhat-beta TRANS.TBL
Troubleshooting :If you encounter errors, ensure that the DVD is inserted properly and device name (
/dev/sr0
) is correct. or Useor
lsblk
to confirm the correct device name.
dmesg | grep sr0
Create RHEL Local Repository
- In
/mnt/dvd
copy of the media.repo file and paste it to our system directory located at /etc/yum.repos.d/ with the name of rhel8_10.repo. or any name you want and set it permission to 0644
# sudo cp /mnt/dvd/media.repo /etc/yum.repos.d/rhel8_10.repo # sudo chmod 644 /etc/yum.repos.d/rhel8_10.repo
- open rhel8_10.repo file with any edit you want such as nano / vi , but i like nano
sudo nano /etc/yum.repos.d/rhel8_10.repo
- update content in rhel8_10.repo like this
Note: Please Check base url path is path that you mount DVD / ISO file
[dvd-BaseOS] name=DVD for RHEL - BaseOS baseurl=file:///mnt/dvd/BaseOS enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release [dvd-AppStream] name=DVD for RHEL - AppStream baseurl=file:///mnt/dvd/AppStream enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
After configuring the repo file, we need to clear the cache by using yum or dnf
# sudo yum clean all
# sudo dnf clean all Updating Subscription Management repositories. Unable to read consumer identity This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. 0 files removed
Note: "Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register."
Because is a my mock Enviroment for create a user manual not in production server
Check Update Repository by using yum or dnf
# sudo yum repolist enabled or # sudo dnf repolist enabled
you will get the output listing two additional local repositories named “dvd-AppStream” and “dvd-BaseOS”
# sudo dnf repolist enabled repo id repo name dvd-AppStream DVD for RHEL - AppStream dvd-BaseOS DVD for RHEL - BaseOS
Update the repository cache with dnf makecache
# sudo dnf makecache DVD for RHEL - BaseOS 51 MB/s | 2.4 MB 00:00 DVD for RHEL - AppStream 90 MB/s | 8.7 MB 00:00 Last metadata expiration check: 0:00:02 ago on Thu 17 Apr 2025 09:37:01 AM +07.
Check OS Before Upgrade
this is an additional step, but I want to record my focus component in RHEL / Kernel or specific runtime such as Podman
# cat /etc/redhat-release Red Hat Enterprise Linux release 8.2 (Ootpa) # subscription-manager version server type: This system is currently not registered. subscription management server: Unknown subscription management rules: Unknown subscription-manager: 1.26.16-1.el8 # podman --version podman version 2.0.5
dnf list kernel
this command list kernel that will be replace after upgrade such as kernel 4.18.0-193.el8 will upgrade to 4.18.0-553.el8_10
# uname -r 4.18.0-193.el8.x86_64 # dnf list kernel Last metadata expiration check: 0:09:04 ago on Thu 17 Apr 2025 09:37:01 AM +07. Installed Packages kernel.x86_64 4.18.0-193.el8 @anaconda Available Packages kernel.x86_64 4.18.0-553.el8_10
Update RHEL
this step you must have a backup / fallback plan such as DR-Site and Tell the user about downtime and impact system etc.
if you ready, Please follow my command dnf update -y --quiet
//run a full system update (quietly):
# dnf update -y --quiet warning: /mnt/dvd/BaseOS/Packages/NetworkManager-initscripts-updown-1.40.16-15.el8.noarch.rpm: Header V4 RSA/SHA256 Signature, key ID fd431d51: NOKEY Importing GPG key 0xFD431D51: Userid : "Red Hat, Inc. (release key 2) <[email protected]>" Fingerprint: 567E 347A D004 4ADE 55BA 8A5F 199E 2F91 FD43 1D51 From : /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release Importing GPG key 0xD4082792: Userid : "Red Hat, Inc. (auxiliary key) <[email protected]>" Fingerprint: 6A6A A7C9 7C88 90AE C6AE BFE2 F76F 66C3 D408 2792 From : /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release .....
Reboot System and check your focus component in RHEL / Kernel or specific runtime such as Podman etc
# cat /etc/redhat-release Red Hat Enterprise Linux release 8.10 (Ootpa) # dnf list kernel Last metadata expiration check: 0:27:59 ago on Thu 17 Apr 2025 09:37:01 AM +07. Installed Packages kernel.x86_64 4.18.0-193.el8 @anaconda kernel.x86_64 4.18.0-553.el8_10 @dvd-BaseOS # uname -r 4.18.0-553.el8_10.x86_64 # subscription-manager version subscription management server: Unknown subscription management rules: Unknown subscription-manager: 1.28.42-1.el8 # podman --version podman version 4.9.4-dev
Clean up Step Note:
- When you're done, unmount the drive using
sudo umount /mnt/dvd
- If the DVD contains a GPG key, make sure to import it using:
sudo rpm --import /path/to/key
If you want to Installing Packages from Local RHEL Repository
# sudo yum --disablerepo="*" --enablerepo="dvd-AppStream" install [-YOUR_PACKAGE_NAME-] or # sudo dnf --disablerepo="*" --enablerepo="dvd-AppStream" install [-YOUR_PACKAGE_NAME-]
Reference
- https://access.redhat.com/solutions/3776721
- https://www.redhat.com/en/blog/how-update-red-hat-enterprise-linux-tvia-minor-releases-and-extended-update-support
Discover more from naiwaen@DebuggingSoft
Subscribe to get the latest posts sent to your email.