https://blog.youkuaiyun.com/pengpengpeng85/article/details/94461152
#!/bin/bash
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all
yum makecache
# 备份旧的 yum 源
# 下载阿里云 repo
# 清除缓存
# 生成缓存
保存脚本,添加执行权限,运行即可。