Knowledgebase
Upgrade from CentOS 4 to CentOS 5
Posted by Chris Gebhardt on June 03 2013 11:45 AM

It is technically feasible to update a CentOS 4 system to CentOS 5.   The following guide is based on a 32-bit system and has been tested to function.

Important note: VIRTBIZ makes this procedure available as a convenience and does not warrant it for use on any particular system. Although you may obtain good results by simply copy & pasting the commands below, it is also possible that you may completely destroy the running system and lose all data.  VIRTBIZ is unable to accept any responsibility for the use of this procedure.   Proceed only if you understand all the caveats that come with performing an in-place OS upgrade on your server and are willing to accept all responsibility for downtime or data-loss that may be involved in the event this procedure does not work for you.

First, set 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 that your CentOS 4.x is as up-to-date as possible, understanding that yum update will fail unless you have moved to archive repositories. For more information on archive repos, please see https://www.centos.org/modules/newbb/viewtopic.php?topic_id=36539

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 CentOS 5 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

 

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

 

One Last Upgrade To Install CentOS 5 packages

 

yum upgrade

(0 vote(s))
Helpful
Not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments: