Upgrading CentOS 32bit 4.x to 32bit 5.x
We have found the following guide very useful in this process. This works for both dedicated servers as well as VPS nodes:
cPanel Servers
If your server has cPanel installed you first need to remove filesystem from the exclude line in /etc/yum.conf. If you don’t the yum upgrade procedures below will fail.
Setting file attributes
chattr -Ria /bin chattr -Ria /etc chattr -Ria /etc chattr -Ria /include chattr -Ria /lib chattr -Ria /sbin chattr -Ria /usr/bin chattr -Ria /usr/include chattr -Ria /usr/lib chattr -Ria /usr/libexec chattr -Ria /usr/local/bin chattr -Ria /usr/local/include chattr -Ria /usr/local/lib chattr -Ria /usr/local/sbin chattr -Ria /usr/sbin chattr -Ria /usr/share chattr -Ria /var/lib chattr -Ria /var/lock chattr -Ria /var/log chattr -Ria /var/run chattr -Ria /var/spool/repackage
Ensure CentOS 4.x is up-to-date
rpm --rebuilddb yum clean all yum update rm -f /var/lib/rpm/__db.00* rpm --rebuilddb
Remove and Install Packages
rpm -e lftp syslinux mkbootdisk
rpm -Uvh http://vault.centos.org/5.0/os/i386/CentOS/centos-release-5-0.0.el5.centos.2.i386.rpm http://vault.centos.org/5.0/os/i386/CentOS/centos-release-notes-5.0.0-2.i386.rpm mv /etc/yum.repos.d/CentOS-Base.repo.rpmnew /etc/yum.repos.d/CentOS-Base.repo
Install CentOS5 Kernel
rpm -ivh --nodeps http://vault.centos.org/5.0/os/i386/CentOS/kernel-2.6.18-8.el5.i686.rpm http://vault.centos.org/5.0/os/i386/CentOS/kernel-devel-2.6.18-8.el5.i686.rpm
Remove Old Kernels
rpm -e $(rpm -qa | grep kernel | grep -v 2.6.18 | tr '\n' ' ') --nodeps
Remaining Packages Upgrade
rpm -e --justdb python-elementtree --nodeps yum clean all yum upgrade
yum upgrade
Fix RPM System
rm -f /var/lib/rpm/__db.00* rpm --rebuilddb
rpm -Uvh --force http://vault.centos.org/5.0/os/i386/CentOS/python-elementtree-1.2.6-5.i386.rpm http://vault.centos.org/5.0/os/i386/CentOS/python-sqlite-1.1.7-1.2.1.i386.rpm
yum clean all
The filesystem and perl excludes have to be removed from the /etc/yum.conf otherwise you will see dependency issues.
rm -f /var/cpanel/sysinfo.config /scripts/gensysinfo /scripts/upcp --force /scripts/mysqlup --force /scripts/easyapache --build
[root@server1]# yum clean all
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:
It’s possible that the above module doesn’t match the
current version of Python, which is:
2.4.3 (#1, Sep 3 2009, 15:37:12)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)]
To fix this download the latest python-sqlite rpm from CentOS 5.10 mirror and perform a forceful upgrade.
root@server1]# rpm -Uvh python-sqlite-1.1.7-1.2.1.i386.rpm –force
Preparing… ########################################### [100%]
1:python-sqlite ########################################### [100%]
[root@server1]# yum clean all
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Cleaning up Everything