Red Hat subscription model is a software support model that allows Red Hat to manage their customers.
It allows customers to download Red Hat tested and certified enterprise software packages, patches, updates, and upgrades for Redhat Enterprise Linux.
In addition to software support, customers will also receive technical support for the product and vast knowledge base articles.
Red Hat Subscription Management (RHSM) is a customer-driven solution that allows users to track their subscription quantity and consumption.
In this guide, we’ll show how to register or un-register a new Red Hat Enterprise Linux system to the Customer Portal using Red Hat subscription-manager.
Prerequisites
Make sure that you have an Active Red Hat subscription to download Red Hat Enterprise Linux and register your system with Red Hat.
Register and Enable Red Hat subscription
Once you have Red Hat Enterprise Linux installed, you must register and enable Red Hat Subscription to install any package on your system.
If no, you will get the following error message when trying to install any software on the system without registering the system with Red Hat.
# yum repolist Updating Subscription Management repositories. Unable to read consumer identify This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. No repositories available
Red Hat subscription can be managed in two ways either a Red Hat Customer Portal or a Red Hat Satellite, but in this guide we will use the Customer Portal to manage the subscription.
Use the ‘subscription-manager’ command to register your computer with Red Hat: This requires the ‘username (email id)’ and ‘password’ used to sign in with the custom portal.
# subscription-manager register Registering to: subscription.rhsm.redhat.com:443/subscription Username: [email protected] Password: The system has been registered with ID: a234re3a-9hr2-5e4i-3cw0-gpp7xvbm5f65 The registered system name is: rhel8.2daygeek.local
After registration, you need to enable the subscription by running the below command:
# subscription-manager attach --auto Installed Product Current Status: Product Name: Red Hat Enterprise Linux for x86_64 Status: Subscribed
You can register and enable subscription at once by using the below command:
# subscription-manager register --username=[USER_NAME] --password=[PASSWORD] --auto-attach
Whenever you add or change the attached subscription, run: This command refresh the information on your system.
# subscription-manager refresh
Attach a subscription with a specific pool
If you want to attach a subscription with a specific pool, follow the below procedure:
To do so, you should have a “Pool ID” (It’s unique), run the following command to obtain the Pool ID.
# subscription-manager list --available --all +-------------------------------------------+ 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: RH02165 Contract: 11375901 Pool ID: 4r95p77j8jg2w7ro194vmx922b0610x7 Provides Management: No Available: 2 Suggested: 1 Service Level: Self-Support Service Type: L1-L3 Subscription Type: Instance Based Starts: 06/17/2021 Ends: 07/16/2022 System Type: Physical
To attach a subscription using pool id, run:
# subscription-manager attach --pool=4r95p77j8jg2w7ro194vmx922b0610x7 Successfully attached a subscription for: 30 Day Red Hat Enterprise Linux Server Self-Supported Evaluation
Verifying Subscription
List of attached subscription can be verified by running the below command:
# subscription-manager list +-------------------------------------------+ Installed Product Status +-------------------------------------------+ Product Name: Red Hat Enterprise Linux for x86_64 Product ID: 530 Version: 8.0 Arch: x86_64 Status: Subscribed Status Details: Starts: 06/17/2021 Ends: 07/16/2022
List enabled YUM repositories
By default, it enables only few core repositories and those can be listed by running the below command:
# yum repolist enabled repo id repo name status rhel-8-for-x86_64-appstream-rpms Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs) 5,650 rhel-8-for-x86_64-baseos-rpms Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs) 2,300 repolist: 7,950
To list available repositories, run:
# subscription-manager repos --list
To enable a repository, run: For instance, to enable codeready repository, run:
# subscription-manager repos --enable=codeready-builder-for-rhel-8-x86_64-rpms
To disable the codeready repository, run:
# subscription-manager repos --disable=codeready-builder-for-rhel-8-x86_64-rpms
Unregistering a system from the Red Hat
Remove all subscriptions,run:
# subscription-manager remove --all 1 local certificate has been deleted. 1 subscription removed at the server.
To unregister the system from the Red Hat, run:
# subscription-manager unregister Unregistering from: subscription.rhsm.redhat.com:443/subscription System has been unregistered.
To remove all local data from the system, run:
# subscription-manager clean All local data removed
Conclusion
In this guide, we’ve shown you how to enable RHEL Subscription on the Red Hat system.
If you have any questions or feedback, feel free to comment below.