I honestly don't know who asked me, but I had a PM a while back asking me if I know how to do that (he probably sent it to other people as well).
Anyway, here is the promised how-to for whoever asked (deleted all PMs, sorry).
I created a script for 32Bit and 64Bit a while back .. so either copy all that into an .sh file (and make it executable) or copy / execute each line (except for the comments obviously).
Mind you, this is for CentOS 5.4 - you will need to change he package names accordingly if you do this for different version.
RHEL 5.4 > CentOS 5.4 - 32 Bit
# Create Folder
mkdir ~/convert/
cd ~/convert/
# Rebuild the RPM Database and cleanup Yum
rm -f /etc/yum.repos.d/rhel-debuginfo.repo
rm -f /var/lib/rpm/__db*
rpm --rebuilddb
yum clean all
# Import Public Key from CentOS
su -c 'rpm --import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5'
[IMG]http://i46.tinypic.com/2cmqlpz.jpg[/IMG]
(could not post links as the forums errors out on me, hence the screenshot)
# Change the bootloader to read CentOS rather than RedHat
find /boot/grub -name "grub.conf" -exec sed -i 's/Red Hat Enterprise Linux Server/Centos 5.4/g' {} \;
# Changing Boot Splash Screen to be CentOS rather than Redhat
cp -f splash.xpm.gz /boot/grub
# Remove unnecessary RedHat packages
rpm -e --nodeps redhat-release
rpm -e --nodeps yum-rhn-plugin
# Install new CentOS packages
rpm --force -Uvh *.rpm
# Update CentOS
yum update -y
RHEL 5.4 > CentOS 5.4 - 64 Bit
# Create Folder
mkdir ~/convert/
cd ~/convert/
# Rebuild the RPM Database and cleanup Yum
rm -f /etc/yum.repos.d/rhel-debuginfo.repo
rm -f /var/lib/rpm/__db*
rpm --rebuilddb
yum clean all
# Import Public Key from CentOS
su -c 'rpm --import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5'
[IMG]http://i50.tinypic.com/9rqd0o.jpg[/IMG]
(could not post links as the forums errors out on me, hence the screenshot)
# Change the bootloader to read CentOS rather than RedHat
find /boot/grub -name "grub.conf" -exec sed -i 's/Red Hat Enterprise Linux Server/Centos 5.4/g' {} \;
# Changing Boot Splash Screen to be CentOS rather than Redhat
cp -f splash.xpm.gz /boot/grub
# Remove unnecessary RedHat packages
rpm -e --nodeps redhat-release
rpm -e --nodeps yum-rhn-plugin
# Install new CentOS packages
rpm --force -Uvh *.rpm
# Update CentOS
yum update -y
Files can also be download from the official CentOS Mirror
Index of /centos/5/os
Here are the scripts as text file :
http://ifinallygotitworking.co.uk/customfiles/convertrhel/Convert-RHEL-CentOS-32Bit.txthttp://ifinallygotitworking.co.uk/customfiles/convertrhel/Convert-RHEL-CentOS-64Bit.txt
Needless to say I don't take any responsibility if this breaks your system - always make sure you have backups / snapshots etc.
Here a few screenshots
Prior conversion you can see that everything shows RHEL 5.4 with updates disabled as the system is not registered in RHN




Make sure everything runs through without errors

After the conversion and a reboot you can see everything is CentOS 5.4 running the latest kernel (to date).

