操作步骤
一. 首先安装wget
[root@localhost ~]# yum install wget -y
二. 将系统原始配置文件失效
[root@localhost ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
三.使用Wget获取阿里yum源配置文件(根据版本选择)
Centos-6
[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
Centos-7
[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
四. 清空yum源的缓存
[root@localhost ~]# yum makecache
五. 获取阿里云的缓存
[root@localhost ~]# yum makecache
OK