Linux/Apache/Nignx

Linux更换yum源

2020-09-05  本文已影响0人  吴佳浩

有时候CentOS默认的yum源不一定是国内镜像,导致yum在线安装及更新速度不是很理想。这时候需要将yum源设置为国内镜像站点。国内主要开源的开源镜像站点应该是网易和阿里云了。

1、修改CentOS默认yum源为mirrors.163.com

[wujiahao@47.98.32.222 ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

[wujiahao@47.98.32.222 ~]]# cd /etc/yum.repos.d/

CentOS7

[wujiahao@47.98.32.222 yum.repos.d]# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo

CentOS6

[wujiahao@47.98.32.222 yum.repos.d]# wget http://mirrors.163.com/.help/CentOS6-Base-163.repo

CentOS5

[wujiahao@47.98.32.222 yum.repos.d]# wget http://mirrors.163.com/.help/CentOS5-Base-163.repo

[wujiahao@47.98.32.222 yum.repos.d]# yum makecache

[wujiahao@47.98.32.222 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

2、修改CentOS默认yum源为mirrors.aliyun.com

[wujiahao@47.98.32.222 ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

CentOS7

[wujiahao@47.98.32.222 ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

CentOS6

[wujiahao@47.98.32.222 ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

CentOS5

[wujiahao@47.98.32.222 ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo

[wujiahao@47.98.32.222 ~]# yum makecache

[wujiahao@47.98.32.222 ~]# 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
```cd
上一篇 下一篇

猜你喜欢

热点阅读