Setting up a repository from a DVD or ISO

Nov 1, 2025

Sometimes it can be necessary to set up a local repository, with the packages from the installation DVD.

Step one is to download the ISO and mount it. We can download the ISO file with wget

wget <file link>

We now need to create a directory for the ISO file to be mounted to.

mkdir -p /mnt/disc

## for ISO, do this:
mount -o loop <iso file> /mnt/disc

## if we have the dvd in the drive, do this:
mount /dev/sr0 /mnt/disc

If mounted correctly, the system should give a warning, that /mnt/disc is mounted as read only.

We now need to create a .repo file, that tells yum/dnf where the repo files are located.

vim /etc/yum.repos.d/rhel9dvd.repo

[BaseOS]
name=BaseOS Packages Red Hat Enterprise Linux 9
metadata_expire=-1
gpgcheck=1
enabled=1
baseurl=file:///mnt/disc/BaseOS/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[AppStream]
name=AppStream Packages Red Hat Enterprise Linux 9
metadata_expire=-1
gpgcheck=1
enabled=1
baseurl=file:///mnt/disc/AppStream/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

The different fields meanings:

Once the repository file has been created, we need to clean the yum/dnf cache, and then we can show the repo list, to make sure our repository is shown.

yum clean all
yum repolist

Updating Subscription Management repositories.
repo id                                                         repo name
AppStream                                                       AppStream Packages Red Hat Enterprise Linux 9 (LOCALHOST)
BaseOS                                                          BaseOS Packages Red Hat Enterprise Linux 9 (LOCALHOST)
rhel-9-for-x86_64-appstream-rpms                                Red Hat Enterprise Linux 9 for x86_64 - AppStream (RPMs)
rhel-9-for-x86_64-baseos-rpms                                   Red Hat Enterprise Linux 9 for x86_64 - BaseOS (RPMs)

if we get no errors, we can install packages from the newly created repositories with yum/dnf.