After setting up a fresh RHEL6 server and completing subscription registration, many admins encounter a perplexing situation where yum repolist
shows empty repositories and /etc/yum.repos.d/redhat.repo
gets wiped clean. Here's how to properly establish package channels when traditional methods fail.
The key indicators of this problem include:
# yum repolist
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
repolist: 0
And examining the repository file:
# cat /etc/yum.repos.d/redhat.repo
[Empty file]
First, verify your subscription status:
# subscription-manager list --consumed
# subscription-manager repos --list
Then force-refresh the subscription data:
# subscription-manager clean
# rm -rf /var/cache/yum/*
# subscription-manager refresh
For RHEL6 specifically, you may need to manually enable repositories:
# subscription-manager repos --enable=rhel-6-server-rpms \
--enable=rhel-6-server-optional-rpms \
--enable=rhel-6-server-extras-rpms \
--enable=rhel-6-server-supplementary-rpms
If repositories still don't appear, check these configuration files:
/etc/rhsm/rhsm.conf
should contain valid entries:
[rhsm]
baseurl = https://cdn.redhat.com
repo_ca_cert = %(ca_cert_dir)s/redhat-uep.pem
Verify the system identity is properly registered:
# identity
After completing these steps, your yum repolist
should show enabled repositories:
repo id repo name
rhel-6-server-rpms Red Hat Enterprise Linux 6 Server (RPMs)
[...]
Test package installation:
# yum install -y telnet
# yum update
When dealing with RHEL6 systems, the most common repository-related issue occurs when the system appears properly subscribed but shows empty repositories. The key symptoms are:
- Empty
/etc/yum.repos.d/redhat.repo
file yum repolist
showing no repositories- Subscription Manager GUI not displaying products
First, confirm your subscription is truly active:
# Check current subscriptions
subscription-manager list --consumed
# Verify registration status
subscription-manager identity
If these show your subscription as active, we need to force repository regeneration.
The nuclear option that often works:
# Clean existing data
subscription-manager clean
# Re-register
subscription-manager register --force --username=YOUR_RHN_USER --password=YOUR_RHN_PASS
# Attach subscription
subscription-manager attach --pool=YOUR_POOL_ID
# Refresh repos
subscription-manager repos --enable=rhel-6-server-rpms \
--enable=rhel-6-server-optional-rpms \
--enable=rhel-6-server-extras-rpms
For older systems still using RHN Classic:
# Install RHN tools
yum install rhn-client-tools rhn-check rhn-setup
# Register system
rhn_register
# After registration
yum clean all
yum makecache
Enable verbose output to identify issues:
yum --verbose repolist
Check for these key indicators of success:
[output] repo id repo name status rhel-6-server-rpms Red Hat Enterprise Linux 6 Server (RPMs) 10,672
Confirm repository metadata is properly cached:
ls -l /var/cache/yum/x86_64/6Server/
Check subscription manager logs for errors:
tail -n 50 /var/log/rhsm/rhsm.log