安装wget

1
yum install -y wget

完事前都做备份

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

下载阿里云镜像文件

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

清理缓存

1
yum clean all

生成缓存

1
yum makecache

更新最新源设置

1
yum update -y