閱讀867 返回首頁    go 中電雲集


快速Redhat AS4和AS5升級至Centos係統

單位很多服務器都是Redhat AS4和AS5的機器,平時經常需要安裝和編譯軟件包,升級到Centos係統能夠方便不少!

網上查閱了相關資料,但是都不盡如人意,最終自己摸索出以下方法,和大家一起分享!

查看當前係統版本號

# less /etc/redhat-release

檢查係統已安裝的組件包中是否已存在Redhat的自帶的yum係列組件包

# su root

# rpm -qa | grep yum

如果存在請逐一全部刪除

# rpm -e –nodeps 組件包名稱

建立Centos專用目錄,然後下載並安裝Centos係統的yum係列組件包

# su webuser

# cd /home/webuser

# mkdir centos

下載Centos升級組件包(注:根據RedHat AS4或RedHat AS5分別操作)

RedHat AS4:

# wget https://centos.ustc.edu.cn/centos/4.7/os/i386/CentOS/RPMS/python-elementtree-1.2.6-5.el4.centos.i386.rpm

# wget https://centos.ustc.edu.cn/centos/4.7/os/i386/CentOS/RPMS/python-sqlite-1.1.7-1.2.1.i386.rpm

# wget https://centos.ustc.edu.cn/centos/4.7/os/i386/CentOS/RPMS/python-urlgrabber-2.9.8-2.noarch.rpm

# wget https://centos.ustc.edu.cn/centos/4.7/os/i386/CentOS/RPMS/sqlite-3.3.6-2.i386.rpm

# wget https://centos.ustc.edu.cn/centos/4.7/os/i386/CentOS/RPMS/yum-2.4.3-4.el4.centos.noarch.rpm

# wget https://centos.ustc.edu.cn/centos/4.7/os/i386/CentOS/RPMS/yum-metadata-parser-1.0-8.el4.centos.i386.rpm

# wget https://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-4

RedHat AS5:

# wget https://centos.ustc.edu.cn/centos/5.3/os/i386/CentOS/python-iniparse-0.2.3-4.el5.noarch.rpm

# wget https://centos.ustc.edu.cn/centos/5.3/os/i386/CentOS/yum-3.2.19-18.el5.centos.noarch.rpm

# wget https://centos.ustc.edu.cn/centos/5.3/os/i386/CentOS/yum-fastestmirror-1.1.16-13.el5.centos.noarch.rpm

# wget https://centos.ustc.edu.cn/centos/5.3/os/i386/CentOS/yum-metadata-parser-1.1.2-2.el5.i386.rpm

# wget https://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5

安裝Centos升級組件包

# su root

# rpm -Uvh –nodeps /home/webuser/centos/*.rpm

導入Centos升級組件授權(注:根據RedHat AS4或RedHat AS5分別操作)

RedHat AS4:

# rpm –import /home/webuser/centos/RPM-GPG-KEY-CentOS-4

RedHat AS5:

# rpm –import /home/webuser/centos/RPM-GPG-KEY-CentOS-5

創建並編輯yum升級源配置文件

# su root

# mkdir -p /etc/yum.repos.d/

# vi /etc/yum.repos.d/CentOS-Base.repo

粘貼以下內容覆蓋文件:

RedHat AS4:

[base]

name=CentOS-$releasever - Base

baseurl=https://centos.ustc.edu.cn/centos/4.7/os/$basearch/

gpgcheck=1

gpgkey= https://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-4

#released updates

[update]

name=CentOS-$releasever - Updates

baseurl=https://centos.ustc.edu.cn/centos/4.7/updates/$basearch/

gpgcheck=1

gpgkey= https://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-4

#packages used/produced in the build but not released

[addons]

name=CentOS-$releasever - Addons

baseurl=https://centos.ustc.edu.cn/centos/4.7/addons/$basearch/

gpgcheck=1

gpgkey= https://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-4

#additional packages that may be useful

[extras]

name=CentOS-$releasever - Extras

baseurl=https://centos.ustc.edu.cn/centos/4.7/extras/$basearch/

gpgcheck=1

gpgkey= https://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-4

#additional packages that extend functionality of existing packages

[centosplus]

name=CentOS-$releasever - Plus

baseurl=https://centos.ustc.edu.cn/centos/4.7/centosplus/$basearch/

gpgcheck=1

enabled=0

gpgkey= https://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-4

#contrib - packages by Centos Users

[contrib]

name=CentOS-$releasever - Contrib

baseurl=https://centos.ustc.edu.cn/centos/4.7/contrib/$basearch/

gpgcheck=1

enabled=0

gpgkey= https://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-4

RedHat AS5:

[base]

name=CentOS-$releasever - Base

baseurl=https://centos.ustc.edu.cn/centos/5.3/os/$basearch/

gpgcheck=1

gpgkey=https://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5

#released updates

[update]

name=CentOS-$releasever - Updates

baseurl=https://centos.ustc.edu.cn/centos/5.3/updates/$basearch/

gpgcheck=1

gpgkey=https://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5

#packages used/produced in the build but not released

[addons]

name=CentOS-$releasever - Addons

baseurl=https://centos.ustc.edu.cn/centos/5.3/addons/$basearch/

gpgcheck=1

gpgkey=https://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5

#additional packages that may be useful

[extras]

name=CentOS-$releasever - Extras

baseurl=https://centos.ustc.edu.cn/centos/5.3/extras/$basearch/

gpgcheck=1

gpgkey=https://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5

#additional packages that extend functionality of existing packages

[centosplus]

name=CentOS-$releasever - Plus

baseurl=https://centos.ustc.edu.cn/centos/5.3/centosplus/$basearch/

gpgcheck=1

enabled=0

gpgkey=https://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5

#contrib - packages by Centos Users

[contrib]

name=CentOS-$releasever - Contrib

baseurl=https://centos.ustc.edu.cn/centos/5.3/contrib/$basearch/

gpgcheck=1

enabled=0

gpgkey=https://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5

核對後保存並退出

開始升級係統

# yum update

等待係統列出需要升級的組件清單並按”y”確認

Total download size: 334 M

Is this ok [y/n]: y

Complete!

等待全部組件下載完成後,重新啟動服務器,操作係統升級完畢!

最後更新:2017-01-04 22:34:31

  上一篇:go 手機認證操作指南
  下一篇:go Linux 安全設置