Recently, we wanted to convert from Red Hat Enterprise Linux to CentOS. CentOS is a build of Red Hat Enterprise Linux from all of the open source packages that are released by Red Hat. There are a number of instructions in this regard, but the overall process is the same. My conversion was a Red Hat Enterprise Linux 5.8 to CentOS 5.8.
I started by following these instructions from saylinux.net (or thuannvn.blogspot.com). However, I had to adjust the instructions for RHEL 5.8 – just look in the directory on mirror.centos.org for the proper version of the packages you need. You won’t be able to use yum to download the packages because you want to pull not from RHEL but from CentOS – and yum will be getting updated as well.
Firstly, do a cleanup:
yum clean all
Then, create a working space where RPMs can be downloaded:
Now download the relevant CentOS key and import it:
rpm --import RPM-GPG-KEY-CentOS-5
Then, get relevant packages from CentOS – note these instructions will pull i386 packages or x86_64 packages depending on your system:
wget http://mirror.centos.org/centos/5/os/`uname -m`/CentOS/centos-release-5-8.el5.centos.i386.rpm
wget http://mirror.centos.org/centos/5/os/`uname -m`/CentOS/centos-release-notes-5.8-0.i386.rpm
wget http://mirror.centos.org/centos/5/os/`uname -m`/CentOS/yum-3.2.22-39.el5.centos.noarch.rpm
wget http://mirror.centos.org/centos/5/os/`uname -m`/CentOS/yum-updatesd-0.9-2.el5.noarch.rpm
wget http://mirror.centos.org/centos/5/os/`uname -m`/CentOS/yum-fastestmirror-1.1.16-21.el5.noarch.rpm
You don’t have to use wget either; you could – if you want – instead use a text browser like elinks to get the same packages. Using elinks allows you to get the most recent version without stumbling over the version number – if the package is updated, you don’t have to guess at the version numbers in the filename.
elinks http://mirror.centos.org/centos/5/os/`uname -m`/CentOS/
Delete unnecessary packages from RHEL – in particular, those that use the Red Hat Network (RHN):
rpm -e yum-rhn-plugin rhn-client-tools rhn-setup rhn-check rhnsd
If there are any other packages that require yum-rhn-plugin or related packages, add it to the list of packages to remove.
Now update all of the packages that were downloaded:
rpm -Uvh --force *.rpm
Lastly, perform an upgrade to fully update the system from the new CentOS repositories:
For best practices, you probably should reboot here as well – thus loading new libraries, deleting old files, and activating new kernels.