centos7 更换阿里源

备份官方源

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

下载Centos-7.repo文件

两种方式下载

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

重新生成缓存

按需情况执行 yum update

# 清除yum缓存
yum clean all
# 缓存阿里云源
yum makecache
# 测试阿里云源
yum list
# 升级
# yum update