Last modified: [last-modified]
We’ve got a semi-large fleet of Redhat Enterprise Linux (RHEL) 5 and 6 servers where I work and we want to convert them over to CentOS to save on licensing costs.
I searched around online and found a few guides on how to do it but ultimately I had to pull from all three and make a few tweaks to get everything working.
I’ve used these steps to convert a single 32-bit RHEL 5 system to CentOS 5. These instructions should also work for the 64-bit version. I will have another post in the coming days on how to do this with RHEL 6/CentOS 6.
If you’re using RHEL 6.x and want to convert to CentOS 6.x check out this post
Updated 2016-03-29 – Thanks to feedback from here I’ve updated the guide.
Updates and Backups!
- Fully patch your system and reboot your system before starting this process
- Take a full backup of your system or a Snapshot if it’s a VM
- Login to the server and become root
- Clean up yum’s cache
1localhost:~ root# yum clean all
- Create a temporary working area
12localhost:~ root# mkdir -p /temp/centoslocalhost:~ root# cd /temp/centos
- Determine your version of RHEL
1localhost:~ root# cat /etc/redhat-release
- Determine your architecture (32-bit = i386, 64-bit = x86_64)
1localhost:~ root# uname -i
- Download the applicable files for your release and architecture. The version numbers on these packages could change. This document was written as of CentOS 5.10. To find the current versions of these files browse this FTP site: http://mirror.centos.org/centos/5/os/i386/CentOS/ (32-bit) and http://mirror.centos.org/centos/5/os/x86_64/CentOS/ (64-bit)
CentOS 5.10 / 32-bit
123456localhost:~ root# wget http://mirror.centos.org/centos/5/os/i386/RPM-GPG-KEY-CentOS-5localhost:~ root# wget http://mirror.centos.org/centos/5/os/i386/CentOS/centos-release-5-x.el5.centos.i386.rpmlocalhost:~ root# wget http://mirror.centos.org/centos/5/os/i386/CentOS/centos-release-notes-x.x-x.i386.rpmlocalhost:~ root# wget http://mirror.centos.org/centos/5/os/i386/CentOS/yum-x.x.xx-xx.el5.centos.noarch.rpmlocalhost:~ root# wget http://mirror.centos.org/centos/5/os/i386/CentOS/yum-updatesd-x.x-x.el5.noarch.rpmlocalhost:~ root# wget http://mirror.centos.org/centos/5/os/i386/CentOS/yum-fastestmirror-x.x.xx-xx.el5.centos.noarch.rpm
CentOS 5.10 / 64-bit
123456localhost:~ root# wget http://mirror.centos.org/centos/5/os/x86_64/RPM-GPG-KEY-CentOS-5localhost:~ root# wget http://mirror.centos.org/centos/5/os/x86_64/CentOS/centos-release-5-xx.el5.centos.x86_64.rpmlocalhost:~ root# wget http://mirror.centos.org/centos/5/os/x86_64/CentOS/centos-release-notes-x.xx-x.x86_64.rpmlocalhost:~ root# wget http://mirror.centos.org/centos/5/os/x86_64/CentOS/yum-x.x.xx-xx.el5.centos.noarch.rpmlocalhost:~ root# wget http://mirror.centos.org/centos/5/os/x86_64/CentOS/yum-updatesd-x.x-x.el5.noarch.rpmlocalhost:~ root# wget http://mirror.centos.org/centos/5/os/x86_64/CentOS/yum-fastestmirror-x.x.xx-xx.el5.centos.noarch.rpm
- Import the GPG key for the appropriate version of CentOS
1localhost:~ root# rpm --import RPM-GPG-KEY-CentOS-5
- Remove the RHEL release files
1localhost:~ root# rpm -e --nodeps redhat-release
- Remove the Redhat Network plugin for yum
1localhost:~ root# rpm –e --nodeps yum-rhn-plugin
- Removing the remaining RHEL files that may be install on the system
1localhost:~ root# rpm –e --nodeps rhn-client-tools rhn-setup rhn-check rhn-virtualization-common rhnsd redhat-logos redhat-release-notes rhel-instnum
Note: If this command fails saying a package is not installed remove the package from the command and run it again.
- Install the CentOS RPMs we downloaded previously (make sure you are still in /temp/centos)
1localhost:~ root# rpm -Uvh --force *.rpm
- Upgrade to CentOS from RHEL
1localhost:~ root# yum upgrade
- Reboot the server
- Verify functionality
- Delete the VM Snapshot if you took one as part of the backup.
If you’re running a GUI on your server
We’re running Gnome on our servers and after performing the following error is displayed:
There was an error loading the theme RHEL
Can't open file /usr/share/gdm/themes/RHEL/RHEL.xml
and looks like this:
To fix it follow these steps:
- Click past the messages and get to the login screen and login
- Click ‘System’ and ‘Administration’ and ‘Login Screen’
- Select ‘CentOS Default’ so there is a dot beside it
- Click ‘Close’
- Press CTRL+ALT+BACKSPACE on your keyboard and the desktop should reload to the login screen with no error