local repository

How to Setup Local Repository on RHEL 9.1

In this article, we will learn how to setup a local repository on RHEL 9.1 using ISO image of RHEL 9.1. You can downloads it here.

If don’t have internet connectivity, or simply you don’t have Red Hat Subscription, you can set up a local repo to install a package or a dependency that you need.


Before we begin, you should have the following :

– RHEL 9.1 installed on your server.

– RHEL 9.1 ISO File

– root access

Step 1 : Mount the RHEL 9.1 ISO file

Run the following command to mount the ISO file :

Create a directory ( Mount point) . For example, we will create a directory called « MyRepo » in / directory :

# mkdir /MyRepo

Run the following command to mount the ISO file :

# mount -o loop rhel-baseos-9.1-x86_64-dvdo /MyRepo

To verify if the ISO file is mounted, use the command df :

# df -h /MyRepo

Step 2: Create a yum repository file

Now we need to create repo file in the /etc/yum.repo.d directory and add the following content :

name=REHL 9 - BaseOS

name=RHEL 9 - AppStream

This file define the location of your local repository.

Step 3: Update the repository

Now you need to update the package index using the following command:

# yum clean all
# yum makecache

You can also use dnf command :

# dnf clean all
# dnf makecache

Step 4: Test your local repository

Verify that your local repository is working by running the following command :

# yum repolist
# dnf repolist

You should see a list of all the packages available in your local repo.

Now you local repository is available and you can install a package form it.

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *