Enabling or disabling a repository using Red Hat Subscription Management

Enabling or disabling a repository using Red Hat Subscription Management

 SOLUTION VERIFIED - Updated  - 

Environment

  • Red Hat Enterprise Linux (RHEL) 5.7 or higher, 6.1 or higher
  • Red Hat Subscription Management (RHSM)

Issue

  • How to enable a repository using Red Hat Subscription Manager?
  • Need to access a repository using Red Hat Subscription Manager?
  • How to disable repository using Subscription Manager
  • How to subscribe a child channel using Red Hat Subscription-Manager

Resolution

As systems are subscribed to products, the associated content repositories (identified in the entitlement certificate) are made available to the system. The content repositories are based on the product and on the content delivery network, defined in the baseurl parameter of the rhsm.conf file.

A subscription may include access to optional content channels along with the default channels. These optional channels must be enabled before the packages in them can be installed (even if the system is fully entitled to the products in those channels).

List all available repositories for the system, including disabled repositories:

[root@server ~]# yum repolist all
repo id                      repo name                           status
rhel-6-server                Red Hat Enterprise Linux 6Server -  enabled
rhel-6-server-beta           Red Hat Enterprise Linux 6Server Be enabled
rhel-6-server-optional-rpms  Red Hat Enterprise Linux 6Server Op disabled
rhel-6-server-supplementary  Red Hat Enterprise Linux 6Server Su disabled

The optional and supplementary channels are named rhel-6-server-optional-rpms and rhel-6-server-supplementary, respectively.

Using Subscription-Manager

Subscription-Manager provides it's own utility to enable & disable repositories within the redhat.repo file:

To see a list of available repositories:

[root@server ~]# subscription-manager repos --list

To enable a specific repository:

[root@server ~]# subscription-manager repos --enable=rhel-6-server-optional-rpms

To disable a specific repository:

[root@server ~]# subscription-manager repos --disable=rhel-6-server-optional-rpms

Using Yum-Utils provided yum-config-manager:

The repositories can be enabled or disabled using the yum-config-manager command, which is provided with the yum-utils package:

[root@server ~]# yum install -y yum-utils

Please note yum-config-manager is only available for RHEL 6 and not available for RHEL 5

If required run yum clean all first to ensure the repositories are in a stable state.

[root@server ~]# yum clean all
[root@server ~]# yum repolist enabled

The yum repolist enabled command will list the repo id that you can either disable or enable.

[root@server ~]# yum-config-manager --enable rhel-6-server-optional-rpms
or 
[root@server ~]# yum-config-manager --disable epel

Alternatively, simply specify the optional or supplementary repository when installing a package with yum. This uses the --enablerepo repo_nameoption. For example:

# yum install rubygems --enablerepo=rhel-6-server-optional-rpms
Loaded plugins: product-id, refresh-packagekit, subscription-manager
Updating Red Hat repositories.
...

Disabling the Subscription-Manager Repository

When a system is registered using Subscription-Manager, the rhsmcertd process creates a special yum repository — redhat.repo. As “Enabling Supplementary and Optional Repositories” describes, as the system adds subscriptions, the product channels are added to the redhat.repo file.

Maintaining a redhat.repo file may not be desirable in some environments. It can create static in content management operations if that repository is not the one actually used for subscriptions, such as for a disconnected system or a system using a local content mirror.

This default redhat.repo repository can be disabled by editing the Subscription-Manager configuration and setting the manage_repos value to zero (0).

[root@server ~]# subscription-manager config --rhsm.manage_repos=0

More information: Working with yum Repos

0 (0)
Article Rating (No Votes)
Rate this article
Attachments
There are no attachments for this article.
Comments
There are no comments for this article. Be the first to post a comment.
Full Name
Email Address
Security Code Security Code
Related Articles RSS Feed
RHEL: Adding a boot entry to GRUB/GRUB2 configuration
Viewed 4082 times since Sun, May 27, 2018
ZFS: Grow/Shrink an existing zfs filesystem
Viewed 5822 times since Sun, Jun 3, 2018
Understanding System auditing with auditd
Viewed 8982 times since Fri, Apr 5, 2019
A Simple Guide to Oracle Cluster File System (OCFS2) using iSCSI on Oracle Cloud Infrastructure
Viewed 7669 times since Sat, Jun 2, 2018
Linux Kernel /etc/sysctl.conf Security Hardening
Viewed 23154 times since Fri, Aug 3, 2018
Top 25 Best Linux Performance Monitoring and Debugging Tools
Viewed 6585 times since Sun, Sep 30, 2018
RHEL: Scan and configure new SAN (fibre channel) LUNs
Viewed 7499 times since Sun, May 27, 2018
RHEL: Services basic management - systemd
Viewed 18100 times since Sat, Jun 2, 2018
Open SSL Encrypt & Decrypt Files With Password Using OpenSSL
Viewed 6968 times since Mon, Feb 18, 2019
Nagrywanie sesji SSH do pliku
Viewed 2653 times since Thu, May 24, 2018