Вы находитесь на странице: 1из 5

Migration Guide

This page was created by PhilSchaffner and addresses migration from older to new
er CentOS versions, and
from other Enterprise Linux distributions based on the same set of upstream sour
ce packages to CentOS.
Contributions by others are welcome.
<!> The actions described in this article can damage existing filesystems and op
erating systems if not done
carefully, or even if followed exactly. Please experiment first on a test box, a
nd only proceed after
creating current and tested backups if you value your data. Never blindly copy/p
aste commands,
particularly as root, without a thorough understanding of their effects. An atte
mpt to upgrade CentOS-5 to
CentOS-6 with upgradeany resulted in a non-functional system.
General considerations regarding migration:
A fresh install is generally strongly preferred over an upgrade.
Be sure you have a good (bootable or restorable) backup before doing any
thing major to a system you
care about.
It is often helpful to have a bootable linux system on a separate set of
partitions or better yet a
separate disk. This can serve as a fall-back or rescue system, a
s well as an on-line backup. Disk
space is cheap compared to sysadmin time.
Migrations from other systems based on the same set of upstream source p
ackages should be
relatively straight-forward. See FAQ/CentOS3 Question #5 "How do
I migrate a system from WBEL-3
(White Box Enterprise Linux) to CentOS 3?" for example.
You may want to upgrade the operating system parts of the filesystem and
leave user directories,
such as /home in place. If you do leave the old user home direct
ories in place expect some problems
with the GNOME/KDE menus and other desktop items. It may be pref
erable to create new user accounts
and mount the old directories somewhere else in the filesystem f
or reference, copying, or linking
user's material after the migration.
If you decide to do an upgrade anyway...
Back up anything you care about.
Remember - A fresh install is generally strongly preferred over an upgra
de.
Clean up as much as possible before the upgrade, removing any RPMS you d
o not need, or that you
know will be obsoleted.
Do an anaconda upgrade. Yum upgrades, or "live" upgrades with other pack
age managers, MAY be
possible but are often more problematic - particularly with rega
rd to glibc and kernel/drivers.
Upgrades from the immediately preceding version are more likely to be su
ccessful than upgrades
across multiple versions. For example, if you are running CentOS

3 and want to upgrade to CentOS 5,


first upgrade to the latest release of CentOS 4 (version 4.4 as
of this writing).
Upgrades from systems other than the latest CentOS (WhiteBox, RHEL, TaoL
inux, ...) may be possible
but will also require more work cleaning up afterwards. Consider
migrating to the corresponding
CentOS release before upgrading.
After upgrading use "rpm -qa --last", preferably redirected to a file or
piped to "less", to find
packages that were not updated. Left-over packages will be at th
e end of the output and will have
dates earlier than the date of the upgrade.
Remove any left-over packages that are not needed.
If you find left-over packages that have version numbers greater than or
equal to the
current-release CentOS packages, use "rpm -Uvh --oldpackage foo1.2-3.i386.rpm ... " (or possibly
the ugly "rpm -Uvh --force ..." in a pinch) to get CentOS versio
ns of packages that may have had
lower or identical version numbers to replace the obsolete packa
ges.
Find/build ELx/CentOSx (where x=2,3,4,5) versions of remaining required/
desired packages. ATrpms,
RPMforge (Dag/Dries), and EPEL (Fedora Extras for EL) Repositori
es all have ELx packages that work
with the corresponding CentOS versions. KaranbirSingh rebuilds F
edora Extras and some other
packages for CentOS. Things that can't be found there can often
be rebuilt from Fedora core or
Fedora Extras src.rpm packages, or perhaps even the FC binaries
used directly if you are feeling
lucky (not recommended). Best to start with the packages at the
Fedora/RH level from which the
corresponding EL distro was forked. For EL5/CentOS5 this was an
FC6 test version.
If older packages do not have versions that work with the current OS ver
sion, consider using
virtualization to support them by running older OS versions unde
r the current release. Viable
options include VMware and Xen.
Always beware when using/mixing 3rd-party repos. The yum protectbase or
priorities plugins are your
friends. Although both can be used together, the priorities plug
in provides more functionality and
using protectbase is unnecessary if the priorities plugin is con
figured properly. See
PackageManagement/Yum/ProtectBase and PackageManagement/Yum/Prio
rities.
Enjoy!
If upgrading, consider first "cloning" the system and upgrading the clone.
As root, create the new partitions as desired - root, boot, home, swap - ass
ume for example
/dev/hde1 ,2, 3, 4...
Make file systems

#
#
#
#
#

mke2fs
mke2fs
mkswap
mke2fs
mke2fs

-j
-j
-L
-j
-j

-L /clone_boot /dev/hdb1
-L /clone /dev/hde2
SWAP-hde3 /dev/hde3
-L /clone_home /dev/hde5
-L /clone_data /dev/hde6

Make a mountpoint for the clone, say /clone


# mkdir /clone
Mount the partition that is to be the new root on /clone, make other mount p
oints, mount all new
partitions
#
#
#
#
#

mount
mkdir
mount
mount
mount

/dev/hde2 /clone
/clone/boot /clone/home /clone/data
/dev/hde1 /clone/boot
/dev/hde5 /clone/home
/dev/hde6 /clone/data

Do the clone operation


# tar clf - /boot | tar xf - -C /clone
# tar clf - /home | tar xf - -C /clone
# tar clf - / | tar xf - -C /clone
Edit /etc/fstab, /boot/grub/grub.conf adding entries for the clone partition
s and boot stanzas
Edit /clone/etc/fstab, /clone/boot/grub/grub.conf adding entries for the ori
ginal partitions and boot
stanzas
Test-boot both systems before proceeding.
Perform the upgrade on the clone system and write grub to the boot partition
rather than the MBR
Boot the original OS and update the grub boot stanza for the new OS - former
ly clone.
Boot the new OS. Optionally, make the new OS grub the default (preferably af
ter testing)
# grub-install /dev/hda (or /dev/sda)
Can add stanzas to /boot/grub/grub/conf for other operating systems includin
g the original pre-clone
system, MS Windows, Ubuntu, FreeBSD, ...
Migration from RHEL5 to CentOS5
"All that you should need to do is install centos-release, remove redhat-rel
ease rpms and just
yum update the machine, which should bring in all packages changed by Ce
ntOS ( since they will have a
slightly higher E-V-R )." - per KaranbirSingh on centos-list
You may also wish to remove the "rhnplugin" from yum (not necessary but
gives an error msg)
OR - per Craig White on centos-list Mon, 29 Oct 2007 (updated for 5.8)...
# cp /etc/redhat-release /etc/redhat-release-saved
# rpm -e --nodeps redhat-release-notes redhat-release yum-rhn-plugin redhatlogos

# rpm -ivh \
http://mirror.centos.org/centos/5/os/i386/CentOS/centos-release-5-8.el5.cent
os.i386.rpm \
http://mirror.centos.org/centos/5/os/i386/CentOS/centos-release-notes-5.8-0.
i386.rpm \
http://mirror.centos.org/centos/5/os/i386/CentOS/redhat-logos-4.9.99-11.el5.
centos.noarch.rpm
# yum update
Sometime the rpm install using a URL may be problematic. In that case use wg
et or lftpget to get local
copies of the files and install with "rpm -ivh ...".
<!> Note: It is only possible to pull the latest 'point release' packages direct
ory from the
host: mirror.centos.org Older point release packages are relocated to: vault.cen
tos.org and so for the
foregoing example, we would use:
# cp /etc/redhat-release /etc/redhat-release-saved
# rpm -e --nodeps redhat-release-notes redhat-release yum-rhn-plugin redhat-logo
s
# rpm -ivh \
http://vault.centos.org/5.0/os/i386/CentOS/centos-release-5-0.0.el5.centos.2.i38
6.rpm \
http://vault.centos.org/5.0/os/i386/CentOS/centos-release-notes-5.0.0-2.i386.rpm
Migrating from RHEL6 or SL6 to CentOS 6
To migrate from RHEL6 to CentOS 6 fetch the latest versions of the following pac
kages for your architecture
and put them in a temporary directory. Rather than fetching packages with wget,
as shown below, the
CentOS-6 installation media can be mounted and packages installed from it. For C
entOS 6.2 x86_64
mkdir TMP
yum remove rhnlib abrt-plugin-bugzilla redhat-release-notes*
rpm -e --nodeps redhat-release redhat-indexhtml
cd TMP
wget http://mirror.centos.org/centos/6/os/x86_64/Packages/centos-release-6-2.el6
.centos.7.x86_64.rpm
wget http://mirror.centos.org/centos/6/os/x86_64/Packages/centos-indexhtml-6-1.e
l6.centos.noarch.rpm
wget http://mirror.centos.org/centos/6/os/x86_64/Packages/yum-3.2.29-22.el6.cent
os.noarch.rpm
wget http://mirror.centos.org/centos/6/os/x86_64/Packages/yum-plugin-fastestmirr
or-1.1.30-10.el6.noarch.rpm
rpm -Uvh *.rpm
cd ..
rm -rf TMP
yum clean all
yum upgrade
For CentOS 6.2 i386 only the wget lines change:
wget http://mirror.centos.org/centos/6/os/i386/Packages/centos-release-6-2.el6.c
entos.7.i686.rpm
wget http://mirror.centos.org/centos/6/os/i386/Packages/centos-indexhtml-6-1.el6
.centos.noarch.rpm

wget http://mirror.centos.org/centos/6/os/i386/Packages/yum-3.2.29-22.el6.centos
.noarch.rpm
wget http://mirror.centos.org/centos/6/os/i386/Packages/yum-plugin-fastestmirror
-1.1.30-10.el6.noarch.rpm
To migrate from Scientific Linux 6 the only change is that the "rpm -e" line bec
omes
rpm -e --nodeps sl-release sl-indexhtml
Additional changes for SL - The following will find some SL-specific packages:
rpm -qa | grep ^slrpm -qa | grep SL_
These can be removed by (for instance):
rpm -e --nodeps sl-bookmarks sl-release-notes yum-conf-sl6x SL_desktop_tweaks
One might want to download and add a few more look-and-feel items, or load them
from the CentOS DVD:
rpm -Uvh redhat-bookmarks-6-1.el6.centos.noarch.rpm redhat-logos-60.0.14-10.el6.
centos.noarch.rpm \
redhat-menus-14.0.0-3.el6.noarch.rpm redhat-rpm-config-9.0.3-34.el6.noarch.rpm
After the above, and updating, then you may want to see what additional SL packa
ges you have:
rpm -qa --qf "%{VENDOR} \n" | sort | uniq
will show all the vendor tags for installed packages. Then
rpm -qa --qf "%{NAME} %{VENDOR} \n" | grep "Scientific Linux" | cut -d ' ' -f 1
| sort
will show remaining SL packages. It is probably not strictly necessary, but you
could "purify" the system
by
yum reinstall $(rpm -qa --qf "%{NAME} %{VENDOR} \n" | grep "Scientific Linux" |
cut -d ' ' -f 1 | sort)
You may find some packages do not have CentOS equivalents as SL ships packages t
hat CentOS does not.
Repeat the previous rpm query to see what is left over.
Procedures should be similar for other closely-related distributions.

Вам также может понравиться