Upgrading CentOS 5 to Fedora 7

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 == , and chief among them is the 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:

  1. 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-fastestsmirror is installed before you start all this, but its not required.
  2. Now download the fedora-release and fedora-release-notes packages 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.
  3. 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.
  4. We then start by upgrading some components that it would be hard to upgrade later:

    yum upgrade -y cracklib pam
  5. 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 --oldpackage flag of rpm to force a downgrade, but I think its safer that way.
  6. 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.
  7. 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.
  8. 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 installed section use rpm -e to remove all the i386 versions of the cyrus-sasl libraries and all their dependancies.
    Then run yum upgrade cyrus-sasl
  9. We need to install the Fedora logo because a lot of UI packages require them. Start by yum upgrade gtk2-engines then we need to forcibly remove the old CentOS backgrounds package by running rpm -e desktop-backgrounds-basic --nodeps then you can install the new logos package using yum install fedora-logos
  10. We need to upgrade mkinitrd and friends so start by running

    yum install parted

    and then

    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
  11. The package structure for libhugetlbfs has changed where in CentOS 5 you have a child package libhugetlbfs-lib and 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
  12. At this point I managed to run yum upgrade -y successfully.

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 .rpmnew . 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 🙂

7 Responses to “Upgrading CentOS 5 to Fedora 7”

  1. Nick:

    Thanks! I’ve been battling to upgrade from FC6 to F7 and was struggling with a dependency issue and your selective rpm upgrade (with no-deps) method helped me with a python 2.4 to 2.5 issue. So – thanks again and if anyone is reading this, this works a charm for a FC6 issue.

  2. AJ:

    Do you this approach will work with an upgrade from CentOs to Fedora 12? Basically, same problem as yours…remote server, obsolete packages, etc.

    Thanks a bunch.

  3. Oded:

    Aj: I’m currently maintaining several CentOS 5.4 servers and for some of them I feel the pinch of not having updated packages that are available in recent Fedora releases (Like an improved OpenSSH server).

    I’ll write up a new CentOS 5 to Fedora 12 article later this week, so watch this space for updates 🙂

  4. AJ:


  5. Oded:

    Sorry, I went on army reserves duty this week. I will try to get something out by the end of the week.

  6. Oded:

    I just completed an article about the CentOS to Fedora 12 upgrade: http://geek.co.il/wp/2010/02/12/upgrading-centos-5-to-fedora-12 .

    To sum it up – it can be done remotely, and I think I’ve ironed out all of the kinks in the process, but its hard and dangerous. If something goes wrong, then its not possible to recover the server without physical access.

  7. Things n' Stuff » Blog Archive » Upgrading CentOS 5 to Fedora 12:

    […] time to update an old post about updates: Fedora 7 is again rather old, with the current Fedora being at 12, and 13 is right around the […]

Leave a Reply



Spam prevention powered by Akismet