替换repo文件为阿里云镜像
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
Redhat系统需要加上一条命令(当Redhat系统使用CentOS源的时候$releasever变量会取不到值,要手动将此变量改为要使用的系统发行版本号,下面示例为批量改为CentOS7)
sed -i 's/$releasever/7/g' /etc/yum.repos.d/*.repo