本文參考:http://blog.itpub.net/23890223/viewspace-757724/
謝謝博主。。
系統環境:
系統版本:
[root@red-test yum.repos.d]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.5 (Santiago)
內核版本:
[root@red-test yum.repos.d]# uname -rm
2.6.32-431.el6.x86_64 x86_64
我的是在上面的環境中測試的沒有問題,如果大家按照我的這篇博文去做的話,請保證和我的環境保持一致。否則不能保證你按照我的步驟可以成功。
1、刪除redhat原有的yum源:
rpm -qa|grep yum|xargs rpm -e --nodeps
2、下載新的yum安裝包
這裏我使用CentOS的yum源
mkdir /application/tools/ -p
cd /application/tools/
wget http://mirror.centos.org/centos/6.5/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
wget http://mirror.centos.org/centos/6.5/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
wget http://mirror.centos.org/centos/6.5/os/x86_64/Packages/yum-3.2.29-40.el6.centos.noarch.rpm
wget http://mirror.centos.org/centos/6.5/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
3、安裝yum軟件包
rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
rpm -ivh yum-3.2.29-40.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
注意:最後兩個安裝包要放在一起同時安裝,否則會提示相互依賴,安裝失敗。
4、更改yum源 ,#我們使用網易的CentOS鏡像源
cd /etc/yum.repos.d/
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
vim CentOS6-Base-163.repo
編輯文件,把文件裏面的$releasever全部替換爲版本號,即6最後保存!
:%s/$releasever/6/g
操作完成後,記得wq保存退出。
5、清理yum緩存
yum clean all
yum makecache #將服務器上的軟件包信息緩存到本地,以提高搜索安裝軟件的速度
yum install vim* #測試域名是否可用
到此爲止,Redhat6可以使用CentOS的yum源在線安裝軟件了。
問題:
yum makecache時出現如下錯誤:
[root@red-test yum.repos.d]# yum makecache
Loaded plugins: fastestmirror, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Loading mirror speeds from cached hostfile
http://mirrors.163.com/centos/6/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.163.com/centos/6/os/x86_64/repodata/repomd.xml: (28, 'Operation too slow. Less than 1 bytes/sec transfered the last 30 seconds')
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again
出現這個不影響yum在線的安裝使用
你直接yum install vim* 直接安裝軟件測試。只要能安裝就可以使用了。。
希望你的也沒有問題哦。。