After the last tutorial on minimal installation of Red Hat Enterprise 9.4, it’s time to register your system to the Red Hat Subscription Service, enable your system repositories, and perform a full system update.
The subscription service is responsible for identifying registered systems and the products installed on them. The local Subscription Manager service tracks installed software products, and available and used subscriptions, and communicates with the Red Hat Customer Portal using tools like dnf and subscription-manager.
This tutorial guides you through tasks like registering a new RHEL 9.4 system, activating a subscription, enabling repositories, and performing a system update.
Step 1: Register and Active Red Hat Subscription
1. To register your system to Customer Portal Subscription Management use the following command followed by the credentials used to login to Red Hat Customer Portal.
subscription-manager register --username your_username --password your_password
NOTE: After the system is successfully authenticated an ID will be displayed on your prompt for your system.
2. To get a list of all your available subscriptions use the list switch and note down the Subscription Pool ID that you want to active on your system.
subscription-manager list -available
3. To activate a subscription use the Subscription Pool ID, but be aware that when purchasing one, it is valid for a specified period of time, so make sure you buy a new period of time before expiring.
Because this system is for tests, I only use the 30-day Self-Supported RHEL free subscription. To activate a subscription use the following command.
subscription-manager subscribe --pool=Pool ID number
Replace Pool ID number
with the actual Pool ID of the subscription you want to use.
4. To get the status of your consumed subscriptions use the following command.
subscription-manager list --consumed
5. To check your enabled subscriptions use the below command.
subscription-manager list
6. If you want to remove all your active subscriptions use --all
argument or just provide a subscription serial if you want to remove a specific pool only.
subscription-manager remove --all subscription-manager unsubscribe --serial=Serial number
7. To list the available service levels on your RHEL system use the following command and if you want to set your desired level use the switch --set
on service-level command.
subscription-manager service-level --list subscription-manager service-level --set=self-support
Step 2: Enable Yum Repositories
8. After your system has been registered to Red Hat Customer Portal and a Subscription has been activated in your system you can start listing and enabling system Repositories.
To get a list of all your provided repositories through a certain subscription use the following command.
subscription-manager repos --list
NOTE: A long repositories list should appear and you can status to see if certain repositories are enabled (the ones with 1 on Enabled).
9. A more simple output the command yum repolist all should generate through, and you can, also, verify if certain repos are enabled.
yum repolist all
10. To view only the enabled system repositories use the following command.
yum repolist
11. Now if you want to enable a certain repo on your system, open /etc/yum.repos.d/redhat.repo file and make sure you change the line enabled from 0 to 1 on every specific repo you want to activate.
vi /etc/yum.repos.d/redhat.repo
NOTE: Here I’ve enabled RHEL 9 Server Optional RPMs repositories which I will need later to install some important PHP modules on a LAMP server.
12. After you edit the file and enable all your needed repositories using the procedure above, run yum repolist all or just yum repolist, again to verify the repos status like in the screenshots below.
yum repolist all
Step 3: Full Update RHEL 9
13. After everything concerning subscriptions and repositories has been set, upgrade your system to make sure your system has the latest packages, kernels, and security patches up to date, issuing the following command.
dnf update
That’s all! Now your system is up to date and you can start performing another important task like starting to build a complete web environment for productions by installing all the necessary software packages, which will be covered in future tutorials.
I am getting the error as “subscription-manager command not found” when I run “subscription-manager refresh“.
how I can exit from black screen?
Matei in Centos we were receiving this error.
“User cannot register with any organizations”
until we executed
subscription-manager register –username your_username –password your_password –auto-attach
@Roman,
It seems you don’t have a RedHat subscription, means you can’t register your system to RedHat network repository.
I actually had a username registered but still got that error. It wasn’t until I used the –auto-attach parameter that it worked as expected.
@Roman,
I didn’t noticed that
–auto-attach
parameter in the command you posted, anyways thats great it worked for you finally..:)I know it’s away from topic but can you tell me the way to install graphics header file in red hat,
After 1st step it is showing
my_username cannot register to any organizations.
what’s the problem
Have you registered and purchased a RHEL subscription?
There is an error in the code for listing all the services
you have “-available” but in the print screen you have “–available”
Please look into resolving that – Cheers.
Great blog otherwise.
@Nic,
Thanks for pointing out that typo, corrected in the write up..
do you have to register the core edition of centos 7? I used the minimal installation disk from the online centos source page. it does not a redhat any where in the boot up. is that still consider redhat to..
@Patrick,
Only RedHat distributions needs to be registered to RedHat subscription to get package updates, CentOS distributions is free and doesn’t required any registration to get package updates..
For this subscription, Redhat will deduct the amount?
@Dilshath,
Yes, they have yearly RedHat subscription plans, you need check out official RedHat subscription page to know more about it..
Hi Matei nice tutorial, l have redhat 7.2 and l need repos for rhscl for installing php55, but seems not to find them, can you help me how to get those repository ?
@Theluli,
First enable epel repository and then fire up the following command to install PHP 5.5 using epel repository.
Simple as that, no! The packages will remain installed on your system forever and ever, unless you manually choose to uninstall them! Feel free to upgrade the system, but after that month support, you wont be able to upgrade packages anymore!
Hi Matei,
Thank you for the detailed post. If I subscribe 30 Day Self-Supported RHEL free subscription, can I upgrade my system to latest version? and what will happen after one month? all the packages that I have installed in system will lost?