解決yum下載慢問題,CentOS預設yum源改為國內yum映象源
阿新 • • 發佈:2020-07-28
文章轉載自:https://blog.csdn.net/inslow/article/details/54177191
有時候CentOS預設的yum源不一定是國內映象,導致yum線上安裝及更新速度不是很理想。這時候需要將yum源設定為國內映象站點。國內主要開源的開源映象站點應該是網易和阿里雲了。
修改CentOS預設yum源為mirrors.163.com
1、首先備份系統自帶yum源配置檔案/etc/yum.repos.d/CentOS-Base.repo
[root@localhost ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
2、進入yum源配置檔案所在的資料夾
[root@localhost ~]# cd /etc/yum.repos.d/
3、下載163的yum源配置檔案到上面那個資料夾內
CentOS7
[root@localhost yum.repos.d]# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
CentOS6
[root@localhost yum.repos.d]# wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
CentOS5
[root@localhost yum.repos.d]# wget http://mirrors.163.com/.help/CentOS5-Base-163.repo
4、執行yum makecache生成快取
[root@localhost yum.repos.d]# yum makecache
5、這時候再更新系統就會看到以下mirrors.163.com資訊
[root@localhost yum.repos.d]# yum -y update 已載入外掛: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
[root@localhost ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
2、下載ailiyun的yum源配置檔案到/etc/yum.repos.d/
CentOS7
[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
CentOS6
[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
CentOS5
[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
3、執行yum makecache生成快取
[root@localhost ~]# yum makecache
4、這時候再更新系統就會看到以下mirrors.aliyun.com資訊
[root@localhost ~]# 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