1. 程式人生 > >CentOS 更新yum源

CentOS 更新yum源

將yum源設定為國內yum源,可以提升軟體包安裝和更新的速度,同時避免一些常見軟體版本無法找到。

國內源:可以使用wget獲取或者直接下載

網易:

Centos5: http://mirrors.163.com/.help/CentOS5-Base-163.repo

Centos6: http://mirrors.163.com/.help/CentOS6-Base-163.repo

Centos7: http://mirrors.163.com/.help/CentOS7-Base-163.repo

中科大的yum源:

Centos5: https://lug.ustc.edu.cn/wiki/_export/code/mirrors/help/centos?codeblock=1

Centos6: https://lug.ustc.edu.cn/wiki/_export/code/mirrors/help/centos?codeblock=2

Centos7: https://lug.ustc.edu.cn/wiki/_export/code/mirrors/help/centos?codeblock=3

sohu的yum源:

http://mirrors.sohu.com/help/CentOS-Base-sohu.repo

安裝步驟

說明:CentOS存放下載網址源的檔案位於/etc/yum.repos.d目錄下,檔名為:CentOS-Base.repo,執行如下步驟修改下載源

1、首先備份CentOS-Base.repo

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

2、下載對應版本的CentOS-Base.repo, 放入/etc/yum.repos.d/   (可以直接cd  /etc/yum.repos.d/ 然後使用wget下載)

cd /etc/yum.repos.d/

wget  http://mirrors.163.com/.help/CentOS7-Base-163.repo(此處根據CentOS的版本從上述國內源中挑選下載網址)

3、執行以下命令生成快取

yum clean all

yum makecache