Red Hat / CentOS

How To Enable Red Hat Subscription on RHEL 8

How To Enable Red Hat Subscription on RHEL 8

How To Enable Red Hat Subscription on RHEL 8

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 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.

How To Enable Red Hat Subscription on RHEL 8

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
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 or you can sign up for 30 days trial 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.

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

Output:

How To Enable Red Hat Subscription on RHEL 8

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:   30 Day Red Hat Enterprise Linux Server Self-Supported Evaluation
Provides:            Red Hat Beta
                     Oracle Java (for RHEL Server)
                     Red Hat Enterprise Linux Server
                     Red Hat CodeReady Linux Builder for x86_64
                     Red Hat Enterprise Linux for x86_64
                     Red Hat Ansible Engine
                     Red Hat Container Images Beta
                     Red Hat Enterprise Linux Atomic Host Beta
                     Red Hat Enterprise Linux Atomic Host
                     Red Hat Container Images
SKU:                 RH00065
Contract:            11967947
Pool ID:             8a85f99a6bf5e7fa016bfe828c0460a9
Provides Management: No
Available:           2
Suggested:           1
Service Level:       Self-Support
Service Type:        L1-L3
Subscription Type:   Instance Based
Starts:              07/17/2019
Ends:                08/15/2019
System Type:         Physical

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

# subscription-manager attach --pool=8a85f99a6bf5e7fa016bfe828c0460a9

Output:

How To Enable Red Hat Subscription on RHEL 8

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:

How To Enable Red Hat Subscription on RHEL 8

Verify Subscription on RHEL 8

List the attached subscription using the below command.

# subscription-manager list

Output:

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

# yum repolist

Output:

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:

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 codeready-builder-for-rhel-8-x86_64-rpms repository.

# subscription-manager repos --enable=codeready-builder-for-rhel-8-x86_64-rpms

Output:

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=0 to enabled=1 and then save the file.

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 codeready-builder-for-rhel-8-x86_64-rpms repository.

# subscription-manager repos --disable=codeready-builder-for-rhel-8-x86_64-rpms

Output:

Disable 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=1 to enabled=0 and then save the file.

How To Enable Red Hat Subscription on RHEL 8

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=8a85f99a6bf5e7fa016bfe828c0460a9

Output:

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:

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

# subscription-manager clean

Conclusion

That’s All. I hope you have learned how to enable subscription on RHEL 8. Share your feedback in the comments section

About the author

Amy Gorrell

Amy Gorrell

Amy is a content writer at ERROR HAT. She has years of experience in business and marketing. She also loves technology-related topics. Apart from writing, love to read and watch movies.

Add Comment

Click here to post a comment