备份系统之前镜像源:
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak #备份系统镜像源
安装wget:
yum install -y wget #安装wget
下载CentOS的repo文件:
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
或
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
更新镜像源:
yum clean all #清除缓存
yum makecache #生成缓存