Can you use CentOS repositories with RHEL?

Q According to the CentOS website at www.centos.org, CentOS "aims to be 100% binary-compatible" with "a prominent North American enterprise Linux vendor." That got me thinking. Can you point Yum on an honest-to-goodness install of Red Hat to the CentOS repositories? I've noticed when upgrading my CentOS box that a lot of the packages still have the Red Hat name (such as patch_for_foo-RHEL-6.3.2). So it would seem that this could be a way to keep a server up to date after your Red Hat service runs out. I know it would not be the ideal way to do things, but would it work?

A This would seem to be possible, according to reports from the CentOS forums, provided you are using equivalent versions, such as going from RHEL 5 to CentOS 5. You have the choice of either using the CentOS repositories instead of the Red Hat ones or converting your installation from Red Hat Enterprise Linux to CentOS. Before you do anything else, you should make sure you are no longer registered with Red Hat Network. Put this in your Yum configuration to add the CentOS repositories:

[CentOS5 base]
name=CentOS-5-Base
mirrorlist=http://mirrorlist.centos.org/?release=5&arch=$basearch&repo=os
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
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
gpgcheck=1
enabled=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

Disable your RHEL repositories by changing the enabled=1 line to enabled=0 for each of them. Those settings have gpgcheck turned on, so each package is verified against the CentOS GPG keys before installing. You can install these keys with

rpm --import http://isoredirect.centos.org/centos/5/os/i386/RPM-GPG-KEY-CentOS-5

If you want to switch over to CentOS completely, you need to install two small packages from the CentOS repositories, either centos- release-5-0.0.el5.centos.2.x86_64.rpm and centos-release-notes-5.0.0-2.x86_64.rpm or centos-release-5-0.0.el5.centos.2.i386.rpm and centos-release-notes-5.0.0-2.i386.rpm, depending on whether you are running a 32-bit or 64-bit system. You should also make sure that you remove any Red Hat *-release-* packages. You may get conflict warnings from Yum because you still have the RHEL versions of most packages installed. The best long-term solution to this is to install the CentOS packages, turning your system into a pure CentOS one. As you no longer have a RHEL support subscription, there is no benefit in keeping the Red Hat-branded packages installed, and moving over to a pure CentOS system will make it easier if you need support from the CentOS community.

Back to the list