相信大部分使用Red Hat Enterprise Linux 5的人都是沒有註冊的RHEL5,這樣導致我們無法使用紅帽提供的yum源來更新軟體.
由於CentOS-5是RHEL-5的山寨版,我們可以使用CentOS-5的yum源來達到在RHEL-5下更新軟體.
備份一下原本的repo文件,這個步驟就不寫出來了.
然後在原來的repo文件下,添加以下內容
[base]
name=Red Hat Enterprise Linux $releasever -Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever5&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
baseurl=http://ftp.sjtu.edu.cn/centos/5/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
#released updates
[update]
name=Red Hat Enterprise Linux $releasever -Updates
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=updates
baseurl=http://ftp.sjtu.edu.cn/centos/5/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
#packages used/produced in the build but not released
[addons]
name=Red Hat Enterprise Linux $releasever -Addons
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=addons
baseurl=http://ftp.sjtu.edu.cn/centos/5/addons/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
#additional packages that may be useful
[extras]
name=Red Hat Enterprise Linux $releasever -Extras
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=extras
baseurl=http://ftp.sjtu.edu.cn/centos/5/extras/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
註:也可以把RHEL-5自帶的repo文件刪掉,重新建立一個repo文件,添加以上的內容.
接著導入RPM=KEY
rpm --import http://ftp.sjtu.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5
清理以下緩存
yum clean all
到這裡就OK了,可以測試一下能否使用
yum list
本文出自 「Linux技術愛好者」 博客,請務必保留此出處http://haobo.blog.51cto.com/2893071/584316
[火星人 ] Linux學習筆記---RHEL-5配置CentOS-5的yum源已經有962次圍觀