配置阿里云镜像
详情参考阿里云官方配置https://developer.aliyun.com/mirror/centos?spm=a2c6h.13651102.0.0.3e221b11PJpevX
其他镜像地址可参考https://blog.csdn.net/m0_67598987/article/details/134339726
1.备份原文件
yum install wget -y
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
2. 下载阿里云文件
注:不同版本对应不同的下载地址
2.1 centos7.x
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
2.2 centos6.x
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
2.3 centos5.x
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
3. 更新cache
yum makecache
注:如更新时一直提示无法下载,可先 yum clean all
然后执行 yum makecache