Note: There is a risk the below can leave your server unbootable. I have personally used this method multiple times with out issues, but you may run into unexpected problems with RPM conflicts that are not covered here.
Its possible to upgrade centos 3 -> 4 -> 5. This tutorial is for centos 3 to 4. For centos 4 to 5 see http://www.interserver.net/forum/threads/upgrading-centos-4-to-5.249/
For those hosted with interserver we do this migration included with our support. Contact support for this upgrade.
cPanel Server Notes: You will need to uncomment the exclude line in /etc/yum.conf. Make sure to re-exclude that when done and reinstall perl from layer1.cpanel.net as well as run easyapache.
Step 1: Compile a custom kernel. It is best to have a custom kernel ready. This is not covered in the tutorial.
Step 2: Remove RPM’s that conflict. There may be other but I have found issues with the following sets of rpms.
for example run
yum remove net-snmp
Step 3: Start upgrade process install needed rpm’s
rpm -Uvh http://vault.centos.org/4.9/os/i386/CentOS/RPMS/yum-2.4.3-4.el4.centos.noarch.rpm http://vault.centos.org/4.9/os/i386/CentOS/RPMS/python-elementtree-1.2.6-5.el4.centos.i386.rpm http://vault.centos.org/4.9/os/i386/CentOS/RPMS/python-urlgrabber-2.9.8-2.noarch.rpm http://vault.centos.org/4.9/os/i386/CentOS/RPMS/yum-metadata-parser-1.0-8.el4.centos.i386.rpm http://vault.centos.org/4.9/os/i386/CentOS/RPMS/python-sqlite-1.1.7-1.2.1.i386.rpm http://vault.centos.org/4.9/updates/i386/RPMS/python-2.3.4-14.10.el4.i386.rpm http://vault.centos.org/4.9/os/i386/CentOS/RPMS/sqlite-3.3.6-2.i386.rpm http://vault.centos.org/4.9/os/i386/CentOS/RPMS/db4-4.2.52-7.3.el4.i386.rpm http://vault.centos.org/4.9/os/i386/CentOS/RPMS/db4-devel-4.2.52-7.3.el4.i386.rpm --force --nodeps rpm -Uvh http://vault.centos.org/4.9/updates/i386/RPMS/centos-release-4-9.1.i386.rpm rpm -Uvh http://vault.centos.org/4.9/updates/i386/RPMS/libxml2-2.6.16-12.9.i386.rpm http://vault.centos.org/4.9/updates/i386/RPMS/libxml2-devel-2.6.16-12.9.i386.rpm http://vault.centos.org/4.9/updates/i386/RPMS/libxml2-python-2.6.16-12.9.i386.rpm rpm -Uvh http://vault.centos.org/4.9/os/i386/CentOS/RPMS/filesystem-2.3.0-1.i386.rpmtp://vault.centos.org/3.9/os/i386/RedHat/RPMS/elfutils-libelf-devel-0.94.1-2.i386.rpm rpm -Uvh http://vault.centos.org/3.9/os/i386/RedHat/RPMS/beecrypt-devel-3.0.1-0.20030630.i386.rpm rpm -Uvh http://vault.centos.org/3.9/os/i386/RedHat/RPMS/elfutils-libelf-devel-0.94.1-2.i386.rpm # custom compiled RPM, not part of centos 3. Required for the upgrade. rpm -Uvh http://mirror.trouble-free.net/tf/migrate/rpms/popt-1.9.1-32_nonptl.i386.rpm http://mirror.trouble-free.net/tf/migrate/rpms/rpm-4.3.3-32_nonptl.i386.rpm http://mirror.trouble-free.net/tf/migrate/rpms/rpm-build-4.3.3-32_nonptl.i386.rpm http://mirror.trouble-free.net/tf/migrate/rpms/rpm-devel-4.3.3-32_nonptl.i386.rpm http://mirror.trouble-free.net/tf/migrate/rpms/rpm-libs-4.3.3-32_nonptl.i386.rpm http://mirror.trouble-free.net/tf/migrate/rpms/rpm-python-4.3.3-32_nonptl.i386.rpm
The RPM rpms (for the rpm software) are custom compiled. They are centos 4 RPM’s built on a centos 3 server. These are no part of centos 3 or 4. After the yum upgrade the rpm’s from centos 4 will be used. This was a step I found that was required. There was a unresolvable conflict that stopped the upgrade otherwise.
Step 4: Set yum config files (this expects replace to be available)
cp -a /etc/yum.repos.d /root/tmp/yum.repos.d.centos3 cd /etc/yum.repos.d replace mirror.centos.org/centos/ vault.centos.org/ -- * replace mirror.trouble-free.net/centos vault.centos.org -- * replace mirrorlist \#mirrorlist -- * replace \#baseurl baseurl -- * replace \$releasever 4.9 -- * # need gpg key rpm --import http://vault.centos.org/4.9/os/i386/RPM-GPG-KEY
Step 5: remove old kernels (you compiled a custom kernel right?)
for i in `rpm -qa | grep -i kernel | grep 2.4`; do rpm -e $i --nodeps; done
Step 6: Yum upgrade
yum upgrade yum clean all yum update
If you get a conflict above you then some RPM’s are incompatible with centos 4.
Step 7: dev entries (may not be needed)
MAKEDEV null MAKEDEV console MAKEDEV ptmx MAKEDEV pty mount /dev/pts
That is it. At this point it would be safe to reboot, or continue to upgrade to centos 5 from centos4. You should ensure a kernel RPM has been installed as well.