Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We currently have our website and website's CMS hosted on a dedicated host which runs Red Hat. We want to remove Red Hat and install CentOS instead.

My question: is there a straight forward way of replicating all the server settings, PHP, Apache, SQL data, website files, and CMS settings from the Red Hat install, and moving them over to a new CentOS install?

To make things easier, I don't mind installing the equivalent version of CentOS, based on the Red Hat version we currently have. So if we have Red Hat 6.0, I am happy to install CentOS 6.0 if it makes things more straight forward.

The CMS we use is Express Engine.

share|improve this question
Maybe there is non real need to migrate: coud be enough to change the repos config to Centos repos. – DavAlPi May 23 '13 at 13:30
@DavAlPi, that's pretty much what my answer details. – slm May 23 '13 at 18:45

This is one approach. You can convert the existing system from RHEL to CentOS without having to move the software from the box itself. This can be a risky option but I've used this process myself and it does work. Backups are a must prior to doing something like this.

General Steps

Remove any remnants of RHEL from yum:

yum clean all

Setup a directory for CentOS downloads:

mkdir ~/centos && cd ~/centos/

CentOS 5.x steps

# download RPMs
wget http://mirror.centos.org/centos/5.4/os/i386/RPM-GPG-KEY-CentOS-5
wget http://mirror.centos.org/centos/5.4/os/i386/CentOS/centos-release-5-4.el5.centos.1.i386.rpm
wget http://mirror.centos.org/centos/5.4/os/i386/CentOS/centos-release-notes-5.4-4.i386.rpm   
wget http://mirror.centos.org/centos/5.4/os/i386/CentOS/yum-3.2.22-20.el5.centos.noarch.rpm
wget http://mirror.centos.org/centos/5.4/os/i386/CentOS/yum-updatesd-0.9-2.el5.noarch.rpm

# import GPG key
rpm --import RPM-GPG-KEY-CentOS-5

# remove rhel
rpm -e --nodeps redhat-release

# remove Red Hat Network files
rpm -e rhn-client-tools rhn-setup rhn-check rhn-virtualization-common rhnsd

CentOS 6.x steps

# download RPMs
wget http://mirror.centos.org/centos/6.0/os/x86_64/RPM-GPG-KEY-CentOS-6
wget http://mirror.centos.org/centos/6.0/os/x86_64/Packages/centos-release-6-0.el6.centos.5.x86_64.rpm
wget http://mirror.centos.org/centos/6.0/os/x86_64/Packages/yum-3.2.27-14.el6.centos.noarch.rpm
wget http://mirror.centos.org/centos/6.0/os/x86_64/Packages/yum-utils-1.1.26-11.el6.noarch.rpm
wget http://mirror.centos.org/centos/6.0/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.26-11.el6.noarch.rpm

# import GPG keys
rpm --import RPM-GPG-KEY-CentOS-6

# remove rhel
rpm -e --nodeps redhat-release-server

# remove Red Hat Network files
rpm -e rhn-check rhnsd rhn-setup rhn-setup-gnome

After doing either steps for 5.x or 6.x above install RPMs

rpm -Uvh --force *.rpm

Upgrade the system

yum upgrade

And reboot.

share|improve this answer

CentOS has as one of its central objectives to be binary compatible with the corresponding Red Hat Enterprise release, so it should be just a matter of installing the same package set (check out kickstart, it should give you a way of creating a script to replicate the installed system) and copying the relevant files over. It can get tricky when configuration scattered all over the place is involved, si I'd do the following:

  • Check all required functionality, create scripts (preferrably machine-run, but a hand-done one will do) to check it works as it should. Yes, this can be long and drawn out, but having it will be useful for lots of later updates/upgrades. Yes, you will forget some, just don't forget to add them later.
  • Install another machine to make the mirror of the existing setup. Copy all the site over, run your test battery against both. Figure out the reason for discrepancies, fix them. Rinse and repeat.
  • Swap the existing machine with the new setup, run the test battery against the live site now. Figure out the reason for discrepancies, fix them. Rinse and repeat.
  • Go live with the new machine, keep an eye on any reports by users. Check the logs for any unexpected messages. Keep the original machine (or at least the disks, or at the very, very least a full backup) around for a few months.
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.