| subscription-manager(8) | Subscription Management | subscription-manager(8) |
Red Hat provides content updates and support by issuing subscriptions for its products. These subscriptions are applied to systems; once a subscription for a product is attached to a system, that system is allowed to install, update, and receive support for that software product. IT administrators need to track these subscriptions and how they are attached. This subscription management is a feature available for Red Hat platforms version 5.7 (and later) and version 6.1 (and later).
For RHEL systems, content is delivered through the Red Hat Customer Portal. Subscriptions and systems are managed globally through the Red Hat subscription management service, which is integrated with the Customer Portal. Subscriptions are managed for the local system by using the Red Hat Subscription Manager tool. Subscription Manager is a local client which connects a system with the subscription management service.
subscription-manager is the command-line based client for the Red Hat Subscription Manager tool.
Subscription Manager performs several key operations:
Subscription Manager can be used to auto-attach subscriptions to a system, as well. The subscription-manager command can even be invoked as part of a kickstart process.
Available subscriptions are based on the specific information about the system's architecture. A subscription is only considered available if the platform and hardware can support that specific product.
Subscription Manager also collects and summarizes system facts related to its hardware, operating system, and other characteristics. These facts can be edited in the Subscription Manager configuration and displayed through Subscription Manager.
There is also a Subscription Manager GUI, which can be invoked simply by running subscription-manager-gui from the command line.
Subscription management is only available for RHEL 5.7/6.1 and later systems. Older systems should register to Red Hat Network Classic using the rhn_register command.
Following commands were deprecated: addons, role, service-level, subscribe, unsubscribe, usage, and activate
subscription-manager register --org="IT Dept" --activationkey=1234abcd
This command has no options.
The syspurpose command has subcommands for all the various syspurpose preferences and attributes:
cpu.architecture: x86_64
cpu.core(s)_per_socket: 1
cpu.cpu(s): 2
cpu.cpu_family: 6
cpu.cpu_mhz: 1861.776
cpu.cpu_op-mode(s): 64-bit
cpu.cpu_socket(s): 2
cpu.hypervisor_vendor: KVM
cpu.model: 2
cpu.numa_node(s): 1
cpu.numa_node0_cpu(s): 0,1
cpu.stepping: 3
cpu.thread(s)_per_core: 1
cpu.vendor_id: GenuineIntel
cpu.virtualization_type: full
distribution.id: Santiago
distribution.name: Red Hat Enterprise Linux Workstation
distribution.version: 6.1
----
This command has no options.
server.hostname=newsubscription.example.com
[root@server ~]# subscription-manager version server type: Red Hat Subscription Management subscription management server: 0.9.18-1 subscription management rules: 5.9 subscription-manager: 1.12.1-1.git.28.5cd97a5.fc20 python-rhsm: 1.11.4-1.git.1.2f38ded.fc20
This command has no options.
[root@server ~]# subscription-manager status
+-------------------------------------------+
System Status Details
+-------------------------------------------+
Overall Status: Current
[root@server ~]# subscription-manager status --ondate=2014-01-01
+-------------------------------------------+
System Status Details
+-------------------------------------------+
Overall Status: Insufficient
subscription-manager makes it easier for network administrators to maintain parity between software subscriptions and updates and their installed products by tracking and managing what subscriptions are attached to a system and when those subscriptions expire or are exceeded.
The default subscription management service in the Subscription Manager configuration is the Customer Portal Subscription Management service. The configuration file can be edited before the system is registered to point to an on-premise subscription management service like Subscription Asset Manager.
Systems are usually registered to a subscription management service as part of their initial configuration, such as the firstboot or kickstart process. However, systems can be registered manually after they are configured, can be removed from a content service, or re-registered.
If a system has never been registered (not even during firstboot), then the register command will register the system with whatever subscription management service is configured in the /etc/rhsm/rhsm.conf file. This command requires, at a minimum, the username and password or token for an account to connect to the subscription management service. If the credentials aren't passed with the command, then subscription-manager prompts for the username and password interactively.
When there is a single organization or when using the Customer Portal Subscription Management service, all that is required is the username/password set or the token is used. For example:
subscription-manager register --username=admin --password=secret or subscription-manager register --token=eyJhbGciOiJSUzI1NiIsI ... stGc_2bFDQC8CENEOo
With on-premise subscription services, such as Subscription Asset Manager, the infrastructure is more complex. The local administrator can define independent groups called organizations which represent physical or organizational divisions (--org). Those organizations can be subdivided into environments (--environment). Optionally, the information about what subscription service (--serverurl) and content delivery network (--baseurl) to use for the system registration can also be passed (which overrides the Red Hat Subscription Manager settings). The server and content URLs are usually configured in the Subscription Manager configuration before registering a system.
subscription-manager register --username=admin --password=secret --org="IT Dept" --environment="local dev" --serverurl=local-cloudforms.example.com --baseurl=https://local-cloudforms.example.com:8088/cfFe
If a system is in a multi-tenant environment and the organization is not provided with the registration request, registration fails with a remote server error. In the rhsm.log, there will be errors about being unable to load the owners interface.
If a system is registered and then somehow its subscription information is lost -- a drive crashes or the certificates are deleted or corrupted -- the system can be re-registered, with all of its subscriptions restored, by registering with the existing ID.
subscription-manager register --username=admin --password=secret --consumerid=1234abcd
A system uses an SSL client certificate (its identity certificate) to authenticate to the subscriptions system to check for updates or changes to subscriptions. If the identity certificate is lost or corrupted, it can be regenerated using the identity command.
subscription-manager identity --regenerate
Using the --force option will prompt for the username and password for the account, if one isn't given, and then return the new inventory ID and the hostname of the registered system.
subscription-manager identity --force Username: jsmith Password: eff9a4c9-3579-49e5-a52f-83f2db29ab52 server.example.com
A system is unregistered and removed from the subscription management service simply by running the unregister command. Unregistering a system and removing its attached subscriptions can free up subscriptions when a system is taken offline or moved to a different department.
subscription-manager unregister
An option with registration, --auto-attach, will automatically attach the subscriptions pool which best matches the system architecture and configuration to the newly-registered system. This option attaches subscriptions as part of the registration process, rather than separately managing subscriptions.
subscription-manager register --username=admin --password=secret --auto-attach
Auto-attach also supports an option to set a preferred service level with the selected subscriptions, the --servicelevel option. In this case, the --servicelevel option sets a preference that helps the auto-attach process select appropriate subscriptions. For example, if the preferred service level for a production server is premium, and there are three matching subscriptions with different service levels (none, standard, and premium), the auto-attach process selects the subscription which offers a premium service level.
subscription-manager register --username=admin --password=secret --auto-attach --servicelevel=premium
list command shows you what subscriptions are available specifically to the system (meaning subscriptions which are active, have available quantities, and match the hardware and architecture) or all subscriptions for the organization. Using the --ondate option shows subscriptions that are or will be active at a specific time (otherwise, it shows subscriptions which are active today).
subscription-manager list --available --ondate=2012-01-31
+-------------------------------------------+
Available Subscriptions
+-------------------------------------------+
Subscription Name: Red Hat Enterprise Linux
SKU: SYS0395
Pool Id: 8a85f981302cbaf201302d899adf05a9
Quantity: 249237
Service Level: None
Service Type: None
Multi-Entitlement: No
Starts: 01/01/2021
Ends: 01/01/2022
Machine Type: physical
The list command can also be used to show what products you currently have installed, as a way of tracking what products you have versus what subscriptions you have on the system.
subscription-manager list --installed
+-------------------------------------------+
Installed Product Status
+-------------------------------------------+
ProductName: Red Hat Enterprise Linux Server
Product ID: 69
Version: 6.3
Arch: x86_64
Status: Subscribed
Started: 07/26/2012
Ends: 08/31/2015
The list can be filtered to only include products or subscriptions that match the query string provided to --matches option.
subscription-manager list --installed --matches="*Server*"
+-------------------------------------------+
Installed Product Status
+-------------------------------------------+
ProductName: Red Hat Enterprise Linux Server
Product ID: 69
Version: 6.3
Arch: x86_64
Status: Subscribed
Started: 07/26/2012
Ends: 08/31/2015
Attaching a subscription requires the ID for the subscription pool (the --pool option). For example:
subscription-manager attach --pool=ff8080812bc382e3012bc3845da100d2
As with the register command, the system can be auto-attached to the best-fitting subscriptions. This is the default action and is equivalent to using the --auto option:
subscription-manager attach
Auto-attach also supports an option to set a preferred service level with the selected subscriptions, the --servicelevel option. In this case, the --servicelevel option sets a preference that helps the auto-attach process select appropriate subscriptions. For example, if the preferred service level for a production server is premium, and there are three matching subscriptions with different service levels (none, standard, and premium), the auto-attach process selects the subscription which offers a premium subscription.
subscription-manager attach --servicelevel=premium
Some subscriptions define a count based on attributes of the system itself, like the number of sockets or the number of virtual guests on a host. You can combine multiple subscriptions together to cover the count. For example, if there is a four socket server, you can use two subscriptions for "RHEL Server for Two Sockets" to cover the socket count. To specify the number of subscriptions to use, use the --quantity option. For example:
subscription-manager attach --pool=ff8080812bc382e3012bc3845da100d2 --quantity=2
Removing subscription from a system releases the subscription back into the pool. The system remains registered with the subscription management service. Each product has an identifying X.509 certificate installed with it. To remove a subscription for a specific product, specify the serial number (or numbers, in multiple --serial options) of the certificate:
subscription-manager remove --serial=1128750306742160
Giving the remove command with the --all option removes every subscription the system has used.
After registration, subscriptions on preconfigured systems can be claimed using the redeem command, which essentially auto-attaches the system to its preexisting subscriptions.
subscription-manager redeem --email=admin@example.com --org="IT Dept"
subscription-manager repos --list subscription-manager environments --username=jsmith --password=secret --org=prod or subscription-manager environments --token=eyJhbGciOiJSUzI1NiIsI ... stGc_2bFDQC8CENEOo --org=prod subscription-manager orgs --username=jsmith --password=secret or subscription-manager orgs --token=eyJhbGciOiJSUzI1NiIsI ... stGc_2bFDQC8CENEOo
For example, to change the hostname of the subscription management service host:
subscription-manager config --server.hostname=myserver.example.com
The entries in the logging section are somewhat special. The keys in this section are a name of a logger. The values are the logging level.
Valid levels are one of: DEBUG , INFO , WARNING , ERROR , or CRITICAL
Valid logger names are the full module path of any Subscription Manager module. For example: subscription_manager or subscription_manager.managercli
There are three main top-level loggers: subscription_manager, rhsm, and rhsm-app. All logger names begin with one of the above.
To set the default log level for all loggers (that are not otherwise set in the logging section), edit the default_log_level key in /etc/rhsm/rhsm.conf
subscription-manager facts --update
The collected facts can also be overridden by creating a JSON file in the /etc/rhsm/facts/ directory. These have simple formats that define a fact and value:
{"fact1": "value1","fact2": "value2"}
Any fact override file must have a .facts extension.
When these fact files are added, running the facts command will update the collected facts with the new, manual facts or values.
%post --log=/root/ks-post.log /usr/sbin/subscription-manager register --username admin --password secret --org 'east colo' --auto-attach --servicelevel=premium --force
For information about the network addresses that subscription-manager and the subscription-manager yum plugin use see https://access.redhat.com/site/solutions/59586
Although subscription-manager respects environment variables for proxy configuration, this should be avoided in favor of the configuration file, because the daemons (ex. rhsmcertd ) do not provide ways to modify their environments.
Each option of the proxy configuration (hostname, port, host/domain pattern blocklist, username, password) is read independently, with precedence being command-line over configuration over environment, and then the resulting set of options is used to configure the proxy configuration.
For example, if the HTTP_PROXY environment variable is set and no_proxy is set in /etc/rhsm/rhsm.conf then both are present in the effective proxy configuration.
If two equivalent options are set in different places, then the precedence determines which value is effective.
For example, the NO_PROXY environment variable is set and the no_proxy configuration file option is set, then the value from the configuration file is the effective value.
If the directory isn't writable, the logs are printed to stderr.