1、cd 到yum源文件所在位置

cd /etc/yum.repos.d

2、备份CentOS-Base.repo源文件

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

3、下载阿里云yum源配置文件

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

4、清理yum缓存

yum clean all

5、生成新的缓存

yum makecache

6、更新yum源

yum update

借鉴文章地址:centos7配置yum国内镜像 - 槑孒 - 博客园