CentOS 5 has been out for a little while now and I still haven’t had a chance to install and play with it. Today, though, I was able to make excuse to start on it. I actually created it on a virtual server though, and it’s much easier for me to just copy an existing file system over to a new virtual server than it is to create an entirely new file system. So, I started googling for ways to upgrade rather than do a fresh install.
I came across these instructions on how to upgrade an x86_64 architecture, and kindof adapted them to the i386 architecture that I was using. There was lots of trial an error to get it working, but overall it only took about two hours. I’m looking back in my history to make sure I got all of the important stuff. These instructions are based off of that. I’ll revise the instructions to get more exact the next time I try this.
Note, the CentOS5 mirror that I used can be changed for a mirror of your choice. If you are going to be doing this more than a couple times, I’d suggest setting up your own private repository so that you just download everything once. You can use this command to rsync to your local mirrors server:
/usr/bin/rsync -aqzH --delete mirror.chpc.utah.edu::CentOS/5.0/ /home/mirrors/centos/5.0
Again, adjust the mirror server to one that is close to you. You can find a good one on this list
Remove un-necessary packages
yum erase http* php* mysql* autofs glibc-kernheaders
Download and install the centos-release stuff:
wget http://centos.sd2.mirrors.redwire.net/5.0/os/i386/CentOS/centos-release-notes-5.0.0-2.i386.rpm wget http://centos.sd2.mirrors.redwire.net/5.0/os/i386/CentOS/centos-release-5-0.0.el5.centos.2.i386.rpm rpm -Uvh centos-release*
Install the CentOS5 GPG Key
rpm --import http://mirrors.kernel.org/centos/RPM-GPG-KEY-CentOS-5
Create a file called ‘files’ and add this content:
rpm-libs-4.4.2-37.el5.i386.rpm rpm-4.4.2-37.el5.i386.rpm yum-3.0.5-1.el5.centos.2.noarch.rpm rpm-python-4.4.2-37.el5.i386.rpm popt-1.10.2-37.el5.i386.rpm glibc-2.5-12.i386.rpm glibc-common-2.5-12.i386.rpm beecrypt-4.1.2-10.1.1.i386.rpm glibc-headers-2.5-12.i386.rpm glibc-devel-2.5-12.i386.rpm binutils-126.96.36.199.6-2.el5.i386.rpm elfutils-libelf-0.125-3.el5.i386.rpm elfutils-0.125-3.el5.i386.rpm elfutils-libs-0.125-3.el5.i386.rpm beecrypt-python-4.1.2-10.1.1.i386.rpm python-2.4.3-19.el5.i386.rpm python-devel-2.4.3-19.el5.i386.rpm python-elementtree-1.2.6-5.i386.rpm python-sqlite-1.1.7-1.2.1.i386.rpm python-urlgrabber-3.1.0-2.noarch.rpm neon-0.25.5-5.1.i386.rpm libxml2-2.6.26-2.1.2.i386.rpm libxml2-python-2.6.26-2.1.2.i386.rpm db4-4.3.29-9.fc6.i386.rpm libselinux-1.33.4-2.el5.i386.rpm libsepol-1.15.2-1.el5.i386.rpm mcstrans-0.1.10-1.el5.i386.rpm m2crypto-0.16-6.el5.1.i386.rpm krb5-libs-1.5-17.i386.rpm openssl-0.9.8b-8.3.el5.i386.rpm readline-5.1-1.1.i386.rpm
Then run this to download them all:
for file in `cat files` do wget http://centos.sd2.mirrors.redwire.net/5.0/os/i386/CentOS/$file done
Then install them all:
rpm -Uvh *.rpm --nodeps
Clean up some old stuff:
rm -f /var/lib/rpm/__* rpm --rebuilddb yum clean all
Download and install the new kernel (This doesn’t do anything for me since I’m on a virtual server who’s kernel is controlled by the host. But it’s already running 2.6.20, so it should have any features that 2.6.18 uses)
wget http://centos.sd2.mirrors.redwire.net/5.0/os/i386/CentOS/kernel-2.6.18-8.el5.i686.rpm wget http://centos.sd2.mirrors.redwire.net/5.0/os/i386/CentOS/kernel-headers-2.6.18-8.el5.i686.rpm rpm -ivh kernel-* --nodeps
Now upgrade all of the packages:
And re-install stuff that you removed before starting:
yum install mysql mysql-server httpd php
6 thoughts on “Upgrading CentOS 4.4 to CentOS 5 with yum”
Finally a clear and effective Centos upgrade guide for Centos 4.4 to Centos 5.
I will post this also on my blog.
Thanks for the recipe. Did have a couple of problems:
When doing the upgrade of the kernel rpm’s, after the “Clean up some old stuff”, I had to link some libraries to make wget happy:
ln -s /lib/libssl.so.0.9.8b /lib/libssl.so.4
ln -s /lib/libcrypto.so.0.9.8b /lib/libcrypto.so.4
There was also a typo in the wget for the kernel headers. The following URL works:
I had to add –force to the rpm commands as the –nodeps was still giving me a file conflict error message.
Hope I haven’t screwed up my servers.
Thanks for instructions!
Ok, I did royally screw up my servers. Of all the stupid things to do, I started upgrading 3 server at the same time.
Re the instructions, a reboot is needed after installing the new kernel. Next, most items, notably initscripts.rpm, won’t install as long as the old kernels exist on the server, so the old kernels have to be deleted along with items like kernel-utils, kernel-smp and so on.
Next, yum upgrade gave dozens of dependency errors. The way around that was to do a yum upgrade sane* first because it had the smallest number of errors (3 or 4). So I deleted the packages it choked on with rpm -e –nodeps and reinstalled the deleted packages via yum install one by one.
I lost my GUI drivers for some reason till I yum installed xorg-x11-drivers. Wonder why this was skipped.
After two days of effort, all 3 servers are back up. Only one of them I had to force install most things becuase of a wierd problem.
All 3 servers being identically configured had 5 kernels to begin with. On two after reboot, I removed all the pre Centos5 ones and 3/4 hours later had upgraded everything.
On the 3rd server, yum still gives me dependency errors for a number of rpm’s saying I have the older 4 kernels, but yum list and rpm -qa don’t show them.
… just do a clean install. I think I will stay away from upgrading from 4 to 5… too risky.
3 days? you sure got a lot of time to spare. If you backup everything and clean install… i think you can be done in less than 3 days and without much headaches.
This is really helpful. Thanks lot