發新話題
打印

CentOS4升級CentOS5心得

CentOS4升級CentOS5心得

http://www.jindi.org/bbs/archiver/?tid-60535.html

CentOS4升級CentOS5心得

如需轉載請註明文章出處禁地論壇。

目前使用CentOS4.4版本,由於CentOS5 Final版也發佈了有5天多了
還是忍不住想來升級一下,雖然之前都是玩Red Hat但是也都是一樣的
先從CentOS官方的說明看來
複製內容到剪貼板
代碼:
The best way to move from CentOS-4 to CentOS-5 is via an installer<br> upgrade. However if you must do it online, here are some tips to help:<br> - Remove as many packages as you can, strip it right back to the<br> original OS if possible<br> - Backup everything<br> - Disable all repositories, except the centos-5 OS and Updates repos<br> - init 3<br> - shutdown as many services as possible<br> - download and install the centos-release-5.x rpm, which will update<br> your yum configs<br> - run a yum upgadeupgrade ( not update )


我們要先備份好主機上的資料,以避免失敗時資料也全都毀於一旦無法挽救,像是有mysql資料
系統內/etc以及/home目錄都要備份,盡可能硬碟上有空間就備份起來,這點還滿重要的。
上面的官方說明把一些不相關的服務都停止只留下升級時所需要的yum等必需的程式就好,
所以我們可以從ssh上輸入
複製內容到剪貼板
代碼:
#init 3

切換成文字畫面,再來就是升級centos-release檔案,這邊我們輸入
複製內容到剪貼板
代碼:
#rpm -Uvh http://mirror.centos.org/centos/5/os/i386/CentOS/centos-release-5-0.0.el5.centos.2.i386.rpm http://mirror.centos.org/centos/5/os/i386/CentOS/centos-release-notes-5.0.0-2.i386.rpm

這是因為centos-release包依賴於centos-release-notes包,所以升級centos-release就必須同時升級centos-release-notes然後輸入
複製內容到剪貼板
代碼:
#cd /etc/yum.repos.d<br> #cp -f CentOS-Base.repo.rpmnew CentOS-Base.repo<br> #yum -y upgrade


由於許多套件要下載,所以需要一點時間,而且執行時有可能會出現類似的錯誤
Error: Missing Dependency: libttf.so.2 is needed by package bg5ps
Error: Missing Dependency: libttf.so.2 is needed by package VFlib2
..................................

諸如此類的,就是一些跟新版的核心衝突,所以我們先將這些有問題的套件一並移除
複製內容到剪貼板
代碼:
#yum remove bg5ps VFlib2
     
(記得有衝突的套件都一並移除,反正yum會自行判斷相依性才不用手動在那邊移除到昏倒)

移除完畢我們在繼續回到
複製內容到剪貼板
代碼:
#yum -y upgrade


若是順利的話那就都OK啦,但是有些人還有遇到這問題一樣到後面時出現以下錯誤
複製內容到剪貼板
代碼:
Error: Package hal needs kernel &lt; 2.6.17, this is not available.<br> Error: Package initscripts needs kernel &lt; 2.6.12, this is not available.<br> Error: Package lksctp-tools needs kernel &lt; 2.6.10, this is not available.<br> Error: Package kudzu needs kernel &lt; 2.6.13, this is not available.<br> Error: Package autofs needs kernel &lt; 2.6.17, this is not available.


這錯誤是說我們的kernel版本過低,所以我們先強制升級kernel 再來繼續
複製內容到剪貼板
代碼:
#rpm -Uvh --nodeps http://ftp.isu.edu.tw/pub/Linux/CentOS/5.0/os/i386/CentOS/kernel-2.6.18-8.el5.i686.rpm


P.S: kernel-2.6.18-8.el5.i686.rpm 是我需要的核心版本自己的機器請自行選擇

強制安裝完後我們再回到
複製內容到剪貼板
代碼:
#yum -y upgrade


總算是可以順利升級到CentOS5,基本上比想像中的要簡單多了。
以上是我升級的過程以及一些資料,若是有錯誤請指導。

TOP

發新話題