基本動作與參考文章差不多 我再加上一些說明
1. rpm --import RPM-GPG-KEY-centos4
2. rpm -Uvh --force centos-release-4-0.1.i386.rpm
版本大於4 即可, 如果要升到最新版 就從 CentOS4 目錄抓最新版來用
3. rpm -Uvh --force centos-yumconf-4-2.noarch.rpm
這可不裝 比較後面的 CentOS 4 沒有 centos-yumconf 套件
4. 安裝新的 kernel
rpm -ivh --force --nodeps kernel-2.6.9-5.0.3.EL.i686.rpm
這裡會有一個錯誤 - 無法 mkinitrd - 因為此時沒有新版 mkinitrd
沒關係 升級完所有套件再做一次安裝一次 kernel 就會重作
ps. 有的文章過程比較複雜 如
http://www.webhostingtalk.com/archive/index.php/t-609846.html
sprintserve 寫的 Step6
cd /boot
mkinitrd kernel.img `rpm -qa|grep '^kernel'|grep 2.6|cut -f2- -d '-'`
mv initrd-2.6.9-55.EL.img initrd-2.6.9-55.EL.img.original
mv kernel.img initrd-2.6.9-55.EL.img
5. 安裝 udev
rpm -ivh --force --nodeps udev-039-10.8.EL4.i386.rpm
6. rpm --rebuilddb
在升級前, 這已經是標準動作, 先重建 rpm db
7. 設定好 yum-upgrade.conf, 然後執行
yum -c /etc/yum-upgrade.conf upgrade
這裡是一個網路安裝的範例檔 /etc/yum-upgrade.conf
注意:若有不想更新的程式請加 exclude, 如 exclude=mysql*
[main]
cachedir=/var/cache/yum
debuglevel=2
logfile=/var/log/yum.log
pkgpolicy=newest
distroverpkg=redhat-release
installonlypkgs=kernel kernel-smp kernel-hugemem kernel-enterprise kernel-debug kernel-unsupported kernel-smp-unsupported kernel-hugemem-unsupported
tolerant=1
exactarch=1
[upgrade]
name=Centos upgrade
baseurl=http://mirror.centos.org/centos/4/os/$basearch/
exclude=mysql*
[update]
name=CentOS-$releasever - Updates
baseurl=http://mirror.centos.org/centos/4/updates/$basearch/
exclude=mysql*
如果進行 yum upgrade 遇到相依性的問題,建議先移除有相依性的程式
如 imap, imap-devel, perl-DBD-MySQL
ref http://www.webhostingtalk.com/archive/index.php/t-609846.html
8. 如果沒問題, 再安裝一次 kernel
rpm -ivh --force --nodeps kernel-2.6.9-5.0.3.EL.i686.rpm
先前安裝 kernel 並非完整安裝, 此次讓他再重新安裝一次
9. rpm --rebuilddb
升級完重新開機前 再作一次
10. yum update 看看有沒有其他的要更新.
建議開完再做啦 以免發生變數
11. 更改 /boot/grub/menu.lst 指定用新的 kernel 開機
有時候 kernel 安裝後可能會因為一些問題沒有更新到 grub.conf 如果沒有就要手動加入
順便要檢查一下 kernel , initrd 檔名正不正確
12. 重開機看看. (可能會移除一些舊的 driver, 加上一些新的 driver)
MySQL 的問題
MySQL, 這個由 3.x 升到 4.1.x. 如果有裝 mysql-server, 會有問題.
我們的處理方式是先強迫安裝
rpm -Uvh --force --nodeps \
mysql-4.1.7-4.RHEL4.1.i386.rpm \
mysql-server-4.1.7-4.RHEL4.1.i386.rpm \
mysqlclient10-3.23.58-4.RHEL4.1.i386.rpm
然後在 yum-upgrade.conf 的 [main] 中加上
exclude=mysql-server mysql
後就可以避開這個問題. 至於原本的 mysql 資料庫, 原則上檔案可以相容, 並不用 dump 出來再 restore. 不過.... 如果你怕有問題... 就自己 dump 吧.
參考文章
http://phorum.study-area.org/index.php/topic,28648.html
http://www.webhostingtalk.com/archive/index.php/t-609846.html





for i in `rpm -qa|grep '^redhat-config'`; do echo $i && rpm -e $i; done
You may need to check and remove manually any that is missed.
2. Remove imap, imap-devel, perl-DBD-MySQL as you will get conflicts:
rpm -e imap imap-devel perl-DBD-MySQL
3. Install the CentOS Release RPM:
rpm -Fvh http://mirror.centos.org/centos/4.5/os/i386/CentOS/RPMS/centos-release-4-4.3.i386.rpm
rpm --import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-4
yum -y clean all
4. Upgrade Glibc first:
yum -y upgrade glibc glibc-common
5. Upgrade some of the key components you would need in the upgrade:
yum -y upgrade yum python popt rpm-libs rpm rpm-devel rpm-python libxml2
yum -y upgrade XFree86\*
5. Install the new 2.6.x kernels:
yum -y upgrade kernel kernel-smp
4. Remove old 2.4.x Kernels:
for i in `rpm -qa|grep '^kernel'|grep 2.4.21`; do echo $i && rpm -e $i; done
5. Run the Full Update:
yum -y update
You may have some conflicts etc, and you can remove those if it's unnecessary or upgrade them first.
6. Generate new kernel images as the RPM upgrade has likely generated corrupted images. This is important as otherwise on reboot, it will fail and you need to contact the DC to repair and rebuild the image in rescue mode:
cd /boot
mkinitrd kernel.img `rpm -qa|grep '^kernel'|grep 2.6|cut -f2- -d '-'`
mv initrd-2.6.9-55.EL.img initrd-2.6.9-55.EL.img.original
mv kernel.img initrd-2.6.9-55.EL.img
7. Run Kudzu just in case it detects new stuff and to speed up reboot:
/usr/sbin/kudzu
8. If you run Cpanel, run:
/scripts/upcp --force
You will still have some failures till you reboot.
9. Recompile Apache / PHP.
10. Reboot and pray. :)
Good luck