0% found this document useful (0 votes)
269 views

RedHat Subscription Manager - Unix in Depth PDF

1. RedHat Subscription Manager (RHSM) tracks installed products and subscriptions on a local system. It works with tools like YUM to handle registration and subscriptions. 2. RHSM supports RHEL 5.7 and newer. It can register systems online by connecting to RedHat servers, or offline by importing certificate files downloaded from RedHat portal. 3. Restoring a registration can be done using the original system UUID, which can be found on the RedHat portal or via the "subscription-manager identity" command.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
269 views

RedHat Subscription Manager - Unix in Depth PDF

1. RedHat Subscription Manager (RHSM) tracks installed products and subscriptions on a local system. It works with tools like YUM to handle registration and subscriptions. 2. RHSM supports RHEL 5.7 and newer. It can register systems online by connecting to RedHat servers, or offline by importing certificate files downloaded from RedHat portal. 3. Restoring a registration can be done using the original system UUID, which can be found on the RedHat portal or via the "subscription-manager identity" command.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

1/2/2020 RedHat Subscription Manager: Unix In Depth

Home Operating System Virtulization Clustering Storage Scripting Networking Database Miscellaneous Contact Us

Recent write-ups

RedHat PXE boot

RedHat Subscription Manager (RHSM) Installation


RedHat 6 to RedHat
upgrade
Solaris zpool
RedHat ReaR
RedHat Subscription manager is a service which tracks all installed products and RedHat Patching
subscriptions on a local system. Subscription manager works in conjunction with RedHat Subscriptio
Manager
management tools such as YUM. RHSM handles both registration and subscriptions.
redhat installation
Linux Multipathing
redhat rpm
1. Features Upgrading RedHat
minor release
RedHat yum
Handles both registration and subscription process. RedHat yum cheat
sheet
RHEL versions 5.7 and newer are supported.
zfs cheat sheet
RHSM tools are always run as root user. zfs
RHSM comes with an UI and CLI based clients.
All the machines running on RHN classic should be migrated to RHSM.

2. Prerequisites

A Red Hat server running 5.7 and above.


Internet connection on the server to connect Red Hat and get updates.
Valid Red Hat Credentials.

3. Registering a System

3.1 Registering an online system:

Let's register a machine which has internet connectivity and to register a machine use
"subscription-manger" command.
[root@jumpbox~]# subscription-manager register --username <email address> --password 'secret'
Registering to: subscription.rhn.redhat.com:443/subscription
The system has been registered with ID: bbfaf1-3b23-4943-8a8b-4r

Or else we can just use "subscription-manger register" and key in the username and
password when prompted.
[root@jumpbox~]# subscription-manager register
Registering to: subscription.rhn.redhat.com:443/subscription
Username: <username>
Password:
The system has been registered with ID: e1029b-75fe-4b8-b2b7-08ac831

3.2 Registering an offline system:

Registration process can be bifurcated to two parts, first one is to register a machine and
create an entry on the subscription service and the second one is to copy the necessary cert
files and configure the server but for a offline registration we have to manually register a
machine on the RedHat portal rather than depending on subscription manager and then we
need to import the required pem files on to the server.

www.unixindepth.com/p/rhsm.html 1/10
1/2/2020 RedHat Subscription Manager: Unix In Depth

Login to RedHat customer portal and navigate to systems then after click on "New" to
register a machine.

Now key in your hardware details and click create.

So once machine is created we need to assign a valid subscription for this navigate to
"systems" again and click on the newly created machine and navigate to "subscriptions"
tab.Click on "Attach subscriptions"

Select you subscription and click "Attach Subscriptions".

www.unixindepth.com/p/rhsm.html 2/10
1/2/2020 RedHat Subscription Manager: Unix In Depth

Once the subscriptions are attached we can see "Download Certificates" button click on it to
download the certificates.

Now copy the zip file to the server and try to unzip it.when unzipped it will create
consumer_export.zip and try to even unzip this file then go to
export/entitlement_certificates folder.
[root@jumpbox cert]# unzip 1291764e-1ec7-48db-862f-4a236a01_certificates.zip
Archive: 1291764e-1ec7-48db-862f-4a236a01_certificates.zip
signed Candlepin export for 1291764e-1ec7-48db-862f-4a236a01
inflating: consumer_export.zip
inflating: signature

[root@jumpbox cert]# unzip consumer_export.zip


Archive: consumer_export.zip
Candlepin export for 1291764e-1ec7-48db-862f-fa504a236a01
inflating: export/entitlement_certificates/6699705473164516143.pem
inflating: export/meta.json

[root@jumpbox cert]# cd export/


[root@jumpbox export]# ls
entitlement_certificates meta.json
[root@jumpbox export]# cd entitlement_certificates/

[root@jumpbox entitlement_certificates]# ls
1258361295534975836.pem 6965237657922911947.pem

Import the pem certificates using subscription manager.


[root@jumpbox ~]# subscription-manager import --
certificate=/root/cert/export/entitlement_certificates/1258361295534975836.pem --

www.unixindepth.com/p/rhsm.html 3/10
1/2/2020 RedHat Subscription Manager: Unix In Depth
certificate=/root/cert/export/entiitlement_certificates/6965237657922911947.pem
Successfully imported certificate 1258361295534975836.pem
Successfully imported certificate 6965237657922911947.pem

Now run the subscription manager to check the status and the status will be Unknown as
the system is offline.
[root@jumpbox ~]# subscription-manager status
+-------------------------------------------+
System Status Details
+-------------------------------------------+
Overall Status: Unknown

4. Restoring a Registration

At times we may loose registration and subscription information due to hardware failures or
for any other reason in such scenarios we can restore the information by using the original
system UUID.

UUID of a system can be found using either RedHat portal or run "subscription-manager
identity" command.
[root@jumpbox ~]# subscription-manager identity
system identity: 135e20bf-acd3-4232-ab97-5eabeb
name: jumpbox.homelabs.com
org name: 7240
org ID: 7240

I have reinstalled a new machine and i will be using the same system ID to register this new
machine.
[root@jumpbox ~]# subscription-manager register --username <email> --password <secret> --
consumerid=135e20bf-acd3-4232-ab97-5eabeb
The system has been registered with ID: 135e20bf-acd3-4232-ab97-5eabeb

By this we can register a new machine using the existing UUID also please make sure that
the original machine entry exists on the RedHat customer portal.

5. Subscriptions

A Subscription is a list of products purchased and the resulting subscription contains all the
details (support level,validity,contract number etc...) of the product purchased.So once a
machine is registered we need to attach a valid subscription.

5.1. List Available Subscriptions:


[root@jumpbox~]# subscription-manager list --available
+-------------------------------------------+
Available Subscriptions
+-------------------------------------------+
Subscription Name: Red Hat Enterprise Linux Developer Suite
Provides: Red Hat Software Collections (for RHEL Server)
Note down the pool ID as it will be used in attaching a subscription to a machine.

5.2. Attach a  Subscription:


[root@jumpbox~]# subscription-manager attach --pool=5ca61ce74639a1
Successfully attached a subscription for: Red Hat Enterprise Linux Developer Suite

5.3. Auto Attach a Subscriptions:


subscription manager will decide and assign a best available subscription.
[root@jumpbox~]# subscription-manager attach --auto

Installed Product Current Status:


Product Name: Red Hat Enterprise Linux Server
Status: Subscribed

5.4. List consumed Subscriptions:


[root@jumpbox~]# subscription-manager list --consumed
+-------------------------------------------+

www.unixindepth.com/p/rhsm.html 4/10
1/2/2020 RedHat Subscription Manager: Unix In Depth
Consumed Subscriptions
+-------------------------------------------+
Subscription Name: Red Hat Enterprise Linux Developer Suite
Provides: Red Hat Software Collections (for RHEL Server)

5.5. Remove a Subscription:


[root@jumpbox~]# subscription-manager remove --serial=6997329561434
Serial numbers successfully removed at the server:
6997329561434
1 local certificate has been deleted.
You can get the serial number of a subscription by running "subscription-manager list --
consumed"

5.6. Remove all Subscriptions:


[root@jumpbox~]# subscription-manager remove --all
1 subscription removed at the server.
1 local certificate has been deleted.

5.7. Stacking Subscriptions:


For every occurrence of an element there should be a valid subscription for example RedHat
by default supports a socket pair and if there are four sockets then we need two
subscriptons.
[root@jumpbox~]# subscription-manager attach --pool =8a85f9815c437914b87 --quantity =2
Successfully attached a subscription

6. Setting a preferred Release version 

We need to make sure that our systems are up to date and for this we will have to run "yum
update" but the administrators cannot simply run "yum update" as this will update the
machine to the latest minor version.So to avoid this we will have to set our preferred
release version.

By setting a preferred release version subscription manager limits the system to access the
repositories associated with that O.S version instead of automatically using the newest
version.

For example i am using RedHat 7.2 and if i set my release preference to 7.3 then the
machine will be receiving packages,updates and errata of RedHat 7.3 by this we will be
locking our machines to preferred version.

6.1. List available Operating System releases:


[root@jumpbox~]# subscription-manager release --list
+-------------------------------------------+
Available Releases
+-------------------------------------------+
7.0
7.1
7.2
7.3
7.4
7Server

6.2. Set a preferred release:


[root@jumpbox~]# subscription-manager release --set=7.3
Release set to: 7.3

6.3. Removing a release preference: 


[root@jumpbox~]# subscription-manager release --unset
Release preference has been unset

7. Worknig with YUM Repositories 

www.unixindepth.com/p/rhsm.html 5/10
1/2/2020 RedHat Subscription Manager: Unix In Depth

As soon as a machine is attached to a subscription it will be connected to different content


repositories based on the environment and the subscription levels. So we can enable/disable
these repos based on our requirements.

7.1. List available repositories: 


[root@jumpbox~]# 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
output truncated....

If you observe the output each repository will have a keyword "Enabled" and if the Enabled
value is set to "0" then the repository is considered to be disabled and if the value is set to
"1" then the repository is considered to be enabled.

7.2. Enabling repositories: 


[root@jumpbox ~]# subscription-manager repos --enable rhel-7-server-dotnet-debug-rpms
Repository 'rhel-7-server-dotnet-debug-rpms' is enabled for this system.
Where "rhel-7-server-dotnet-debug-rpms" is the "Repo ID" of a particular repo.

7.3. Disabling repositories: 


[root@jumpbox ~]# subscription-manager repos --disable rhel-7-server-dotnet-debug-rpms
Repository 'rhel-7-server-dotnet-debug-rpms' is disabled for this system.

7.4. List all enabled repositories: 


[root@jumpbox ~]# subscription-manager repos --list-enabled
+----------------------------------------------------------+
Available Repositories in /etc/yum.repos.d/redhat.repo
+----------------------------------------------------------+
Repo ID: rhel-7-server-rt-beta-rpms
Repo Name: Red Hat Enterprise Linux for Real Time Beta (RHEL 7 Server) (RPMs)
Repo URL: https://cdn.redhat.com/content/beta/rhel/server/7/$basearch/rt/os
Enabled: 1

Repo ID: rhel-7-server-rpms


Repo Name: Red Hat Enterprise Linux 7 Server (RPMs)
Repo URL: https://cdn.redhat.com/content/dist/rhel/server/7/$releasever/$basearch/os
Enabled: 1

7.5. List all disabling repositories: 


[root@jumpbox ~]# subscription-manager repos --list-disabled
+----------------------------------------------------------+
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-satellite-tools-6.2-rpms


Repo Name: Red Hat Satellite Tools 6.2 (for RHEL 7 Server) (RPMs)
Repo URL: https://cdn.redhat.com/content/dist/rhel/server/7/7Server/$basearch/sat-tools/6.2/os
Enabled: 0

8. Configuring Subscription Manager 

So far we have been discussing on how subscription manager works but now we will learn
how to configure subscription manager.

8.1. RHSM files and directories:


Configuration files of RHSM will be found in /etc/rhsm directory and the primary
configuration file is /etc/rhsm/rhsm.conf and system facts will saved in
/etc/rhsm/facts folder.

www.unixindepth.com/p/rhsm.html 6/10
1/2/2020 RedHat Subscription Manager: Unix In Depth
[root@jumpbox ~]# pwd
/etc/rhsm
[root@jumpbox ~]# ls -ltr
total 8
drwxr-xr-x. 2 root root 6 Oct 13 2015 facts
-rw-r--r--. 1 root root 1659 Oct 13 2015 rhsm.conf
drwxr-xr-x. 2 root root 6 Oct 13 2015 pluginconf.d
-rw-r--r--. 1 root root 1492 Oct 13 2015 logging.conf
drwxr-xr-x. 2 root root 27 Jul 18 15:25 ca

8.2. Starting & Stopping subscription service:


rhsmcertd daemon is responsible for running subscription service.We can either use service
or systemctl command to start/stop the service.
[root@jumpbox ~]# systemctl stop rhsmcertd

[root@jumpbox ~]# systemctl start rhsmcertd

[root@jumpbox ~]# systemctl status rhsmcertd


● rhsmcertd.service - Enable periodic update of entitlement certificates.
Loaded: loaded (/usr/lib/systemd/system/rhsmcertd.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2017-10-23 15:32:11 SGT; 5s ago
Process: 9259 ExecStart=/usr/bin/rhsmcertd (code=exited, status=0/SUCCESS)
Main PID: 9261 (rhsmcertd)
CGroup: /system.slice/rhsmcertd.service
└─9261 /usr/bin/rhsmcertd

Oct 23 15:32:11 jumpbox .homelabs.com systemd[1]: Starting Enable periodic update of entitlement
certificates....
Oct 23 15:32:11 jumpbox .homelabs.com systemd[1]: Started Enable periodic update of entitlement
certificates..

8.3. Checking subscription manager version:


[root@jumpbox ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 2.0.41-1
subscription management rules: 5.26
subscription-manager: 1.15.9-15.el7
python-rhsm: 1.15.4-5.el7

8.4. Configuring subscription manager using config command:


As discussed earlier /etc/rhsm/rhsm.conf is the configuration file and this file has three
sections [server],[rhsm] and [rhsmcertd].when changing the configuration we can use
section.parameter=<new value>.

8.4.1. Changing a subscription manager setting:


Any changes made by the config command will overwrite the rhsm.conf file.similarly you can
change parameters such as server.proxy_hostname,server.proxy_port and so on... as an
example i am changing subscription server (server.hostname).
[root@jumpbox ~]# subscription-manager config --server.hostname=test.example.com

[root@jumpbox rhsm]# egrep ^hostname /etc/rhsm/rhsm.conf


hostname = test.example.com

8.4.2. Removing a subscription manager setting:


As an example i am removing subscription server (server.hostname) and you may choose
any other parameters.
[root@jumpbox ~]# subscription-manager config --remove=server.hostname
You have removed the value for section server and name hostname.
The default value for hostname will now be used.

8.4.3. Changing autoattach check frequency:


Subscription manager will monitor all the active subscriptions on a machine and re-attachs
the subscriptions automatically if in case any of the active subscriptions are about to expire
and this will be taken care by autoattach settings. rhsmcertd daemon will keep an eye on
the subscriptions with in 24 hours of expiring. Below command will change the default 24
hours interval to 12 hours interval.

www.unixindepth.com/p/rhsm.html 7/10
1/2/2020 RedHat Subscription Manager: Unix In Depth
[root@jumpbox ~]# subscription-manager config --rhsmcertd.autoattachinterval=720

Similarly we can even change the cert interval check value (default value is 240 min)
[root@jumpbox ~]# subscription-manager config --rhsmcertd.certcheckinterval=100

8.4.4. Configuring HTTP Proxy:


If your environment has a proxy server then you need to configure you subscription
manager accordingly.

[root@jumpbox ~]# subscription-manager config --server.proxy_hostname=<proxy_server> --


server.proxy_port=<port> --server.proxy_user=<user> --server.proxy_password=<secret>

9. Subscription Manager logs

Subscription manager maintains two type of logs in /var/log/rhsm directory.

rhsm.log file tracks all the results generated by subscription-manager and subscription-
manager-gui commands.
[root@jumpbox ~]# cat /var/log/rhsm/rhsm.log
2017-10-23 11:17:21,519 [DEBUG] subscription-manager:4170 @cache.py:110 - Wrote cache:
/var/lib/rhsm/cache/written_overrides.json
2017-10-23 11:17:21,522 [INFO] subscription-manager:4170 @repolib.py:296 - repos updated: Repo updates

Total repo updates: 188


Updated
[id:rhel-7-server-dotnet-debug-rpms dotNET on RHEL Debug RPMs for Red Hat Enterprise Linux 7 Server]
[id:rhel-7-server-satellite-tools-6.2-rpms Red Hat Satellite Tools 6.2 (for RHEL 7 Server) (RPMs)]
[id:rhel-7-server-v2vwin-1-debug-rpms Red Hat Virt V2V Tool for RHEL 7 (Debug RPMs)]

rhsmcertd.log file tracks all the certificate related information.


[root@jumpbox ~]# cat /var/log/rhsm/rhsmcertd.log
Mon Oct 23 14:06:29 2017 [INFO] (Cert Check) Certificates updated.
Mon Oct 23 15:29:51 2017 [INFO] rhsmcertd is shutting down...
Mon Oct 23 15:32:11 2017 [INFO] Starting rhsmcertd...
Mon Oct 23 15:32:11 2017 [INFO] Auto-attach interval: 1440.0 minute(s) [86400 second(s)]

10. System Facts

Subscriptions are assigned to a machine based on their system's architecture for example
subscriptions for 64 bit and 32 bit platforms are different and these characteristics of a
machine are called as facts. These facts can be viewed and can be even updated when ever
a hardware configuration change happens by doing so you will be sending the updated facts
to RedHat subscription service so that it can update the list of subscriptions which matches
the system architecture.

10.1. Checking the current facts:


[root@jumpbox ~]# subscription-manager facts --list
cpu.core(s)_per_socket: 1
cpu.cpu(s): 2
cpu.cpu_socket(s): 2
cpu.thread(s)_per_core: 1
cpu.topology_source: kernel /sys cpu sibling lists
distribution.id: Maipo

10.2. Updating facts:


When even there is a change in the hardware update your system facts.
[root@jumpbox ~]# subscription-manager facts --update
Successfully updated the system facts.

11. Unregistering a System

www.unixindepth.com/p/rhsm.html 8/10
1/2/2020 RedHat Subscription Manager: Unix In Depth

By using unregister command we can unregister a machine.

Remove the attached subscriptions.


[root@testlinux ~]# subscription-manager remove --all
1 subscription removed at the server.
1 local certificate has been deleted.

Unregister the machine.


[root@testlinux ~]# subscription-manager unregister
Unregistering from: subscription.rhsm.redhat.com:443/subscription
System has been unregistered.

Clean the subscription manager data.


[root@testlinux ~]# subscription-manager clean
All local data removed

12. miscellaneous

12.1. Getting system UUID:


System UUID is a unique ID used in the inventory subscription service. This UUID is used to
re-register the system in case of any corruption.
[root@jumpbox ~]# subscription-manager identity
system identity: 0d95b-acf0-4c8-99af-f0a2ab
name: jumpbox.example.com
org name: 724012
org ID: 724012

Hoping that this article has given a good hands-on experience on Red Hat Subscription
Manager!!!!
Feel free to Post your comments and i will get back to you as early as possible.

No comments :
Post a Comment

Enter your comment...

Comment as: mitrasamrat200 Sign out

Publish Preview Notify me

Home

Subscribe to: Posts ( Atom )

Email Subscription

Enter your email address to subscribe.

Email address...

Submit

www.unixindepth.com/p/rhsm.html 9/10

You might also like