更换之前确保自己安装wget
yum list wget
yum -y install wget
首先备份原版/etc/yum.repos.d/CentOS-Base.repo
cd /etc/yum.repos.d
sudo mv CentOS-Base.repo CentOS-Base.repo.bak
cd /etc/yum.repos.d sudo mv CentOS-Base.repo CentOS-Base.repo.bak
下载阿里的yum源
配置文件,放入/etc/yum.repos.d/CentOS-Base.repo
sudo wget -O CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
运行yum makecache生成缓存
yum clean all yum makecache