Fix "there are no enabled repos" & create local repository in RHEL 7 & 8


Written by - Deepak Prasad

this system has no repositories available through subscriptions. Solved there are no enabled repos. How to configure RHEL to perform yum install without subscription. there are no enabled repos oracle linux. centos 7 yum repository. yum repository for rhel 7. yum repository not found. yum is not working in redhat 7. how to fix there are no enabled repos in RHEL 7. redhat yum install without subscription. yum there are no enabled repos centos 7. yum repolist not showing repo. fix there are no enabled repos.

Fix "there are no enabled repos" & create local repository in RHEL 7 & 8

This article to create local repository using yum</a> and to fix "there are no enabled repos" error was written while using RHEL 7 and RHEL 8, so it is safe to say that it also fully covers CentOS 7 and 8, Fedora, Oracle Enterprise Linux and generally the whole Red Hat family of operating systems and possibly Novell’s SLES and OpenSUSE.

 

Pre-requisites for YUM Install Without Subscription

"YUM" (Yellowdog Updater, Modified) is used for installing rpms.
You must have access to the vanilla DVD of RHEL 7.X or RHEL 8.X distribution using which your respective Linux host was installed to be able to create local repository.

 

How to fix "there are no enabled repos" ?

You may encounter this error on Red Hat Linux node (RHEL 7 or RHEL8 or other RHEL distribution) which are not subscribed to satellite subscription network.

Loaded plugins: product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
There are no enabled repos.
Run "yum repolist all" to see the repos you have.
You can enable repos with yum-config-manager --enable

This means that you have not registered your Linux node with Red Hat Satellite Network. This requires a valid Red Hat Subscription which is NOT Free hence many users in their lab environment prefer to create local repository using which they can access the rpms without worrying about dependencies.

In this article I will share the steps to create local repository (offline - which means can be accessed without internet) which can be used via yum without subscription.

The error "there are no enabled repos" will be common in all variants of RHEL release, and the below provided fix of RHEL 7 will be applicable for all older RHEL releases.

 

Create Local Repository on RHEL 7

The first step is to create local repository is to copy the RHEL 7 DVD ISO to your Linux host under a temporary location.

Here I will create local repository on my RHEL 7 Linux host

rhel-7-node:/etc/yum.repos.d # cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.4 (Maipo)

Mount the RHEL 7 installation dvd on a mount point. For this article I had copied RHEL 7 ISO under /tmp. We will mount this ISO on /mnt which will act as a temporary mount point to create local yum repository.

# mount -o loop /ISS/rhel-server-7.4-x86_64-dvd.iso /mnt
mount: /dev/loop0 is write-protected, mounting read-only

OR

If you have virtually mounted the RHEL 7 ISO DVD then you can access the ISO DVD under /dev/cdrom or /dev/srX
Here this path may vary depending upon the distribution type or the available loop device so you have to manually check this. You can use lsblk or lssci command to get the mount point of RHEL 7 ISO

For example:

[root@rhel-8-node ~]# lsscsi
[0:0:0:0]    cd/dvd  VBOX     CD-ROM           1.0   /dev/sr0
[1:0:0:0]    cd/dvd  VBOX     CD-ROM           1.0   /dev/sr1
[2:0:0:0]    disk    ATA      VBOX HARDDISK    1.0   /dev/sda
[3:0:0:0]    disk    ATA      VBOX HARDDISK    1.0   /dev/sdb
[6:0:0:0]    disk    ATA      VBOX HARDDISK    1.0   /dev/sdc

Here I have two CD-ROM available /dev/sr0 and /dev/sr1.

Next I will use this path and mount it on another mount point to be able to access the content of RHEL 7 DVD so that I can create local repository.

# /mount /dev/sr0 /mnt

Now we have our RHEL 7 ISO DVD mounted on /mnt.

Next check the content of the DVD as accordingly we will prepare our yum repo file.

rhel-7-node:~ # cd /mnt

rhel-7-node:/mnt # ls -l
total 934
dr-xr-xr-x 4 root root   2048 Jul 11  2017 addons
-r--r--r-- 1 root root     56 Jul 11  2017 .discinfo
dr-xr-xr-x 3 root root   2048 Jul 11  2017 EFI
-r--r--r-- 1 root root   8266 Apr  4  2014 EULA
-r--r--r-- 1 root root   1455 Jul 11  2017 extra_files.json
-r--r--r-- 1 root root  18092 Mar  6  2012 GPL
dr-xr-xr-x 3 root root   2048 Jul 11  2017 images
dr-xr-xr-x 2 root root   2048 Jul 11  2017 isolinux
dr-xr-xr-x 2 root root   2048 Jul 11  2017 LiveOS
-r--r--r-- 1 root root    114 Jul 11  2017 media.repo
dr-xr-xr-x 2 root root 901120 Jul 11  2017 Packages
dr-xr-xr-x 2 root root   4096 Jul 11  2017 repodata
-r--r--r-- 1 root root   3375 Jun 29  2017 RPM-GPG-KEY-redhat-beta
-r--r--r-- 1 root root   3211 Jun 29  2017 RPM-GPG-KEY-redhat-release
-r--r--r-- 1 root root   1796 Jul 11  2017 TRANS.TBL
-r--r--r-- 1 root root   1900 Jul 11  2017 .treeinfo

We need to look out for "repodata" directory which means the yum repository files for "Packages" is under /mnt so this will be our baseurl.

Let me show you what this would mean. Next we need to create a repo file under /yum.repos.d

 

Create yum repository file

Now to use yum install without subscription we need a repo file. Navigate inside /etc/yum.repos.d and create a new file with ".repo" as an extension. You can give any name to the file. For this article I will use "rhel-dvd.repo"

rhel-7-node:/etc/yum.repos.d # cat rhel-dvd.repo
[rhel-7-dvd]
name = RHEL 7 ISO DVD
baseurl = file:///mnt
enabled = 1
gpgcheck = 0

Next clean the cache of any existing repo as this would lead to un-necessary failure messages while trying to use yum install without subscription

rhel-7-node:/etc/yum.repos.d # yum clean all
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: rhel-7-dvd
Cleaning up everything

Next list the available yum repository on your RHEL 7 Linux node:

rhel-7-node:/etc/yum.repos.d # yum repolist
Loaded plugins: product-id, search-disabled-repos, subscription-manager
rhel-7-dvd                                                                                     | 4.1 kB  00:00:00
(1/2): rhel-7-dvd/group_gz                                                                     | 137 kB  00:00:00
(2/2): rhel-7-dvd/primary_d                                                                    | 4.0 MB  00:00:00
repo id                           repo name                                                                status
rhel-7-dvd                        RHEL 7 ISO DVD                                                            4,986
repolist: 4,986

Now our yum repository is configured and you should not get "there are noenabled repos" error, so you can try to install any rpm (which is available in this repo) using "yum install <rpm_name>".

 

Create Local Repository on RHEL 8

Similar to RHEL 7 you must copy the RHEL ISO DVD on your RHEL 8 Linux host to use yum install without subscription under a temporary location. If you have a virtual media then you can also mount your RHEL 8 ISO to the virtual media and then later mount it on a mount point for example /mnt

Here I have a RHEL 8 Beta Linux host

[root@rhel-8-node ~]# cat /etc/redhat-release
Red Hat Enterprise Linux release 8.0 Beta (Ootpa)

Next we will mount our RHEL 8 DVD on /mnt. Since for RHEL 7 we had copied the ISO to the host, here we will perform the other scenario i.e. I have mounted RHEL 8 ISO to the virtual media and is available at /dev/sr0

So let me mount /dev/sr0 on /mnt to be able to access the RHEL 8 ISO content:

[root@rhel-8-node ~]# mount -o loop /dev/sr0 /mnt

Verify if the RHEL 8 ISO is properly mounted:

[root@rhel-8-node ~]# mount | grep mnt
/dev/sr0 on /mnt type iso9660 (ro,relatime,nojoliet,check=s,map=n,blocksize=2048)

Next check the content of the RHEL 8 ISO DVD so accordingly we will create our yum repository. As you see we do not have "repodata" directory under /mnt

[root@rhel-8-node mnt]# ls -l
total 11
dr-xr-xr-x 4 root root 2048 Nov 13  2018 AppStream
dr-xr-xr-x 4 root root 2048 Nov 13  2018 BaseOS
dr-xr-xr-x 3 root root 2048 Nov 13  2018 EFI
dr-xr-xr-x 3 root root 2048 Nov 13  2018 images
dr-xr-xr-x 2 root root 2048 Nov 13  2018 isolinux
-r--r--r-- 1 root root  442 Nov 13  2018 TRANS.TBL

But instead we have "repodata" and "Packages" under /mnt/AppStream

[root@rhel-8-node mnt]# ls -l AppStream/
total 934
-r--r--r-- 1 root root   8266 Sep 27  2018 EULA
-r--r--r-- 1 root root  18092 Sep 27  2018 GPL
dr-xr-xr-x 2 root root 915456 Nov 13  2018 Packages
dr-xr-xr-x 2 root root   2048 Nov 13  2018 repodata
-r--r--r-- 1 root root   3375 Sep 27  2018 RPM-GPG-KEY-redhat-beta
-r--r--r-- 1 root root   6636 Sep 27  2018 RPM-GPG-KEY-redhat-release
-r--r--r-- 1 root root    904 Nov 13  2018 TRANS.TBL

Similarly we have another "repodata" and "Packages" directory under /mnt/BaseOS

[root@rhel-8-node mnt]# ls -l BaseOS/
total 336
-r--r--r-- 1 root root   8266 Sep 27  2018 EULA
-r--r--r-- 1 root root  18092 Sep 27  2018 GPL
dr-xr-xr-x 2 root root 303104 Nov 13  2018 Packages
dr-xr-xr-x 2 root root   2048 Nov 13  2018 repodata
-r--r--r-- 1 root root   3375 Sep 27  2018 RPM-GPG-KEY-redhat-beta
-r--r--r-- 1 root root   6636 Sep 27  2018 RPM-GPG-KEY-redhat-release
-r--r--r-- 1 root root    904 Nov 13  2018 TRANS.TBL

The architecture of RHEL 8 DVD is different compared to RHEL 7 ISO.

 

Create yum repository file

Next we will create a yum repository file which the location of Packages under RHEL 8 ISO to be able to use yum install without subscription. Here I have created rhel_dvd.repo file with below content:

[root@rhel-8-node ~]# cat /etc/yum.repos.d/rhel_dvd.repo
[rhel_dvd_baseos]
name=rhel dvd baseos
baseurl=file:///mnt/BaseOS
enabled=1
gpgcheck=0

[rhel_dvd_appstream]
name=rhel dvd appstream
baseurl=file:///mnt/AppStream
enabled=1
gpgcheck=0

Since we have two repo location under the RHEL 8 ISO, hence we have provided two baseurl and details.

Next before we start to use yum install without subscription, let us clear the yum repository cache

[root@rhel-8-node ~]# yum 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.
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.
12 files removed

Next list the available repositories:

[root@rhel-8-node ~]# yum 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.
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: 0:00:30 ago on Sun 23 Jun 2019 05:03:45 PM IST.
repo id                                   repo name                                  status
rhel_dvd_appstream                        rhel dvd appstream                         4,594
rhel_dvd_baseos                           rhel dvd baseos                            1,686

 

YUM Alternative - DNF

You can also use "dnf" command instead of "yum" command to perform yum install without subscription. For example:

To list the available repos:

[root@rhel-8-node ~]# 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.
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: 0:01:19 ago on Sun 23 Jun 2019 05:03:45 PM IST.
repo id                                   repo name                                  status
rhel_dvd_appstream                        rhel dvd appstream                         4,594
rhel_dvd_baseos                           rhel dvd baseos                            1,686

Similarly to install a rpm along with it's dependencies use

# dnf install
NOTE:
These changes related to mount are not persistent and will be lost post reboot. To make these changes persistent across reboots you can add below line in /etc/fstab 
/dev/sr0        /mnt            iso9660         defaults        0 0

 

Lastly I hope the steps from the article to create local repository to fix "there are no enabled repos" error and to be able to use yum install without subscription on RHEL7/8 Linux was helpful. So, let me know your suggestions and feedback using the comment section.

 

Views: 79

Deepak Prasad

He is the founder of GoLinuxCloud and brings over a decade of expertise in Linux, Python, Go, Laravel, DevOps, Kubernetes, Git, Shell scripting, OpenShift, AWS, Networking, and Security. With extensive experience, he excels in various domains, from development to DevOps, Networking, and Security, ensuring robust and efficient solutions for diverse projects. You can reach out to him on his LinkedIn profile or join on Facebook page.

Can't find what you're searching for? Let us assist you.

Enter your query below, and we'll provide instant results tailored to your needs.

If my articles on GoLinuxCloud has helped you, kindly consider buying me a coffee as a token of appreciation.

Buy GoLinuxCloud a Coffee

For any other feedbacks or questions you can send mail to admin@golinuxcloud.com

Thank You for your support!!

20 thoughts on “Fix "there are no enabled repos" & create local repository in RHEL 7 & 8”

    • These steps are only meant for lab use case for new comers and learners. For production environments one should always use RHEL with proper subscription or else they will not get regular security patches. I personally recommend freshers to use CentOS but still in case some one plans to use RHEL they should know how to work their way using offline repo.

      Reply
  1. Could you please assist me learning HA on RHEL 8.0
    I have mounted 2 CD/DVD Drives on VM(1 base OS ISO, 2 HA ISO which is about 50 MB only), I want to install without subscription on VM

    Reply
  2. If using CentOS 7 should I create a local repository of RHEL 7 and the follow exactly the steps here (create a local copy of the RHEL DVD) or should I do the same thing but with the CentOS 7 DVD?

    Reply
  3. Hello
    I’ve tried to create a local repo on RHEL 8, Cenots 8 and AlmaLinux 8.
    This is my history on a brand new Centos 8 box.

    uname -r
    4.18.0-80.el8.x86_64
    cat /etc/redhat-release
    CentOS Linux release 8.0.1905 (Core)
    Filesystem      Size  Used Avail Use% Mounted on
    devtmpfs        1.9G     0  1.9G   0% /dev
    tmpfs           1.9G     0  1.9G   0% /dev/shm
    tmpfs           1.9G   10M  1.9G   1% /run
    tmpfs           1.9G     0  1.9G   0% /sys/fs/cgroup
    /dev/nvme0n1p2   25G   11G   15G  41% /
    /dev/nvme0n1p1  9.8G  162M  9.2G   2% /boot
    tmpfs           376M   20K  376M   1% /run/user/42
    tmpfs           376M  3.5M  373M   1% /run/user/0
    /dev/sr0        6.7G  6.7G     0 100% /mnt

    When I use the default repo it lists 5,059 packages under AppStream and 1,695 under BaseOS.
    Under the local repo, the output is AppStream it is 4,681 and BaseOS it’s 1,655

    My local repo file:

     cat /etc/yum.repos.d/AppStream.repo
    [AppStream]
    name=AppStream
    baseurl=file:///home/AppStream
    enabled=1
    gpgcheck=0
    
    cat /etc/yum.repos.d/BaseOS.repo
    [BaseOS]
    name=BaseOS
    baseurl=file:///home/BaseOS/
    enabled=1
    gpgcheck=0

    On my RHEL 8 box, I’ve tried using the gpg key from the RHEL 8 DVD
    When I run yum update, this is the output:

    yum update
    Warning: failed loading '/etc/yum.repos.d/CentOS-Base.repo', skipping.
    Last metadata expiration check: 0:09:50 ago on Wed 24 Mar 2021 01:10:06 PM EDT.
    Dependencies resolved.
    Nothing to do.
    Complete!

    Any feedback would be greatly appreciated.

    Reply
    • As per your df -h output I would assume that your RHEL 8 DVD is mounted on /mnt:

      /dev/sr0        6.7G  6.7G     0 100% /mnt

      while in your repo file you are referring the path of the repository as /<strong>home</strong>/BaseOS

      baseurl=file:///home/BaseOS/
      baseurl=file:///home/AppStream

      It should be /<strong>mnt</strong>/BaseOS and /<strong>mnt</strong>/AppStream ?
      Since the gpgcheck is 0 so the GPG check will not be performed and you don’t need a GPG key unless you change that value to 1.

      Reply

Leave a Comment