4.3. Manually Attaching and Removing Subscriptions through the Command Line

4.3.1. Attaching Subscriptions

Attaching subscriptions to a system requires specifying the individual product or subscription to attach, using the --pool option.
[root@server1 ~]# subscription-manager attach --pool=XYZ01234567
The options for the attach command are listed in Table 4, “attach Options”.
The ID of the subscription pool for the purchased product must be specified. The pool ID is listed with the product subscription information, which is available from running the list command:
[root@server1 ~]# subscription-manager list --available

    Available Subscriptions
ProductName:            RHEL for Physical Servers
ProductId:              MKT-rhel-server
PoolId:                 ff8080812bc382e3012bc3845ca000cb
Quantity:               10
Expires:                2011-09-20
Alternatively,the best-fitting subscriptions, as identified by the subscription service, can be attached to the system by using the --auto option (which is analogous to the --auto-attach option with the register command).
[root@server1 ~]# subscription-manager attach --auto

Table 4. attach Options

Options Description Required
--pool=pool-id Gives the ID for the subscription to attach to the system. Required, unless --auto is used
--auto Automatically attaches the system to the best-match subscription or subscriptions. Optional
--quantity=number Attaches multiple counts of a subscription to the system. This is used to cover subscriptions that define a count limit, like using two 2-socket server subscriptions to cover a 4-socket machine. Optional
--servicelevel=None|Standard|Premium Sets the service level to use for subscriptions on that machine. This is only used with the --auto option. Optional

4.3.2. Removing Subscriptions from the Command Line

A system can be attached to multiple subscriptions and products. Similarly, a single subscription or all subscriptions can be removed from the system.
Running the remove command with the --all option removes every product subscription and subscription pool that is currently attached to the system.
[root@server1 ~]# subscription-manager remove --all
It is also possible to remove a single product subscription. Each product has an identifying certificate installed with it. The product subscription to remove is identified in the remove command by referencing the ID number of that certificate.
  1. Get the serial number for the product certificate, if you are removing a single product subscription. The serial number can be obtained from the subscription#.pem file (for example, 392729555585697907.pem) or by using the list command. For example:
    [root@server1 ~]# subscription-manager list --consumed
        Consumed Product Subscriptions
    ProductName:         High availability (cluster suite)
    ContractNumber:      0
    SerialNumber:        11287514358600162
    Active:              True
    Begins:              2010-09-18
    Expires:             2011-11-18
  2. Run the subscription-manager tool with the --serial option to specify the certificate. To remove multiple subscriptions, use the --serial option multiple times.
    [root@server1 ~]# subscription-manager remove --serial=11287514358600162