操作步骤
一. 首先安装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 clean all
五. 获取阿里云的缓存
[root@localhost ~]# yum makecache
![](https://i-blog.csdnimg.cn/blog_migrate/46d7c7140cd625d8a9a6cee669c32e68.png)
ok