將yum源設置爲國內yum源,能夠提高軟件包安裝和更新的速度,同時避免一些常見軟件版本沒法找到。centos
國內源:能夠使用wget獲取或者直接下載緩存
網易:spa
CentOS5: http://mirrors.163.com/.help/CentOS5-Base-163.repocode
CentOS6: http://mirrors.163.com/.help/CentOS6-Base-163.repoblog
CentOS7: http://mirrors.163.com/.help/CentOS7-Base-163.repoget
中科大的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=2date
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
這裏以網易yum源爲例
1、訪問網易開源鏡像站:http://mirrors.163.com/
2、如上圖,點擊 centos/ 後面的centos使用幫助
3、根據centos使用幫助操做:
[1] 首先備份/etc/yum.repos.d/CentOS-Base.repo
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
[2] 進入yum源配置文件所在文件夾
[root@localhost yum.repos.d]# cd /etc/yum.repos.d/
[3] 下載163的yum源配置文件,放入/etc/yum.repos.d/(操做前請作好相應備份)
[root@localhost yum.repos.d]# wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
[4] 運行yum makecache生成緩存
[root@localhost yum.repos.d]# yum clean all
[root@localhost yum.repos.d]# yum makecache
[5] 更新系統(可選)
[root@localhost yum.repos.d]# yum -y update