Red Hat package management (Local YUM/DNF)
DNF is software package manager, updated version of YUM. You can create local repository in RHEL9, to manage your system packages. In RHEL9 this service in known as DNF. But for older releases it was YUM (Yellow-Dog Updater Modified), In RHEL8 & 9 you can use DNF(DaNdiFied YUM). follow the step by step guidance to configure DNF or YUM in red hat enterprise Linux 9.
What is the need of local repository?
- Installing and managing packages
- Updating packages & patches locally
- For package management no internet is required
Understanding RHEL9 repository files
You can find two repositories in RHEL 9 distribution. Red Hat repository is distributed as RPM(Red Hat Package Management)
- BaseOS- Contain core packages of Linux.
- AppStream- Contain additional user-applications, databases, runtime language etc.
Step-1 Mount or copy your RHEL installation media
# mount /dev/sr0 /var/repo/ [ you can store in any location ] Or # mount -o loop rhel-baseos-9.0-x86_64-dvd.iso /var/repo/ [to mount ISO image of RHEL9]
Step-2 Create Repo file
Create a repo file ‘rhel9.repo’ under the folder /etc/yum.repos.d/ with following content.
# vi /etc/yum.repos.d/rhel9.repo
[BaseOS] name=RHEL9 BaseOS metadata_expire=1 gpgcheck=0 enabled=1 baseurl=file:///var/repo//BaseOS/ [AppStream] name=RHEL9 AppStream metadata_expire=1 gpgcheck=0 enabled=1 baseurl=file:///var/repo//AppStream/
Step-3 Clear DNF cache files
# yum clean all [ command clean cache o yum] or # dnf clean all # subscription-manager clean [ clean subscription manager]
Disable subscription manager
# vi /etc/yum/pluginconf.d/subscription-manager.conf
[main] enabled=0 [ edit 1 to 0, to disable subscription manager]
Step-4 Check repom list & Install RPM packages using dnf/yum
Check DNF packages configured in system
# yum repolist Or #dnf repolist
# dnf install package_name [to install a package] Example: # yum install samba [install samba services in system] # dnf update package_name [to update a package] # dnf remove package_name Example: # dnf remove samba