How to convert RHEL5 to CentOS5

# Determine version and architecture of installed RHEL
cat /etc/redhat-release
uname -i

# Go to working directory
mkdir /root/centos5

cd /root/centos5
# Download the necessary files
wget http://mirror.umd.edu/centos/5.8/os/x86_64/CentOS/centos-release-notes-5.8-0.x86_64.rpm
wget http://mirror.umd.edu/centos/5.8/os/x86_64/CentOS/centos-release-5-8.el5.centos.x86_64.rpm
wget http://mirror.umd.edu/centos/5.8/os/x86_64/CentOS/yum-3.2.22-39.el5.centos.noarch.rpm
wget http://mirror.umd.edu/centos/5.8/os/x86_64/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm
wget http://mirror.umd.edu/centos/5.8/os/x86_64/CentOS/yum-utils-1.1.16-21.el5.centos.noarch.rpm
wget http://mirror.umd.edu/centos/5.8/os/x86_64/RPM-GPG-KEY-CentOS-5

# Import the rpm gpg signing key
rpm --import RPM-GPG-KEY-CentOS-5

# Remove the following packages
rpm -e --nodeps redhat-release-5Server
rpm -e yum-rhn-plugin rhn-check rhnsd rhn-setup rhn-client-tools rhncfg rhncfg-client rhncfg-actions subscription-manager

# Force install the five rpm files in the working directory
rpm -Uvh --force *.rpm

# Yum update the system
yum update

# Reboot
shutdown -r now

# To avoid confusion later
sed -i 's/Red Hat Enterprise Linux Server/CentOS Server/g' /boot/grub/grub.conf