如何配置CentOS或者RedHat5.X、6.X、7.X的網路yum源

來源:互聯網
上載者:User

標籤:

第一步:找到一個可靠的yum源

中科大
協助:https://lug.ustc.edu.cn/wiki/mirrors/help/centos
源:http://mirrors.ustc.edu.cn/centos/
搜狐
協助:http://mirrors.sohu.com/help/centos.html
源:http://mirrors.sohu.com/centos/
163
協助:http://mirrors.163.com/.help/centos.html
源:http://mirrors.163.com/centos/

第二步:配置yum源

在第一步中的各網站上的協助部分的連結下載類似於CentOS-Base.repo的檔案(就是網站在安裝說明中要求你該名稱此檔案名稱的檔案,具體名字可能根據不同的網站有所不同,內容應該都是一樣的。)
例如中科大的:
[[email protected] /]cd /etc/yum.repos.d[[email protected] yum.repos.d]wget https://lug.ustc.edu.cn/wiki/_export/code/mirrors/help/centos?codeblock=1

第三步:將CentOS-Base.repo中的$releasever替換成相應的版本

首先要保證被替換的版本下面有內容。
例如,我用的是紅帽6.2版本的系統,但是各個 第一步中的“源” 的連結中只有6.7裡面有內容。那麼我就把所有的$releasever替換成6.7
[[email protected] yum.repos.d]vim CentOS-Base.repovim命令模式下:1,$s/$releasever/6.7/g:wq

儲存退出

第四步:更新yum源

[[email protected] yum.repos.d]yum clean all[[email protected] yum.repos.d]yum makecache

結束

 

附錄:安裝epel也是同理

首先: 找到資源http://mirrors.opencas.cn/epel/,選擇好自己的系統版本和位元(32選i386/,64選x86_64/),然後下載到本地,如:

[[email protected] /]wget http://mirrors.opencas.cn/epel/6/x86_64/epel-release-6-8.noarch.rpm

然後:安裝好就行了

[[email protected] /]rpm -ivh epel-release-6-8.noarch.rpm
[[email protected] /]yum clean all
[[email protected] /]yum makecache

結束

如何配置CentOS或者RedHat5.X、6.X、7.X的網路yum源

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.