14 October 2011

Using CentOS to update RHEL

If you are ever in this terrible conundrum, I am sorry. I make no promises, either in legality or in functionality. But here is how to shift a RHEL box that won’t update to a CentOS yum repository that will.

Here is how the problem begins:
# yum update subversion
Loading "rhnplugin" plugin
Loading "security" plugin
This system is not registered with RHN.
RHN support will be disabled.
Skipping security plugin, no data
Setting up Update Process
Could not find update match for svn
No Packages marked for Update
This means what it says. RHEL support has expired. The workaround involves pointing the RHEL server to the CentOS repository.

In the /etc/yum.repos.d/ folder create a new file called  CentOS-Base.repo. If you have one already, great. Here is what you need in the file:
[base]
name=CentOS-$releasever - Base
#mirrorlist=
http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=
http://mirror.centos.org/centos/$releasever/os/$basearch/
baseurl=
http://mirror.centos.org/centos/5/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

#released updates
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=
http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
#baseurl=
http://mirror.centos.org/centos/$releasever/updates/$basearch/
baseurl=
http://mirror.centos.org/centos/5/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

Notice what has been commented out of a standard CentOS-Base.repos file. Without these comments, an error will be thrown:
YumRepo Warning: not using ftp, http[s], or file for repos, skipping - 5Server is not a valid release or hasnt been released yet
So, comment out the mirrorlist and correct the baseurl to match what actually is out at CentOS.
Once that is done, install the CentOS repository key:
# rpm --import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
After this, subversion (or whatever) should install in a breeze.

No comments: