Sunday, December 15, 2019

Attaching system to subscription for software update in RHEL 7

Red Hat Subscription Management

Red Hat subscription management provides tools that can be used to entitle machines to product subscriptions.

There are Four basic tasks performed with Red Hat subscription manager 

Register a system to associate that system to Red Hat account.
Subscribe a system to entitle it to updated for selected Red Hat Products.
                   Subscription have special level of support,Expiration dates and default repository
                    The tool can be used wither to auto-attach or select a specific entitlement.
Enable Repositories to provide software packages. Multiples repository are enabled by default with each subscription, but other repositories such as updates or source code can be enabled or disabled as needed.

Review and track entitlement which are available or consumed. Subscription information can be viewed locally on a specific system or, for an account , in either the Red Hat customer portal Subscriptions page.

subscription-manager 

Use command subscription-manager to register a system in CLI. 

subscription-manager register - Register a system to Red Hat account
subscription-manager list --available - View available subscription
subscription-manager attach --auto - Auto-attach a subscription
subscription-manager list --consumed - View consumed subscription
subscription-manager repos --enable rhel-7-server-optional-source-rpms  -- Attach a repos
subscription-manager unregister  - unregister a system

Register a system to a Red Hat account
[root@server1 ~]# subscription-manager register
Registering to: subscription.rhsm.redhat.com:443/subscription
Username: abcxyz@gmail.com
Password:
The system has been registered with ID: d7ab5b88-25c1-441c-a585-c1befe53d289

View available subscription 
[root@server1 ~]# subscription-manager list --available
Subscription Name:   Red Hat Beta Access
Provides:            Red Hat CodeReady Linux Builder for x86_64 Beta
....
                     Red Hat Enterprise Linux for x86_64 Beta
                     Red Hat Enterprise Linux for Real Time for NFV Beta
.....
SKU:                 RH00069
Contract:            11844216
Pool ID:             8a85f98f686222970168759bd81e1929
Provides Management: No
Available:           Unlimited
Suggested:           1
Service Level:       Self-Support
Service Type:        L1-L3
Subscription Type:   Standard
Ends:                01/22/2020
System Type:         Physical

Auto-attach a subscription 
[root@server1 ~]# subscription-manager attach --auto


Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status:       Subscribed


View consumed subscription
[root@server1 ~]# subscription-manager list --consumed
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+
Subscription Name:   Red Hat Developer Subscription
Provides:            Red Hat Enterprise Linux High Availability - Update Services for SAP Solutions
...
                     Red Hat Developer Tools Beta (for RHEL Server)
                     Red Hat Developer Toolset (for RHEL Server)
                     Red Hat Enterprise Linux for x86_64
....
SKU:                 RH00798
Contract:
Account:
Serial:              7529774378551146176
Pool ID:             8a85f99a684d00130168757a42a10509
Provides Management: No
Active:              True
Quantity Used:       1
Service Level:       Self-Support
Service Type:
Status Details:      Subscription is current
Subscription Type:   Standard
Starts:              01/22/2019
Ends:                01/22/2020
System Type:         Physical

Enable a repo
[root@server1 ~]# subscription-manager repos --enable rhel-7-server-optional-source-rpms

Repository 'rhel-7-server-optional-source-rpms' is enabled for this system.
[root@server1 ~]# yum repolist
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
repo id                                                          repo name                                                                                        status
cd                                                               cd                                                                                                4,751
rhel-7-server-optional-source-rpms/7Server/x86_64                Red Hat Enterprise Linux 7 Server - Optional (Source RPMs)                                        3,185
rhel-7-server-rpms/7Server/x86_64                                Red Hat Enterprise Linux 7 Server (RPMs)                                                         26,733
rhel-rs-for-rhel-7-server-fastrack-rpms/x86_64                   Red Hat Enterprise Linux Resilient Storage (for RHEL 7 Server) - Fastrack (RPMs)                      0

Unregister a system
[root@server1 ~]# subscription-manager unregister
System has been unregistered.


Entitlement Certificates
An Entitlement is a subscription that's been attached to a system.
Digital certificate are used to store current information about entitle on local system.
Once registered entitlement certificate are stored in /etc/pki and its sub-folder.

/etc/pki/product contains certificates which indicate Red Hat Products installed on the system
/etc/pki/consumer contains certificates which indicate the Red Hat account to which the system is registered.
/etc/pki/entitlement contains certificate which indicate which subscriptions are attached to the system.


The certificate can be inspected using rct utiliaty
[root@server1 ~]# rct stat-cert /etc/pki/entitlement/8775838808487347342.pem
Type: Entitlement Certificate
Version: 3.4
DER size: 3338b
Subject Key ID size: 20b
Content sets: 1071




No comments: