1.下载repo文件

cd /etc/yum.repos.d/ && cp CentOS-Base.repo CentOS-Base.repo.$(date +%F) &&
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

2.更改发行版本及CPU体系架构参数值($releasever与$basearch)

sed -i.$(date +%F) 's#/$releasever#/6#g;s#/$basearch#/x86_64#g' CentOS-Base.repo

3.清空并新生成yum缓存

yum clean all

yum update

yum makecache