2012年6月25日 星期一

CentOS 4 upgrade CentOS 5

Monday, February 04, 2008

CentOS 4 upgrade CentOS 5

CentOS4 升�到 CentOS5 有�麻�
�了好�次 �算整理出一�比��利的

以下是 CentOS4.6 升�到 CentOS5.1 �程
安�之前����以上 telnet session, 因�升��程中(Step2) 就�法再�新的��
另外�停服�先停 以免�生一些�事 尤其是�料�如 mysql

1.
首先先安� centos-release 套件
centos-release-5-1.0.el5.centos.1.i386.rpm
centos-release-notes-5.1.0-2.i386.rpm

rpm -Uvh centos-release-5-1.0.el5.centos.1.i386.rpm centos-release-notes-5.1.0-2.i386.rpm

2.
安�升�前套件
下�以下 rpm 放在 /tmp/Upgrades, 以下� 5.1
beecrypt-4.1.2-10.1.1.i386.rpm
beecrypt-python-4.1.2-10.1.1.i386.rpm
binutils-2.17.50.0.6-5.el5.i386.rpm
db4-4.3.29-9.fc6.i386.rpm
elfutils-0.125-3.el5.i386.rpm
elfutils-libelf-0.125-3.el5.i386.rpm
elfutils-libs-0.125-3.el5.i386.rpm
glibc-2.5-18.i686.rpm
glibc-common-2.5-18.i386.rpm
glibc-devel-2.5-18.i386.rpm
glibc-headers-2.5-18.i386.rpm
krb5-libs-1.6.1-17.el5.i386.rpm
libselinux-1.33.4-4.el5.i386.rpm
libsepol-1.15.2-1.el5.i386.rpm
libxml2-2.6.26-2.1.2.i386.rpm
libxml2-python-2.6.26-2.1.2.i386.rpm
m2crypto-0.16-6.el5.1.i386.rpm
mcstrans-0.2.6-1.el5.i386.rpm
neon-0.25.5-5.1.i386.rpm
openssl-0.9.8b-8.3.el5_0.2.i686.rpm
popt-1.10.2-47.el5.i386.rpm
python-2.4.3-19.el5.i386.rpm
python-devel-2.4.3-19.el5.i386.rpm
python-elementtree-1.2.6-5.i386.rpm
python-sqlite-1.1.7-1.2.1.i386.rpm
python-urlgrabber-3.1.0-2.noarch.rpm
readline-5.1-1.1.i386.rpm
rpm-4.4.2-47.el5.i386.rpm
rpm-libs-4.4.2-47.el5.i386.rpm
rpm-python-4.4.2-47.el5.i386.rpm
yum-3.0.5-1.el5.centos.5.noarch.rpm

�行安�
cd /tmp/Upgrades
rpm -Uvh *.rpm --nodeps --force

3.
��一下 yum upgrade �生的��
[root@test Upgrades]# yum -c /etc/yum-upgrade.conf upgrade
Traceback (most recent call last):
File "/usr/bin/yum", line 4, in ?
import yum
File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 36, in ?
import config
File "/usr/lib/python2.4/site-packages/yum/config.py", line 23, in ?
from parser import ConfigPreProcessor
File "/usr/lib/python2.4/site-packages/yum/parser.py", line 3, in ?
import urlgrabber
File "/usr/lib/python2.4/site-packages/urlgrabber/__init__.py", line 53, in ?
from grabber import urlgrab, urlopen, urlread
File "/usr/lib/python2.4/site-packages/urlgrabber/grabber.py", line 406, in ?
import keepalive
File "/usr/lib/python2.4/site-packages/urlgrabber/keepalive.py", line 339, in ?
class HTTPSHandler(KeepAliveHandler, urllib2.HTTPSHandler):
AttributeError: 'module' object has no attribute 'HTTPSHandler'

出�上面的�� 其�是缺少新版的 wget keyutils-libs python 一�都��
�����在很�解 �曾�著把�台正�的 /usr/lib/python2.4 拷�一份也�用
想了很久 後�忽然想到 CentOS Wiki 提到升� CentOS 4.4ServerCD to 5
有提到 wget 於是把把 CentOS5 wget 及相依 keyutils-libs 套件�上去
yum
又活��了

安�之前也是要重建 rpmdb 否�是�法安�的
rm -f /var/lib/rpm/__*
rpm --rebuilddb
rpm -Uvh wget-1.10.2-7.el5.i386.rpm keyutils-libs-1.2-1.el5.i386.rpm --nodeps --force

4.
安�新版 kernel 以及移除�版 kernel
a.
安�新版 kernel
rpm -ivh kernel-2.6.18-53.el5.i686.rpm --nodeps

b.
移除�版 kernel
--justdb ��移除 rpmdb �除�版的 kernel ��, 不做真正移除
等下 yum upgrade 才不�出��版的 kernel �新的 rpm 生相依性或�突的��
rpm -e --nodeps --justdb kernel-2.6.9-67.EL kernel-2.6.9-67.0.1.EL

5.
升�整�系�
正是要做 整� upgrade 之前, 要先做 rpm db 的重整 rebuild
rm -f /var/lib/rpm/__*
rpm --rebuilddb
好了 可以�始 upgrade
yum -c /etc/yum-upgrade.conf upgrade

做完後�是得重建 rpm db 一次
rm -f /var/lib/rpm/__*
rpm --rebuilddb

然後��察 /etc/grub.conf /boot 是否正�再��

6.
清理垃圾
由於升��程中 有些��可以接受比��的版本
�致�是�有些��停留在 el4 而不是 el5
我�可以��有哪些是 el4
rpm -qa | grep el4, rpm -qa | grep EL4

建�先用 yum list xxx 看有哪��版本
然後用 rpm -e xxx -nodeps 移除
再用 yum install xxx �上新版

�考文章
CentOS Wiki - Upgrade Server 4.4 to 5
http://wiki.centos.org/HowTos/MigrationGuide/ServerCD_4.4_to_5
在�centos4.4升�到centos5.0
http://www.haw-haw.org/node/242

 

 

 

沒有留言:

張貼留言