Enable Subscription Management repositories on Redhat 8 Linux

After installation of RHEL 8, Linux package repositories need to be enabled before you are able to install new packages. Any attempt to install new software will result with the following error message:

This system has no repositories available through subscriptions.

OR

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.
Error: There are no enabled repos.

OR

This system is registered to Red Hat Subscription Management, but is not receiving updates. You can use subscription-manager to assign subscriptions.
No repositories available

In this tutorial you will learn:

  • How to Register your system to Red Hat Subscription Management.
  • How to Attach RHEL 8 subscription to your system.
  • How to Enable RHEL 8 Repository.
  • How to Disable RHEL 8 Repository.

Listing enabled Subscription Management repositories on Redhat 8 Linux

Listing enabled Subscription Management repositories on Redhat 8 Linux.

Software Requirements and Conventions Used

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Redhat 8 Linux
Software Redhat customer production or developer user credentials
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

Enable Subscription Management repositories on Redhat 8 Linux step by step instructions

Here we assume that you have just installed your Redhat 8 Linux system and wish to enable repository and have the Red Hat Enterprise Linux subscription ready.



NOTE
If you do not own a paid production Redhat subscription you can register for Red Hat Developer program which allows you to download RHEL 8 as well as register your system and enable repositories.
  1. First your system has to be registered.

    Get your customer details ready and from the command line execute the following command while providing your customer credentials:

    # subscription-manager register
    Registering to: subscription.rhsm.redhat.com:443/subscription
    Username:
    Password: 
    The system has been registered with ID: 5e3514db-51ef-4287-8168-e598f372ebc4
    The registered system name is: rhel8
    
  2. Obtain subscription Pool ID. To do so start by listing all available subscriptions:
    # subscription-manager list --available
    

    Depending on your subscription the above command will produce list of subscriptions. Look trough the subscription details and take a note of the Pool ID of the subscription package you wish to attach to your system. For example:

    Subscription Name:   Red Hat Enterprise Linux Server Beta
    Provides:            Red Hat CodeReady Linux Builder for x86_64 Beta
                         Red Hat Enterprise Linux for IBM z Systems Beta
                         Red Hat Enterprise Linux Fast Datapath Beta for Power, little endian
                         Red Hat Enterprise Linux Resilient Storage Beta
                         Red Hat Enterprise Linux for x86_64 Beta
                         Red Hat Enterprise Linux for Real Time for NFV Beta
                         Red Hat Enterprise Linux for Real Time Beta
                         Red Hat CodeReady Linux Builder for ARM 64 Beta
                         Red Hat Enterprise Linux Fast Datapath Beta for x86_64
                         Red Hat CodeReady Linux Builder for Power, little endian Beta
                         Red Hat CodeReady Linux Builder for IBM z Systems Beta
                         Red Hat Enterprise Linux High Availability Beta
                         Red Hat Enterprise Linux for Power, little endian Beta
                         Red Hat Enterprise Linux for ARM 64 Beta
    SKU:                 RH00069
    Contract:            11796656
    Pool ID:             8a85f69c671cb39701671f54cfc365cb
    Provides Management: No
    Available:           Unlimited
    Suggested:           1
    Service Level:       Self-Support
    Service Type:        L1-L3
    Subscription Type:   Standard
    Starts:              16/11/18
    Ends:                15/11/19
    System Type:         Physical
    
  3. The next step is to attach subscription. Use the Pool ID retrieved from the previous step to attach subscription to your system:
    # subscription-manager attach --pool=8a85f69c671cb39701671f54cfc365cb
    
  4. Confirm your Redhat subscription:
    [root@rhel8 ~]# subscription-manager list
    +-------------------------------------------+
        Installed Product Status
    +-------------------------------------------+
    Product Name:   Red Hat Enterprise Linux for x86_64 Beta
    Product ID:     486
    Version:        8.0 Beta
    Arch:           x86_64
    Status:         Subscribed
    Status Details: 
    Starts:         16/11/18
    Ends:           15/11/19
    
  5. At this stage some of the default repositories should be enabled. List enabled repositories by using the dnf command:
    # dnf repolist
    Updating Subscription Management repositories.
    Updating Subscription Management repositories.
    Last metadata expiration check: 0:01:59 ago on Sat 17 Nov 2018 00:05:40 EST.
    repo id                                                    repo name                                                                          status
    rhel-8-for-x86_64-appstream-beta-rpms                      Red Hat Enterprise Linux 8 for x86_64 - AppStream Beta (RPMs)                      4,594
    rhel-8-for-x86_64-baseos-beta-rpms  
    

    If all went well you should now be able to use the dnf command to install additional software on your Redhat 8 Linux system.

  6. To enable more repositories use the subscription-manager command to first list all available repositories along with their names:


    #  subscription-manager repos --list                                  
    +----------------------------------------------------------+
        Available Repositories in /etc/yum.repos.d/redhat.repo
    +----------------------------------------------------------+
    Repo ID:   rhel-8-for-x86_64-supplementary-beta-rpms
    Repo Name: Red Hat Enterprise Linux 8 for x86_64 - Supplementary Beta (RPMs)
    Repo URL:  https://cdn.redhat.com/content/beta/rhel8/8/x86_64/supplementary/os
    Enabled:   0
    
    Repo ID:   rhel-8-for-x86_64-baseos-beta-source-rpms
    Repo Name: Red Hat Enterprise Linux 8 for x86_64 - BaseOS Beta (Source RPMs)
    Repo URL:  https://cdn.redhat.com/content/beta/rhel8/8/x86_64/baseos/source/SRPMS
    Enabled:   0
    
    Repo ID:   rhel-8-for-x86_64-highavailability-beta-debug-rpms
    Repo Name: Red Hat Enterprise Linux 8 for x86_64 - High Availability Beta (Debug RPMs)
    Repo URL:  https://cdn.redhat.com/content/beta/rhel8/8/x86_64/highavailability/debug
    Enabled:   0
    
    Repo ID:   rhel-8-for-x86_64-rt-beta-debug-rpms
    Repo Name: Red Hat Enterprise Linux 8 for x86_64 - Real Time Beta (Debug RPMs)
    Repo URL:  https://cdn.redhat.com/content/beta/rhel8/8/x86_64/rt/debug
    Enabled:   0
    
    .......
    
    Repo ID:   fast-datapath-beta-for-rhel-8-x86_64-rpms
    Repo Name: Fast Datapath Beta for RHEL 8 x86_64 (RPMs)
    Repo URL:  https://cdn.redhat.com/content/beta/layered/rhel8/x86_64/fast-datapath/os
    Enabled:   0
    
    Repo ID:   rhel-8-for-x86_64-baseos-beta-debug-rpms
    Repo Name: Red Hat Enterprise Linux 8 for x86_64 - BaseOS Beta (Debug RPMs)
    Repo URL:  https://cdn.redhat.com/content/beta/rhel8/8/x86_64/baseos/debug
    Enabled:   0
    
    Repo ID:   codeready-builder-beta-for-rhel-8-x86_64-rpms
    Repo Name: Red Hat CodeReady Linux Builder Beta for RHEL 8 x86_64 (RPMs)
    Repo URL:  https://cdn.redhat.com/content/beta/rhel8/8/x86_64/codeready-builder/os
    Enabled:   0
    

    Take a note of the repository Repo ID you wish to enable/disable.

  7. Enable/Disable repository using the subscription-manager command. In this example we will enable the rhel-8-for-x86_64-nfv-beta-rpms repository:
    # subscription-manager repos --enable=rhel-8-for-x86_64-nfv-beta-rpms
    Repository 'rhel-8-for-x86_64-nfv-beta-rpms' is enabled for this system.
    

    To enable all repositories execute:

    # subscription-manager repos --enable=*
    

    To disable a specific repository execute:

    # subscription-manager repos --disable=rhel-8-for-x86_64-nfv-beta-rpms
    Repository 'rhel-8-for-x86_64-nfv-beta-rpms' is disabled for this system.