It can be argued that doing so is not the smartest thing ever, but I needed some new features available in Fedora 7 and not in CentOS 5, and I needed them on a remote server that I couldn’t just go to and re-install. So I figured both operating system are based on a previous version of Fedora (I think both are based on Fedora Core 6, but CentOS 5 may be based on Fedora Core 5), so it should be easy enough to upgrade from the older to the newer ?
Well, not really – but this is how to do it:
The main problem is that CentOS 5 ships with Python 2.4 and its not going to change, while Fedora 7 has Python 2.5 – this is a problem because a lot of Fedora/Redhat/CentOs packages depend on the specific version of Python, and require python-abi ==
yum software manager, which is essential to getting an upgrade done right w/o spending several days manually updating packages. The consequences of this specific ABI version requirements is that you can’t actually upgrade yum before you upgrade every single python and python dependent package on the system – which is very hard to do, if not impossible.
But one can manually work around the problem:
- Start by doing a full upgrade on your CentOS installation, using the CentOS repositories:
yum upgrade -y
It’ll help if you’d make sure that
yum-fastestsmirroris installed before you start all this, but its not required.
- Now download the
fedora-release-notespackages from a Fedora 7 mirror (look for mirrors in the Fedora Project web site.
It’ll help if you also download the CentOS release and release notes packages from a current CentOS mirror, to serve as backup in case you want to abort and revert the changes.
- You can now install the Fedora release packages:
rpm -Uhv fedora-release*
This will bring in the configuration for Fedora repositories and will remove the CentOS repositories.
- We then start by upgrading some components that it would be hard to upgrade later:
yum upgrade -y cracklib pam
- Now its time for the real work – from the Fedora mirror download the following packages:
now you need to install them over the current versions. This will create conflicts (otherwise we could have done it using yum), which we’ll ignore for now. Start by removing the CentOS python-urlgrabber by running
rpm -e --nodeps python-urlgrabber
And then install the new packages using:
rpm -Uhv --repackage --nodeps python-urlgrabber python python-libs yum rpm rpm-libs rpm-python yum-metadata-parser
We needed to remove the old python-urlgrabber manually because for some reason Fedora 7 ships an older version of python-urlgrabber then CentOS. We could have used the
--oldpackageflag of rpm to force a downgrade, but I think its safer that way.
- Now execute
yum clean all. This should run without problems, if it doesn’t – its a good time to abort and go to your server to upgrade it manually using a CD. Its probably possible to recover from this state (back to CentOS 5 or continue with the upgrade), but I never encountered a problem in this stage and you shouldn’t either if you followed all the steps precisely (and nothing major has changed in the software configuration of Fedora 7 or CentOS 5 since this article came out). If you need help, e-mail me or comment below.
- Now that yum is running, we can start with the upgrade process. I usually start by issuing a system upgrade and then help yum manually with each problem it encounters, so following are some pre-upgrade steps that I had to do before I could manage a full upgrade. This was done an x86_64 architecture which is somewhat complicated as a lot of packages are installed in both their x86_64 and their i386 versions, and that makes life difficult for yum. In most cases it is easy to solve this by simply removing the redundant i386 package and then letting yum try again. The i386 architecture shouldn’t have these problems.
- I needed to upgrade cyrus-sasl manually, but first I had to get rid of all the i386 versions of the libraries, so run
yum list cyrus-sasl*
And from under the
rpm -eto remove all the i386 versions of the cyrus-sasl libraries and all their dependancies.
yum upgrade cyrus-sasl
- We need to install the Fedora logo because a lot of UI packages require them. Start by
yum upgrade gtk2-enginesthen we need to forcibly remove the old CentOS backgrounds package by running
rpm -e desktop-backgrounds-basic --nodepsthen you can install the new logos package using
yum install fedora-logos
- We need to upgrade mkinitrd and friends so start by running
yum install parted
yum upgrade mkinitrd
On x86_64 platforms you may have problems with these steps, so for every problematic package, make sure to remove the redundant i386 package like so:
rpm -e mkinitrd.i386
- The package structure for
libhugetlbfshas changed where in CentOS 5 you have a child package
libhugetlbfs-liband this is no longer the case with Fedora 7. So we need to manually remove the old versions and install the new one. Again – on x86_64 platform make sure to remove the i386 versions first before continuing.
rpm -e libhugetlbfs-lib libhugetlbfs
yum install libhugetlbfs
- At this point I managed to run
yum upgrade -ysuccessfully.
The last stage will install all the updates and dependencies, and will also generate a lot of warnings about configuration files not matching and a new configuration file saved as
. Most of these are harmless, and after you verify that the new file is indeed reasonably the same as the old file, by using the diff command:
diff -u <filename> <filename>.rpmnew
(if there is no ouput from that command, then the files are identical)
Then you can move the new file over the old file:
mv -f <filename>.rpmnew <filename>
If there are differences, then its a good idea to consolidate them somehow – by knowing what the configuration is all about and using a good merge tool such as
meld. If the files are identical, it probably means that there is some slight change in whitespace or permissions that screws up the RPM configuration file handling, in which case we want to have the “newer” file as the real file, because that file has the correct checksum for the newly installed package. You’d also probably going to get a lot of SELinux output when the selinux packages get installed – don’t worry about it, its just verbose output.
At this point most of the system should be almost completely Fedora 7. There are probably some CentOS packages still installed, probably due to Fedora 7 shipping older packages then what is available currently on CentOS 5, you can mostly leave them where they are and hope that Fedora 7 will eventually have updates for these and they’ll go away. We can list this old packages using
rpm -qa | grep el5 (“el5” for Enterprise Linux 5).
The listed stages upgrade the entire operating system to the new version – including the kernel, but do not select the new kernel for default booting – which we’d want to do if we did the install remotely and would want next to restart the system and wait for it to load with the a complete Fedora 7 system. To configure the boot kernel, make sure
system-config-boot is installed and run it (if you have an X that can present the graphical configuration dialog), or edit /etc/grub.conf manually to change the default line and run
grub-install (if you are doing the setup from an MS-Windows computer).
Now we can reboot and cross our fingers