RHEL 7 and subscription-manager

So RHEL 7 has been out for about a week, not including the beta or RC cycles, and one of the changes is worth documenting. Unless you use a Satellite Server, the concept of registering to RHN is gone. That means no more rhn_reg or rhnreg_ks to get your updates.

Bring on subscription-manager!


The next-gen registration tool was available in RHEL 6, but I never used it as there wasn’t any advantage for my use case. Well, now I have to and I think it’s worth documenting some of these strings. I’m primarily writing this so I can pull up this post to copy/paste the commands. …I suck at remembering the repo names, and often don’t have the patience to look them up.

Registering the system. –note that accounts w/ a mix of various subscriptions and products might not want to auto attach.
$ subscription-manager register --auto-attach
or
$ subscription-manager register --auto-attach --username=[username] --password=[password]

Once registered we can configure the repos. I like to simply drop anything subscription-manager grabs and then add what I need. Thanks to rjerrido for that tip!
$ subscription-manager repos --disable=*

Then grab the repos you want:

$ subscription-manager repos --enable=[repo-name]

Hint: these are the good ones:
$ subscription-manager repos --enable=rhel-7-server-extras-rpms --enable=rhel-7-server-optional-rpms --enable=rhel-7-server-rpms --enable=rhel-7-server-supplementary-rpms

Down the road fastrack will probably have some good stuff in it:
rhel-7-server-optional-fastrack-rpms
rhel-7-server-fastrack-rpms

If you need something else, you can list the repos that are available via the subscription you attached:
$ subscription-manager repos --list

Don’t like this method? That’s ok try running subscription-manager-gui and register your system from there. Then you can modify the repos under “System” -> “Repositories”

Need the epel 7? Of course you do!
yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

Now you’re ready to go! …btw if you’ve stumbled upon this blog post, you should really look at the official documentation and kbase articles available at https://access.redhat.com
This is not a complete how-to for subscription-manager!


Update: Since I have to do this all the time, I now just paste this into the terminal and go.
subscription-manager register --auto-attach && subscription-manager repos --disable=* && subscription-manager repos --enable=rhel-7-server-extras-rpms --enable=rhel-7-server-optional-rpms --enable=rhel-7-server-rpms

One Reply to “RHEL 7 and subscription-manager”

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.