How to Subscribe to RHEL7 Optional Channel

In this Red Hat 7 tutorial we will take a look at how to subscribe to the Optional and Supplementary channels, and -devel packages using Red Hat Subscription Manager (RHSM).

Graphical User Interface (GUI)

It is possible to enable new repositories using the GUI or command line interface (CLI), we start by using the GUI.
Navigate to Add/Remove Software to enable and disable repositories:


System --> Administration --> Add/Remove Software

Within the Add/Remove Software window, select the System menu item and select Software Sources.

For Red Hat Enterprise Linux 6 (RHEL6), to enable and disable repositories:


 Applications --> System Tools --> Red Hat Subscription Manager

For Red Hat Enterprise Linux 6 (RHEL6), to add and remove packages:


 Applications --> System Tools --> Software

Command Line Interface (CLI)

Using the Red Hat Subscription Manager (RHSM) and subscription-manager tooling, Optional and Supplementary repositories are provided but disabled by default, see the config file /etc/yum.repos.d/redhat.repo the enabled=0.

To view the Enabled repositories use the following command:


    # yum repolist

To view all repositories use the following command:


    # yum repolist all

or using:


 # subscription-manager repos --list

Using the subscription-manager

The command subscription-manager repos –enable/disable can be used to enable a repository provided by the /etc/yum.repos.d/redhat.repo file:


# subscription-manager repos --enable 

For example enabling the optional rpm repository:


# subscription-manager repos --enable rhel-7-server-optional-rpms

Using yum-config-manager

The yum-config-manager command is provided by the yum-utils package RPM on RHEL6. It is not available on RHEL5.

You can enable repositories by running the following command:


# yum-config-manager --enable 

For example enabling the optional rpm repository:


# yum-config-manager --enable rhel-7-server-optional-rpms

Using a manually edit of redhat.repo

You also can manually edit the /etc/yum.repo.d/redhat.repo to set enabled=1 for the optional channel:


RHEL7 redhat.repo:
    [rhel-7-server-optional-rpms]  
    name = Red Hat Enterprise Linux 6 Server - Optional (RPMs)  
    baseurl = https://cdn.redhat.com/content/dist/rhel/server/7/$releasever/$basearch/optional/os  
    enabled = 1

Using yum one time option enablerepo

Of course you can also use a one time option of yum –enablerepo:


# yum --enablerepo=rhel-7-server-optional-rpms install <packagename>

The above will not permanently enable the channel in the redhat.repo, but will allow you to access packages in the channel in a one-off manner.

That’s all for this RHEL7 tutorial where we showed how to add additional repositories.

This entry was posted in Linux Administration. You can follow any responses to this entry through the RSS 2.0 feed. You can trackback from your own site. Tweet This! Tweet This! or use to share this post with others.

Leave a Reply: