CentOS 7 yum源

來源:互聯網
上載者:User

標籤:下載工具   網易   阿里   軟體   技術   

  分享幾個CentOS7的yum源,

  每個做技術的總會經曆各種各樣的小白時刻,各種各樣的窘況,下面分享一下自己的心得:

    情況如下,本人一不小心安裝了最小化的CentOS 7,(就是沒有CRT的上傳下載工具,也沒有  Wget),又是遠端管理,突然間想遠程安裝一些軟體,各種抓狂,想更新一下yum源,居然沒有好的方  法 ,下載了阿里和網易的yum源,開啟後會面臨一個比較尷尬的問題,沒有分行,沒辦法用CRP複製粘  貼,所以本文就給大家一個可以用CRT輸進去的yum。


 首先說明一下:CentOS 7新添加了一個模組(已載入外掛程式:fastestmirror),這個模組可以自動識別  最近的yum源,不過還是不如寫入的yum源速度快。


  步驟如下:

    1:備份自有的yum源 

        cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.BK

    2:清空/etc/yum.repos.d/CentOS-Base.repo,等待新的yum源輸入。

        echo "" > /etc/yum.repos.d/CentOS-Base.repo

        (當然我這隻是個人習慣,也可刪除後重建,或者用vi編輯器刪除該命令的意思是

          將一個空格追加到該檔案中,並且覆蓋之前檔案)

    3:用vi編輯器開啟該檔案/etc/yum.repos.d/CentOS-Base.repo

        vi /etc/yum.repos.d/CentOS-Base.repo

    4:將下列檔案粘貼進去(阿里yum)

        

# CentOS-Base.repo

#

# The mirror system uses the connecting IP address of the client and the

# update status of each mirror to pick mirrors that are updated to and

# geographically close to the client.  You should use this for CentOS updates

# unless you are manually picking other mirrors.

#

# If the mirrorlist= does not work for you, as a fall back you can try the 

# remarked out baseurl= line instead.

#

#

 

[base]

name=CentOS-$releasever - Base - mirrors.aliyun.com

failovermethod=priority

baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/

        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os

gpgcheck=1

gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

 

#released updates 

[updates]

name=CentOS-$releasever - Updates - mirrors.aliyun.com

failovermethod=priority

baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/

        http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates

gpgcheck=1

gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

 

#additional packages that may be useful

[extras]

name=CentOS-$releasever - Extras - mirrors.aliyun.com

failovermethod=priority

baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/

        http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras

gpgcheck=1

gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

 

#additional packages that extend functionality of existing packages

[centosplus]

name=CentOS-$releasever - Plus - mirrors.aliyun.com

failovermethod=priority

baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/

        http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus

gpgcheck=1

enabled=0

gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

 

#contrib - packages by Centos Users

[contrib]

name=CentOS-$releasever - Contrib - mirrors.aliyun.com

failovermethod=priority

baseurl=http://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/

        http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib

gpgcheck=1

enabled=0

gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

    5.":wq"退出後,使用yum makecache產生緩衝,有可能會失敗,這是因為有可能在配置網路的  時候DNS為Google的8.8.8.8,該地址對國內個別網站的解析並不完美,所以會提示無法找到主機。

  可以編輯/etc/resolv.conf 添加一條"nameserver 114.114.114.114",別問為啥是這個DNS,因為好  記。

    6.yum makecache,然後記得yum install wget,然後想更換其他源可以直接用wget。不再舉  例。


    BUG:在CentOS 7裡,修改/etc/resolv.conf,並不能永久修改DNS,不過可以寫在網卡裡,不過修  改網卡設定檔需要重啟網卡才會生效,寫在/etc/resolv.conf中會立馬生效,在研究中,詳情請見  後續博文。

   備忘:如有疑問請留言,如需轉載請註明出處。      

本文出自 “慕白流蘇” 部落格,請務必保留此出處http://mubsky.blog.51cto.com/3081455/1703760

CentOS 7 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.