方法一:
中科大的源:
cd /etc/yum.repos.d
mv CentOS-Base.repo CentOS-Base.repo.save
wget http://centos.ustc.edu.cn/CentOS-Base.repo.5
mv CentOS-Base.repo.5 CentOS-Base.repo
参考网址:http://centos.ustc.edu.cn/
————————————————————————————————————————————
方法二:
首先察看一下本RHEL的发行版本:
cat /proc/redhat-release
1。确保RHEL5中已经安装了yum。
2。修改源配置文件 #gedit /etc/yum.repos.d/CentOS-Base.repo
在其中加入以下内容
[base]
name=CentOS-5-Base
baseurl=http://ftp.sjtu.edu.cn/centos/5/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
[update]
name=CentOS-5-Updates
baseurl=http://ftp.sjtu.edu.cn/centos/5/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
[addons]
name=CentOS-5-Addons
baseurl=http://ftp.sjtu.edu.cn/centos/5/addons/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
[extras]
name=CentOS-5-Extras
baseurl=http://ftp.sjtu.edu.cn/centos/5/extras/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
[centosplus]
name=CentOS-5-Plus
baseurl=http://ftp.sjtu.edu.cn/centos/5/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
[contrib]
name=CentOS-5-Contrib
baseurl=http://ftp.sjtu.edu.cn/centos/5/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
[dag]
name=Dag RPM Repository for RHEL5
baseurl=http://ftp.riken.jp/Linux/dag/redhat/el5/en/$basearch/dag/
enabled=1
gpgcheck=1
gpgkey=http://ftp.riken.jp/Linux/dag/packages/RPM-GPG-KEY.dag.txt
3. 导入key
#rpm –import http://ftp.sjtu.edu.cn/centos/5/os/i386/RPM-GPG-KEY-CentOS-5
4. 运行,测试
#yum update
在安装软件的时候,会出现key失效,或者key太老的警告。
解决方法:
1、关闭验证,也就是把gpgcheck=0
2、将这两个导入,就可以了。
rpm –import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
rpm –import http://quattor.web.lal.in2p3.fr/packages/os/sl520-x86_64/base/RPM-GPG-KEYs/RPM-GPG-KEY-CentOS-5
来源: http://woyoo.org/index.php/linux/rhel-centos-yum-install-conf.html
本文转自孤舟夜航之家博客51CTO博客,原文链接http://blog.51cto.com/cysky/557731如需转载请自行联系原作者
cysky