Configuring a RHEL system to use CentOS repositories

I know everyone says, if you don’t want to pay, just use CentOS. Sometimes you have mature, production systems that Corporate has decided they no longer want to pay for the entitlement. So in case you in that situation.

This is for any version of RHEL 5. If you are using RHEL 4, you will need to ensure you have yum installed rather than up2date.

Create /etc/yum.repos.d/CentOS.repo:

[CentOS5_base]
name=CentOS-5-Base
#mirrorlist=http://mirrorlist.centos.org/?release=5&arch=$basearch&repo=os
baseurl=http://mirror.centos.org/centos/5/os/x86_64/
gpgcheck=1
enabled=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
 
[CentOS5_updates]
name=CentOS-5-Updates
#mirrorlist=http://mirrorlist.centos.org/?release=5&arch=$basearch&repo=updates
baseurl=http://mirror.centos.org/centos/5/updates/x86_64/
gpgcheck=1
enabled=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
 
[CentOS5plus]
name=CentOS-5-Plus
#mirrorlist=http://mirrorlist.centos.org/?release=5&arch=$basearch&repo=centosplus
baseurl=http://mirror.centos.org/centos/5/centosplus/x86_64/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

You can make the file re-useable on multiple systems if you change the baseurl to:

baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/

Leave a Reply

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