redhat 修改yum源

問題現象:html

現有的yum安裝git失敗,提示yum源鏈接失敗node

Error Downloading Packages:
  git-1.7.1-3.el6_4.1.x86_64: failure: Packages/git-1.7.1-3.el6_4.1.x86_64.rpm from rhel-source: [Errno 256] No more mirrors to try.
  1:perl-Error-0.17015-4.el6.noarch: failure: Packages/perl-Error-0.17015-4.el6.noarch.rpm from rhel-source: [Errno 256] No more mirr
ors to try.  perl-Git-1.7.1-3.el6_4.1.noarch: failure: Packages/perl-Git-1.7.1-3.el6_4.1.noarch.rpm from rhel-source: [Errno 256] No more mirror
s to try.

解決方法:python

修改Yum源,使用新的yum源更新linux

1.首先卸載原來的yumgit

rpm -qa|grep yum|xargs rpm -e --nodeps   移除與原yum全部有關的東西

2.下載yum包,使用163的Yum源centos

須要登錄 http://mirrors.163.com/centos/  確認使用的安裝包名稱緩存

  ps:redhat 與centos的版本對應關係  測試

http://www.javashuo.com/article/p-tvvbmahd-m.htmlurl

http://www.javashuo.com/article/p-mcrepdsf-dx.htmlcentos7

須要的包:rpm、yum-metadata-parser、python-urlgrabber、yum、yum-plugin-fastestmirror ,對應的版本到 http://mirrors.163.com/centos/  下查找對應的包下載

3.安裝yum包

rpm -ivh --force 包的名稱

[root@linuxprobe~]# rpm -ivh yum-fastestmirror-1.1.26-11.el6.centos.noarch.rpm

error: Failed dependencies:
yum >= 3.0 is needed by yum-fastestmirror-1.1.26-11.el6.centos.noarch

[root@linuxprobe~]# rpm -ivh yum-3.2.27-14.el6.centos.noarch.rpm

error: Failed dependencies:
yum-fastestmirror is needed by yum-3.2.27-14.el6.centos.noarch

出現2個rpm包互相依賴,

經過2個包同時安裝解決:

如:rpm -ivh yum-3.2.27-14.el6.centos.noarch.rpm yum-fastestmirror-1.1.26-11.el6.centos.noarch.rpm

4.下載、修改配置文件

根據本身系統的版本下載CentOS6或者7的配置文件(建議本身登到網址http://mirrors.163.com/.help/centos.html 去了解一下)

下載對應的配置文件,如wget http://mirrors.163.com/.help/CentOS7-Base-163.repo

下載完畢,首先將原yum文件備份,如:mv /etc/yum.repos.d/redhat.repo /etc/yum.repos.d/redhat.repo.bak

而後更改文件centos7-Base-163.repo中的$releasever變量,更改成實際版本號

5.進行yum初始化和檢驗操做

清理原有緩存      yum clean all

重建緩存            yum makecache

安裝測試           yum -y install httpd

相關文章
相關標籤/搜索