How To Enable Red Hat Subscription on RHEL 8

0

Red Hat subscription is a software support model followed by Red Hat for its customers. It allows customers to download software packages, patches, updates, and upgrades for Redhat Enterprise Linux. Along with the software support, customers will also get technical support for the product.

After you install Redhat Enterprise Linux 8, you need to register and enable Red Hat subscription to install any packages on the system.

If you try installing packages without registering the system with Red Hat, you will end up getting errors like below.

Enable Red Hat Subscription on RHEL 8 - System Not Subscriped Error
Enable Red Hat Subscription on RHEL 8 – System Not Subscribed Error

In this post, we will see.

How to Register RHEL 8 to Red Hat Subscription Management
How to Attach subscription to RHEL 8
How to Register and Attach subscription in RHEL 8 in a single command
How To Verify Red Hat subscription in RHEL 8
How to Enable Red Hat Repository on RHEL 8
How to Disable Red Hat Repository RHEL 8
How to Remove subscription in RHEL 8
How to Unregister Red Hat Subscription in RHEL 8

Prerequisites

An Active Red Hat subscription is required for registering the RHEL 8 systems.

Since the RHEL 8 is a beta release, you can sign up for a no-cost subscription which will allow you to download Red Hat Enterprise Linux 8 as well as register your RHEL 8 system with Red Hat for receiving packages and updates.

Keep your Red Hat subscription credentials handy for registering your RHEL 8 system to Red Hat.

Register RHEL 8 to Red Hat Subscription Management

Use the subscription-manager to register the RHEL 8 system to Red Hat.

subscription-manager register

Enter the username (email id) and password you used while signing up for Red Hat.

Enable Red Hat Subscription on RHEL 8 - Register RHEL 8 to Red Hat Subscription
Enable Red Hat Subscription on RHEL 8 – Register RHEL 8 to Red Hat Subscription
You can also register the RHEL 8 system and attach subscription to it in a single command.
subscription-manager register --username=<USER_NAME> --password=<PASSWORD> --auto-attach
Enable Red Hat Subscription on RHEL 8 - Regsiter and Attach Subscription in Single Command
Enable Red Hat Subscription on RHEL 8 – Register and Attach Subscription in Single Command

Attach subscription to RHEL 8

You can attach a subscription to RHEL 8 system either using Pool ID or --auto which lets you to attach compatible subscription to the system automatically.

Attach subscription to RHEL 8 using Pool ID

Each subscription will have unique Pool ID. Use the below command to obtain the Pool ID.

subscription-manager list --available

Output:

+-------------------------------------------+
    Available Subscriptions
+-------------------------------------------+
Subscription Name:   Red Hat Beta Access
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:            11830127
Pool ID:             8a85f99967cdbe6e01680347c03c50d0
Provides Management: No
Available:           Unlimited
Suggested:           1
Service Level:       Self-Support
Service Type:        L1-L3
Subscription Type:   Standard
Starts:              12/31/2018
Ends:                12/30/2019
System Type:         Physical

Attach a system using the Pool ID you retrieved from the previous command.

subscription-manager attach --pool=8a85f99967cdbe6e01680347c03c50d0

Output:

Enable Red Hat Subscription on RHEL 8 - Attach subscription to RHEL 8 using Pool ID
Enable Red Hat Subscription on RHEL 8 – Attach subscription to RHEL 8 using Pool ID

Attach subscription to RHEL 8 using –auto

The --auto option lets you to attach a compatible subscription to your system automatically. Just run the below command.

subscription-manager attach --auto

Output:

Enable Red Hat Subscription on RHEL 8 - Attach subscription to RHEL 8
Enable Red Hat Subscription on RHEL 8 – Attach subscription to RHEL 8

Verify Subscription on RHEL 8

List the attached subscription using the below command.

subscription-manager list

Output:

Enable Red Hat Subscription on RHEL 8 - Verify Subscription on RHEL 8
Enable Red Hat Subscription on RHEL 8 – Verify Subscription on RHEL 8

By this time, your system should have enabled few repositories by default. You can list down the enabled repositories using the yum command.

yum repolist

Output:

Enable Red Hat Subscription on RHEL 8 - Repository List
Enable Red Hat Subscription on RHEL 8 – Repository List

Enable Red Hat Repository on RHEL 8

If you see the output of the previous command, you will find only two Red Hat repositories which are enabled by the system. You can enable more repositories either running subscription-manager command or by editing the /etc/yum.repos.d/redhat.repo file.

Enable Red Hat Repository on RHEL 8 using subscription-manager

First list the all available repositories using the below command.

subscription-manager repos --list

Output:

Enable Red Hat Subscription on RHEL 8 - List Repositories
Enable Red Hat Subscription on RHEL 8 – List Repositories

Note down the Repo ID of the Red Hat repository you wish to enable.

To enable a repository, run the below command along with the Repo ID you got from the previous command. For example, we will enable the rhel-8-for-x86_64-supplementary-beta-rpms repository.

subscription-manager repos --enable=rhel-8-for-x86_64-supplementary-beta-rpms

Output:

Enable Red Hat Subscription on RHEL 8 - Enable Red Hat Repository on RHEL 8
Enable Red Hat Subscription on RHEL 8 – Enable Red Hat Repository on RHEL 8

Enable Red Hat Repository on RHEL 8 using repo file

Edit the configuration file.

vi /etc/yum.repos.d/redhat.repo

To enable a repo, change enabled=false to enabled=true and then save the file.

Enable Red Hat Subscription on RHEL 8 - Enable Red Hat Repository
Enable Red Hat Subscription on RHEL 8 – Enable Red Hat Repository

Disable Red Hat Repository on RHEL 8

You can disable one or more repositories either using subscription-manager command or by editing the /etc/yum.repos.d/redhat.repo file.

Disable Red Hat Repository on RHEL 8 using subscription-manager

To enable a repository, run the below command along with the Repo ID. For example, we will disable the rhel-8-for-x86_64-supplementary-beta-rpms repository.

subscription-manager repos --disable=rhel-8-for-x86_64-supplementary-beta-rpms

Output:

Enable Red Hat Subscription on RHEL 8 - Disable Red Hat Repository on RHEl 8
Enable Red Hat Subscription on RHEL 8 – Disable Red Hat Repository on RHEl 8

Enable Red Hat Repository on RHEL 8 using repo file

Edit the configuration file.

vi /etc/yum.repos.d/redhat.repo

To enable a repo, change enabled=true to enabled=false and then save the file.

Enable Red Hat Subscription on RHEL 8 - Disable Red Hat Repository
Enable Red Hat Subscription on RHEL 8 – Disable Red Hat Repository

Remove subscription in RHEL 8

You can remove subscriptions from your system using the below command.

Remove all subscriptions – This is the better approach for unregistering your system from the Red Hat

subscription-manager remove --all

Remove the particular subscription using Pool ID.

subscription-manager remove --pool=8a85f99967cdbe6e01680347c03c50d0

Output:

Enable Red Hat Subscription on RHEL 8 - Remove Red Hat Subscription on RHEL 8
Enable Red Hat Subscription on RHEL 8 – Remove Red Hat Subscription on RHEL 8

Unregister RHEL 8 from Red Hat Subscription Management

Before you unregister your system, consider removing all subscriptions.

Use the below command to unregister the RHEL 8 system from the Red Hat.

subscription-manager unregister

Output:

Enable Red Hat Subscription on RHEL 8 - Unregister RHEL 8 from Red Hat
Enable Red Hat Subscription on RHEL 8 – Unregister RHEL 8 from Red Hat

Finally, Remove all local system and subscription data without affecting the server.

subscription-manager clean

That’s All.

You might also like