From Fedora Project Wiki

Revision as of 13:19, 24 October 2008 by Mcutler (talk | contribs)

Live Upgrading Remote Servers for Beginners

(Work in progress) This guide is slightly different from YumUpgradeFaq in that it addresses upgrading machines you don't have easy physical access to. There are a lot of benefits to doing this on a Server class machine, in general you won't have as many packages installed as a Desktop class machine (X/Gnome etc.) reducing some of the complexity. At the same time it opens the potential for huge problems if something does go wrong during the upgrade.


Warning

Warning.png
Once a live upgrade is started do not stop the upgrade by rebooting, killing the process, or by any other method until it is complete, doing so will cause the affected system to be in a mixed state. Partially the old release and partially the new release. In this state the system will not be reliable and will not operate as expected. The only way to recover from this is to reinstall if it occurs.


Disclaimer

I carried out this procedure on a server to which I had nothing but SSH access to. If you have physical access to the machine to be upgraded, using the install media & anaconda would be far easier. At each stage I carefully examined /boot/grub/grub.conf to ensure I would come back up on the correct kernel with each reboot. I suggest you rehearse each step carefully on a local/virtual machine before taking the plunge.


Getting Started

Idea.png
Think Minimalist
You're about to start a long journey, a journey made more lengthy and complex with each package. Carefully review everything you have installed, if you can remove unnecessary packages before you get started - do so.
  • Backup your configuration files, some packages will replace their configuration files during the upgrade. You could just [root@host ~]# tar cf etc.tar /etc and keep it in a safe place.
  • Backup, Backup, Backup any important data.
  • Shutdown unnecessary services (SMTP, HTTP, MySQL etc.) while the upgrade is taking place.
  • Prune the installed packages as much as possible, in particular packages like php are gigantic dependency web's, the upgrade will go a lot smoother and quicker if you remove things like this.
  • Fedora Core releases prior to Fedora Core 7 have been removed from the regular mirror servers, they are however available from archives.fedoraproject.org and a small selection of mirrors[1]. With each upgrade of the fedora-release package your /etc/yum.repos.d directory may need manual tweaking to select your preferred mirror.


Redhat Linux 9 -> Fedora Core 1

Firstly, you will need to manually import this GPG Key 0x4F2A6FD2 <fedora@redhat.com> to begin:

# rpm --import "http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x4F2A6FD2"

Next, to make the first step from Redhat Linux to Fedora you will need to manually install yum and its dependencies.

# rpm -Uvh --nodeps http://archives.fedoraproject.org/pub/archive/fedora/linux/core/1/i386/os/Fedora/RPMS/yum-2.0.4-2.noarch.rpm \
  http://archives.fedoraproject.org/pub/archive/fedora/linux/core/1/i386/os/Fedora/RPMS/libxml2-python-2.5.11-1.i386.rpm \
  http://archives.fedoraproject.org/pub/archive/fedora/linux/core/1/i386/os/Fedora/RPMS/gettext-0.12.1-1.i386.rpm \
  http://archives.fedoraproject.org/pub/archive/fedora/linux/core/1/i386/os/Fedora/RPMS/libxml2-2.5.11-1.i386.rpm \
  http://archives.fedoraproject.org/pub/archive/fedora/linux/core/1/i386/os/Fedora/RPMS/libgcj-3.3.2-1.i386.rpm 

Check your /etc/yum.repos.d and/or edit yum.conf archives.fedoraproject.org is the only mirror I found to contain Fedora Core 1. My example /etc/yum.conf:

[main]
cachedir=/var/cache/yum
debuglevel=2
logfile=/var/log/yum.log
pkgpolicy=newest
distroverpkg=redhat-release
tolerant=1
exactarch=1
retries=20

[base]
name=Fedora Core $releasever - $basearch - Base
baseurl=http://archives.fedoraproject.org/pub/archive/fedora/linux/core/$releasever/$basearch/os/

[updates-released]
name=Fedora Core $releasever - $basearch - Updates
baseurl=http://archives.fedoraproject.org/pub/archive/fedora/linux/core/updates/$releasever/$basearch/

And I manually removed any other repos for this stage: [root@host ~]# rm -f /etc/yum.repos.d/*

# yum upgrade

If you encounter any dependency issues at this stage, its wise to try and remove the packages causing the problem. Getting a trouble-free yum upgrade at this stage is ideal.


Fedora Core 1 -> Fedora Core 2

see also [2]

# rpm -Uvh http://archives.fedoraproject.org/pub/archive/fedora/linux/core/2/i386/os/Fedora/RPMS/fedora-release-2-4.i386.rpm \
  http://archives.fedoraproject.org/pub/archive/fedora/linux/core/2/i386/os/Fedora/RPMS/yum-2.0.7-1.1.noarch.rpm
# yum upgrade

During the upgrade process I encountered this error:

Kernel Updated/Installed, checking for bootloader
Grub found - making this kernel the default
Traceback (most recent call last):
  File "/usr/bin/yum", line 30, in ?
    yummain.main(sys.argv[1:])
  File "/usr/share/yum/yummain.py", line 375, in main
    pkgaction.kernelupdate(tsInfo)
  File "/usr/share/yum/pkgaction.py", line 611, in kernelupdate
    up2datetheft.install_grub(kernel_list)
  File "/usr/share/yum/up2datetheft.py", line 13, in install_grub
    import grubcfg
  File "/usr/share/yum/grubcfg.py", line 12, in ?
    import iutil
  File "/usr/share/yum/iutil.py", line 2, in ?
    import types, os, sys, select, string, stat, signal
ImportError: No module named select

The upgrade appeared to complete successfully but failed while trying to set the default kernel. Edit /boot/grub/grub.conf manually set "default=0" to boot the correct kernel.


Fedora Core 2 -> Fedora Core 3

see also [3] Firstly a little preparation:

  • Create/edit the file /etc/sysconfig/selinux
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#       enforcing - SELinux security policy is enforced.
#       permissive - SELinux prints warnings instead of enforcing.
#       disabled - SELinux is fully disabled.
SELINUX=permissive
# SELINUXTYPE= type of policy in use. Possible values are:
#       targeted - Only targeted network daemons are protected.
#       strict - Full SELinux protection.
SELINUXTYPE=targeted

# SETLOCALDEFS= Check local definition changes
SETLOCALDEFS=0
  • Create the following directory and use touch to put an empty file there:
# mkdir -p /etc/security/selinux
# touch /etc/security/selinux/file_contexts
  • Now remove up2date
# rpm -e up2date
  • Remove any previous kernels (careful not to remove the one you're currently running)
# rpm -q -a kernel
kernel-2.4.20-8
kernel-2.4.22-1.2199.nptl
kernel-2.6.10-1.771_FC2
# rpm -e kernel-2.4.20-8 kernel-2.4.22-1.2199.nptl

Now we're ready to proceed with the upgrade:

# rpm -Uvh http://archives.fedoraproject.org/pub/archive/fedora/linux/core/updates/3/i386/yum-2.2.2-0.fc3.noarch.rpm \
  http://archives.fedoraproject.org/pub/archive/fedora/linux/core/3/i386/os/Fedora/RPMS/fedora-release-3-8.i386.rpm
# yum upgrade

Lastly, we need to clean up the old kernel:

# rpm -e kernel-2.6.10-1.771_FC2


Fedora Core 3 -> Fedora Core 4

see also [4] This time, we need to upgrade the kernel on its own first, and then reboot before continuing with the full upgrade:

# rpm -Uvh http://archives.fedoraproject.org/pub/archive/fedora/linux/core/4/i386/os/Fedora/RPMS/fedora-release-4-2.noarch.rpm
# yum upgrade kernel

After rebooting we remove the old FC3 kernel and then continue with the upgrade.

# rpm -e kernel-2.6.12-1.1381_FC3
# yum upgrade


Fedora Core 4 -> Fedora Core 5

see also [5]

# rpm -Uvh http://archives.fedoraproject.org/pub/archive/fedora/linux/core/5/i386/os/Fedora/RPMS/fedora-release-5-5.noarch.rpm
# yum upgrade


Fedora Core 5 -> Fedora Core 6

see also [6]

# rpm -Uvh http://archives.fedoraproject.org/pub/archive/fedora/linux/core/6/i386/os/Fedora/RPMS/fedora-release-6-4.noarch.rpm \
  http://archives.fedoraproject.org/pub/archive/fedora/linux/core/6/i386/os/Fedora/RPMS/fedora-release-notes-6-3.noarch.rpm
# yum upgrade


Fedora Core 6 -> Fedora Core 7

see also [7] Before we continue to Fedora Core 7 you must ensure that all your mounts have volume labels. Fedora Core 7 and its updates are currently available from most mirrors, you may wish to use your own preferred mirror from this step onwards.

# rpm -Uvh http://ftp.heanet.ie/mirrors/fedora/linux/releases/7/Everything/i386/os/Fedora/fedora-release-7-3.noarch.rpm \
  http://ftp.heanet.ie/mirrors/fedora/linux/releases/7/Everything/i386/os/Fedora/fedora-release-notes-7.0.0-1.noarch.rpm
# yum upgrade


Fedora Core 7 -> Fedora Core 8

see also [8]

# rpm -Uvh http://ftp.heanet.ie/mirrors/fedora/linux/releases/8/Everything/i386/os/Packages/fedora-release-8-3.noarch.rpm \
  http://ftp.heanet.ie/mirrors/fedora/linux/releases/8/Everything/i386/os/Packages/fedora-release-notes-8.0.0-3.noarch.rpm
# yum upgrade


Fedora Core 8 -> Fedora Core 9

see also [9]

# rpm -Uvh http://ftp.heanet.ie/mirrors/fedora/linux/releases/9/Everything/i386/os/Packages/fedora-release-9-2.noarch.rpm \
  http://ftp.heanet.ie/mirrors/fedora/linux/releases/9/Everything/i386/os/Packages/fedora-release-notes-9.0.0-1.noarch.rpm
# yum upgrade