把YUM源換為國內的源
有時候CentOS預設的yum源不一定是國內映象,導致yum線上安裝及更新速度不是很理想。這時候需要將yum源設定為國內映象站點。國內主要開源的開源映象站點應該是網易和阿里雲了。
修改CentOS預設yum源為mirrors.163.com
1、首先備份系統自帶yum源配置檔案/etc/yum.repos.d/CentOS-Base.repo
1
[[email protected] ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
2、進入yum源配置檔案所在的資料夾
1
[[email protected] ~]# cd /etc/yum.repos.d/
3、下載163的yum源配置檔案到上面那個資料夾內
CentOS7
1
[[email protected] yum.repos.d]# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
CentOS6
1
[[email protected] yum.repos.d]# wget
CentOS5
1
[[email protected] yum.repos.d]# wget http://mirrors.163.com/.help/CentOS5-Base-163.repo
4、執行yum makecache生成快取
1
[[email protected] yum.repos.d]# yum makecache
5、這時候再更新系統就會看到以下mirrors.163.com資訊
1
2
3
4
5
6
[
已載入外掛:fastestmirror, refresh-packagekit, security
設定更新程序Loading mirror speeds from cached hostfile
* base: mirrors.163.com
* extras: mirrors.163.com
* updates: mirrors.163.com
修改CentOS預設yum源為mirrors.aliyun.com
1、首先備份系統自帶yum源配置檔案/etc/yum.repos.d/CentOS-Base.repo
1
[[email protected] ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
2、下載ailiyun的yum源配置檔案到/etc/yum.repos.d/
CentOS7
1
[[email protected] ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
CentOS6
1
[[email protected] ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
CentOS5
1
[[email protected] ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
3、執行yum makecache生成快取
1
[[email protected] ~]# yum makecache
4、這時候再更新系統就會看到以下mirrors.aliyun.com資訊
1
2
3
4
5
6
[[email protected] ~]# yum -y update
已載入外掛:fastestmirror, refresh-packagekit, security
設定更新程序Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
作者:inslow
來源:CSDN
原文:https://blog.csdn.net/inslow/article/details/54177191
版權宣告:本文為博主原創文章,轉載請附上博文連結!