更改 Centos 6 的 yum 源

1.查看当前使用的源:

yum repolist all

阿里源网址,使用方法点右边的帮助可以看到:https://opsx.alibaba.com/mirror

2.更改源:

第一步:备份你的原镜像文件,以免出错后可以恢复。

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

第二步:下载新的CentOS-Base.repo 到/etc/yum.repos.d/

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

第三步:运行yum makecache生成缓存

yum clean all  //没有执行这一步可能会不成功
yum makecache  

第四步:更新系统

[root@localhost yum.repos.d]# yum -y update   

第五步:看到以下信息说明更改成功

[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
原文地址:https://www.cnblogs.com/gavinyyb/p/8350014.html