How to convert RHEL 5.x to CentOS 5.x

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!

  1. Fully patch your system and reboot your system before starting this process
  2. Take a full backup of your system or a Snapshot if it’s a VM


  1. Login to the server and become root
  2. Clean up yum’s cache
    localhost:~ root# yum clean all
  3. Create a temporary working area
    localhost:~ root# mkdir -p /temp/centos
    localhost:~ root# cd /temp/centos
  4. Determine your version of RHEL
    localhost:~ root# cat /etc/redhat-release
  5. Determine your architecture (32-bit = i386, 64-bit = x86_64)
    localhost:~ root# uname -i
  6. 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: (32-bit) and (64-bit)
    CentOS 5.10 / 32-bit

    localhost:~ root# wget
    localhost:~ root# wget
    localhost:~ root# wget
    localhost:~ root# wget
    localhost:~ root# wget
    localhost:~ root# wget

    CentOS 5.10 / 64-bit

    localhost:~ root# wget
    localhost:~ root# wget
    localhost:~ root# wget
    localhost:~ root# wget
    localhost:~ root# wget
    localhost:~ root# wget
  7. Import the GPG key for the appropriate version of CentOS
    localhost:~ root# rpm --import RPM-GPG-KEY-CentOS-5
  8. Remove the RHEL release files
    localhost:~ root# rpm -e --nodeps redhat-release
  9. Remove the Redhat Network plugin for yum
    localhost:~ root# rpm –e --nodeps yum-rhn-plugin
  10. Removing the remaining RHEL files that may be install on the system
    localhost:~ 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.

  11. Install the CentOS RPMs we downloaded previously (make sure you are still in /temp/centos)
    localhost:~ root# rpm -Uvh --force *.rpm
  12. Upgrade to CentOS from RHEL
    localhost:~ root# yum upgrade
  13. Reboot the server
  14. Verify functionality
  15. 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:

RHEL Theme Error

To fix it follow these steps:

  1. Click past the messages and get to the login screen and login
  2. Click ‘System’ and ‘Administration’ and ‘Login Screen’
  3. Select ‘CentOS Default’ so there is a dot beside it
  4. Click ‘Close’
  5. Press CTRL+ALT+BACKSPACE on your keyboard and the desktop should reload to the login screen with no error


5 thoughts on “How to convert RHEL 5.x to CentOS 5.x”

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.