Recently Red Hat has released its most awaited operating system “RHEL 8“, in case you have installed RHEL 8 Server on your system and wondering how to setup local yum or dnf repository using installation DVD or ISO file then refer below steps and procedure.
In RHEL 8, we have two package repositories:
- Application Stream
BaseOS repository have all underlying OS packages where as Application Stream repository have all application related packages, developer tools and databases etc. Using Application stream repository, we can have multiple of versions of same application and Database.
Step:1) Mount RHEL 8 ISO file / Installation DVD
To mount RHEL 8 ISO file inside your RHEL 8 server use the beneath mount command,
[[email protected] ~]# mount -o loop rhel-8.0-x86_64-dvd.iso /opt/
Note: I am assuming you have already copied RHEL 8 ISO file inside your system,
In case you have RHEL 8 installation DVD, then use below mount command to mount it,
[[email protected] ~]# mount /dev/sr0 /opt
Step:2) Copy media.repo file from mounted directory to /etc/yum.repos.d/
In our case RHEL 8 Installation DVD or ISO file is mounted under /opt folder, use cp command to copy media.repo file to /etc/yum.repos.d/ directory,
[[email protected] ~]# cp -v /opt/media.repo /etc/yum.repos.d/rhel8.repo '/opt/media.repo' -> '/etc/yum.repos.d/rhel8.repo' [[email protected] ~]#
Set “644” permission on “/etc/yum.repos.d/rhel8.repo”
[[email protected] ~]# chmod 644 /etc/yum.repos.d/rhel8.repo [[email protected] ~]#
Step:3) Add repository entries in “/etc/yum.repos.d/rhel8.repo” file
By default, rhel8.repo file will have following content,
Edit rhel8.repo file and add the following contents,
[[email protected] ~]# vi /etc/yum.repos.d/rhel8.repo [InstallMedia-BaseOS] name=Red Hat Enterprise Linux 8 - BaseOS metadata_expire=-1 gpgcheck=1 enabled=1 baseurl=file:///opt/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:///opt/AppStream/ gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
rhel8.repo should look like above once we add the content, In case you have mounted the Installation DVD or ISO on different folder then change the location and folder name in base url line for both repositories and rest of parameter leave as it is.
Step:4) Clean Yum / DNF and Subscription Manager Cache
Use the following command to clear yum or dnf and subscription manager cache,
[email protected] ~]# dnf clean all [[email protected] ~]# subscription-manager clean All local data removed [[email protected] ~]#
Step:5) Verify whether Yum / DNF is getting packages from Local Repo
Use dnf or yum repolist command to verify whether these commands are getting packages from Local repositories or not.
[[email protected] ~]# dnf repolist 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. Last metadata expiration check: 1:32:44 ago on Sat 11 May 2019 08:48:24 AM BST. repo id repo name status InstallMedia-AppStream Red Hat Enterprise Linux 8 - AppStream 4,672 InstallMedia-BaseOS Red Hat Enterprise Linux 8 - BaseOS 1,658 [[email protected] ~]#
Note : You can use either dnf or yum command, if you use yum command then its request is redirecting to DNF itself because in RHEL 8 yum is based on DNF command.
If you have noticed the above command output carefully, we are getting warning message “This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register”, if you want to suppress or prevent this message while running dnf / yum command then edit the file “/etc/yum/pluginconf.d/subscription-manager.conf”, changed the parameter “enabled=1” to “enabled=0”
[[email protected] ~]# vi /etc/yum/pluginconf.d/subscription-manager.conf [main] enabled=0
save and exit the file.
Step:6) Installing packages using DNF / Yum
Let’s assume we want to install nginx web server then run below dnf command,
[[email protected] ~]# dnf install nginx
Similarly if you want to install LEMP stack on your RHEL 8 system use the following dnf command,
[[email protected] ~]# dnf install nginx mariadb php -y
This confirms that we have successfully configured Local yum / dnf repository on our RHEL 8 server using Installation DVD or ISO file.
In case these steps help you technically, please do share your feedback and comments.
Read More on : How to Install and Configure KVM on RHEL 8
8 thoughts on “How to Setup Local Yum/DNF Repository on RHEL 8 Server Using DVD or ISO File”
Your post here is very complete from .iso or DVD. We only used pieces since this wasn’t our task, but the pieces were very helpful. We had installed the latest Oracle database with unsupported product versions, and we had used two Oracle Linux repos to get the pieces we needed. After the installation one was disabled, the other left active, and it was causing problem that even Google had never recorded. No hits on the errors, not even on a Russian site. Your post here put the whole process into focus so we could fix our problem.
I recently failed in RHCSA 8 exam, one of the questions I could’t figure out was the repo.
here is my story, the URL to the repo was given. for example lets say ‘http://baserepo.com/baseos’
This is what I did:
name=Base OS RHEL 8
once I saved the file, I ran this ” yum clean all”. when I used “yum repolist” both repositories I configured were listing as normal.
however when I used ” yum install vdo” nothing happened. I was given an error message I can’t remember. any idea what could be the issue?
Thank you for your time.
First i will check whether i can reach to repository on 80 port and also check whether required network settings are configured or not. I would also recommend use dnf command instead of yum.
for RHCSA 8 exam you have to add the following line
A LOT OF THANKS!!!
I got this error. This process works before RHEL 8.
[[email protected] yum.repos.d]# yum repolist
repo id repo name
InstallMedia-AppStream Red Hat Enterprise Linux 8.2.0 – AppStream
InstallMedia-BaseOS Red Hat Enterprise Linux 8.2.0 – BaseOS
[[email protected] yum.repos.d]# yum list
Red Hat Enterprise Linux 8.2.0 – BaseOS 0.0 B/s | 0 B 00:00
Error: Failed to download metadata for repo ‘InstallMedia-BaseOS’: repomd.xml parser error: Parse error at line: 1 (Extra content at the end of the document
Nevermind. I remounted the DVD/ISO and now it works.