#阿里镜像Url
https://developer.aliyun.com/mirror/
CentOS 镜像
#进入CentOS镜像页面
https://developer.aliyun.com/mirror/centos?spm=a2c6h.13651102.0.0.3e221b11bVho1G
cd /etc/yum.repos.d
#备份
mv CentOS-Base.repo CentOS-Base.repo.backup
#下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/
#注意:要选择对应的centos 版本,centos 7如下
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
#清除l旧的yum缓存
yum clean all
#生成新的yum缓存
yum makecache
#更新软件包
yum update -y
Epel 镜像
#进入Epel镜像页面
https://developer.aliyun.com/mirror/epel?spm=a2c6h.13651102.0.0.169c1b11y3u8OI
cd /etc/yum.repos.d
#备份
mv epel.repo epel.repo.backup
mv epel-testing.repo epel-testing.repo.backup
#将 repo 配置中的地址替换为阿里云镜像站地址,以下是centos 7示例
wget -O /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo