1. 程式人生 > >centos 配置yum 源

centos 配置yum 源

1.檢查是否安裝yum包。檢視RHEL是否安裝了yum,若是安裝了,那麼又有哪些yum包:     
  rpm -qa |grep yum

 

  2 刪除redhat自帶的yum包  
   rpm -qa|grep yum|xargs rpm -e --nodeps(不檢查依賴,直接刪除rpm包)
    rpm -qa |grep yum (查詢確認)

 

  3.下載新的yum包。使用Centos6.5的yum包     1) 檢視版本號和系統類別:
   cat /etc/redhat-release  

 我的是   Red Hat Enterprise Linux Server release 6.4 (Santiago)

        arch                                       ---x86_64 2)根據上一步,找到對應的yum包,然後下載。我的伺服器對應的為(centos 7 可以訪問http://mirror.centos.org/centos/7/os/x86_64/Packages ,去找對應的包):
      wget http://
mirror.centos.org/centos/6/os/x86_64/Packages/yum-3.2.29-73.el6.centos.noarch.rpm wget http://mirror.centos.org/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-37.el6.noarch.rpm wget http://mirror.centos.org/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm

 

依賴 包:
wget http://
mirror.centos.org/centos/6/os/x86_64/Packages/python-urlgrabber-3.9.1-11.el6.noarch.rpm

 

3) 安裝:       說明:四個一起安裝 ,但我的機器上已預裝的有 python,所以先強制安裝 python-urlgrabber-3.9.1-11.el6.noarch.rpm               
 rpm -ivh --force python-urlgrabber-3.9.1-11.el6.noarch.rpm

 

然後再安裝 yum 的三個             
   rpm -ivh yum*.rpm

 

  4)更換yum源,將原有源刪除或備份到別的目下下:
        cd /etc/yum.repos.d/
        wget  http://mirrors.163.com/.help/CentOS6-Base-163.repo

 

        vi CentOS6-Base-163.repo         編輯檔案,把檔案裡面的$releasever全部替換為版本號:6(注意,不是6.4! , centos 替換為7)最後儲存! 4.清除原有快取,重建快取:     clean all     yum makecache      5.更新系統:        yum update  可以不更新。   centos7 yum 下載地址   wget http://mirror.centos.org/centos/7/os/x86_64/Packages/yum-3.4.3-161.el7.centos.noarch.rpm wget http://mirror.centos.org/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm wget http://mirror.centos.org/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm wget http://mirror.centos.org/centos/7/os/x86_64/Packages/python-urlgrabber-3.10-9.el7.noarch.rpm