备份本地源

1
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

配置CentOS7(aliyun) yum源

1
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

把$releasever替换为7

1
sed -i  's/$releasever/7/g'  /etc/yum.repos.d/CentOS-Base.repo