In this article I will share the steps to register RHEL 7 with Red Hat Network (RNH) on a system configured with or without proxy server. The subscription service provides a mechanism to handle Red Hat software inventory and allows you to install additional software or update already installed programs to newer versions using the yum package manager. In Red Hat Enterprise Linux 7 the recommended way to register your system and attach subscriptions is to use Red Hat Subscription Manager.

Register RHEL 7 host to RHN using subscription manager (with or without proxy)

 

Register RHEL 7 using Subscription Manager

Complete the following steps to register RHEL 7 system with RHN Satellite and attach one or more subscriptions using Red Hat Subscription Manager. Note that all subscription manager commands are supposed to be run as root.

We are using Red Hat 7.4 to demonstrate the steps from this article.

rhel-7:~ # cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.4 (Maipo)

 

Set Up RHSM with Proxy

Below steps are to be performed if you need to use an HTTP Proxy such as squid to connect to Red Hat Subscription Manager, or Red Hat Satellite. In such case by default the subscription manager will not be able to connect to Red Hat Satellite Network to register the system. Hence we will configure subscription manager configuration file (/etc/rhsm/rhsm.conf)

Modify the below highlighted values with your proxy server details

[server]
# an http proxy server to use
proxy_hostname = <ip or fqdn>

# port for http proxy server
proxy_port = <network port in use (often 3128 or 8080)>

# user name for authenticating to an http proxy, if needed
proxy_user = <http proxy username (if required)>

# password for basic http proxy auth, if needed
proxy_password = <http proxy password (if required)>

 

Set Up RHSM with no-proxy

If your system is by default configured with proxy while you do not wish to use the proxy server to register system then there are two possible options

  1. set “no_proxy=*” in /etc/rhsm/rhsm.conf or
  2. alternatively you can also register RHEL 7 system with subscription-manage using an additional argument --server.no_proxy=*

 

Register RHEL 7 System via CLI

Run the following command to register your system. You will be prompted to enter your user name and password. Note that the user name and password are the same as your login credentials for Red Hat Customer Portal.

rhel-7:~ # subscription-manager register
Registering to: subscription.rhsm.redhat.com:443/subscription
Username: deepak
Password:
The system has been registered with ID: 5288cdcf-6d0f-419a-b531-037a3821d4325

After this, refresh the information on your machine using the following command. Be sure to run this any time you add or change the attached subscription from the Customer Portal:

rhel-7:~ # subscription-manager refresh
All local data refreshed

List the available subscription to which your system is registered. Since currently we have not applied any subscription to our RHEL 7 system hence it says “Not Subscribed

rhel-7:~ # subscription-manager list

+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+
Product Name:   Red Hat Enterprise Linux Server
Product ID:     69
Version:        7.6
Arch:           x86_64
Status:         Not Subscribed
Status Details: Not supported by a valid subscription.
Starts:
Ends:

Next list all the available subscription on Red Hat Satellite

rhel-7:~ # subscription-manager list --available --all
+-------------------------------------------+
    Available Subscriptions
+-------------------------------------------+

Subscription Name:   Red Hat Enterprise Linux Server (1-2 sockets) (Unlimited guests) - Embedded Partner Support
Provides:            dotNET on RHEL Beta (for RHEL Server)
                     Red Hat Beta
                     Oracle Java (for RHEL Server)
                     Red Hat Enterprise Linux Server
                     Red Hat Software Collections Beta (for RHEL Server)
                     Red Hat CodeReady Linux Builder for x86_64
                     Red Hat Enterprise Linux for x86_64
                     Red Hat Ansible Engine
                     dotNET on RHEL (for RHEL Server)
SKU:                 RH0175705
Contract:            11597330
Pool ID:             8a85f98d67c1bf370167acd80186288c
Provides Management: No
Available:           29
Suggested:           1
Service Level:       Premium
Service Type:        PSF
Subscription Type:   Stackable
Ends:                12/10/2019
System Type:         Physical

 

 

Attach a specific subscription

After registration, use the following command to attach a subscription from a specific pool. You can get the POOL ID from the output of “subscription-manager list --available --all” command.

rhel-7:~ # subscription-manager attach --pool=8a85f98d67c1bf370167acd80186288c
Successfully attached a subscription for: Red Hat Enterprise Linux Server (1-2 sockets) (Unlimited guests) - Embedded Partner Support

 

Register RHEL 7 system via GUI

Alternately you can also register RHEL 7 using the GUI version of subscription manager.

# subscription-manager-gui

 

Verify the Subscription Registration

Now since our RHEL 7 system is registered, we can verify the same using below command:

rhel-7:~ # subscription-manager list

+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+
Product Name:   Red Hat Enterprise Linux Server
Product ID:     69
Version:        7.6
Arch:           x86_64
Status:         Subscribed
Status Details:
Starts:         12/10/2018
Ends:           12/10/2019

The identity command with subscription manager handles the UUID of a system, which identifies the system to the subscription management service after registration.

rhel-7:~ # subscription-manager identity
system identity: 5288cdcf-6d0f-419a-b531-0a363821dfa2
name: rhel-7
org name: 7028599
org ID: 7028599

 

List Red Hat Subscribed Repositories

Now since our Red Hat subscription is in place, let us verify the list of available repositories. This can be performed using yum package manager. before starting perform a clean up of all the available cache repositories

rhel-7:~ # yum clean all
Loaded plugins: product-id, search-disabled-repos, subscription-manager
Cleaning repos: rhel-7-dvd rhel-7-server-rpms
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos

rhel-7:~ # rm -rf /var/cache/yum

Next list the available repositories which are part of your subscription.

rhel-7:~ # yum repolist
Loaded plugins: product-id, search-disabled-repos, subscription-manager
rhel-7-dvd                                                                                                                                      | 4.1 kB  00:00:00
rhel-7-server-rpms                                                                                                                              | 3.5 kB  00:00:00
(1/5): rhel-7-dvd/group_gz                                                                                                                      | 137 kB  00:00:00
(2/5): rhel-7-dvd/primary_db                                                                                                                    | 4.0 MB  00:00:00
(3/5): rhel-7-server-rpms/7Server/x86_64/updateinfo                                                                                             | 3.2 MB  00:00:01
(4/5): rhel-7-server-rpms/7Server/x86_64/group                                                                                                  | 774 kB  00:00:01
(5/5): rhel-7-server-rpms/7Server/x86_64/primary_db                                                                                             |  57 MB  00:00:07
repo id                                                                      repo name                                                                           status
rhel-7-dvd                                                                   RHEL 7 ISO DVD                                                                       4,986
rhel-7-server-rpms/7Server/x86_64                                            Red Hat Enterprise Linux 7 Server (RPMs)                                            24,397
repolist: 29,383

Now the above command only gives the list of enabled repositories. But to get the list of all the available repositories use below command:

rhel-7:~ # subscription-manager repos --list
+----------------------------------------------------------+
    Available Repositories in /etc/yum.repos.d/redhat.repo
+----------------------------------------------------------+
Repo ID:   rhel-7-server-dotnet-debug-rpms
Repo Name: dotNET on RHEL Debug RPMs for Red Hat Enterprise Linux 7 Server
Repo URL:  https://cdn.redhat.com/content/dist/rhel/server/7/$releasever/$basearch/dotnet/1/debug
Enabled:   0

Repo ID:   rhel-7-server-insights-3-debug-rpms
Repo Name: Red Hat Insights 3 (for RHEL 7 Server) (Debug RPMs)
Repo URL:  https://cdn.redhat.com/content/dist/rhel/server/7/7Server/$basearch/insights/3/debug
Enabled:   0

<output trimmed>

Repo ID:   rhel-7-server-openstack-7.0-tools-source-rpms
Repo Name: Red Hat OpenStack Tools 7.0 for Red Hat Enterprise Linux 7 Server (Source RPMs)
Repo URL:  https://cdn.redhat.com/content/dist/rhel/server/7/$releasever/$basearch/openstack-tools/7.0/source/SRPMS
Enabled:   0

Repo ID:   rhel-7-server-optional-beta-rpms
Repo Name: Red Hat Enterprise Linux 7 Server - Optional Beta (RPMs)
Repo URL:  https://cdn.redhat.com/content/beta/rhel/server/7/$basearch/optional/os
Enabled:   0

 

Enable repository

To enable a repository, enter a command as follows:

# subscription-manager repos --enable <repository>

Replace repository with the name of the repository to enable.

 

Disable repository

Similarly, to disable a repository, use the following command:

# subscription-manager repos --disable <repository>

 

Lastly I hope the steps from the article to register RHEL 7 to Red hat Satellite Network using Subscription Manager (with and without proxy) was helpful. So, let me know your suggestions and feedback using the comment section.

 

References:
Red Hat Subscription Management

Leave a Reply

Your email address will not be published. Required fields are marked *