以centos7为例子
命令
这是阿里源
1.mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
2.wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
3.yum clean all
清楚本地缓存
4.创建本地的yum缓存
yum makecache
使用wget
官方基础:http://mirrors.163.com/.help/CentOS7-Base-163.repo
http://mirrors.aliyun.com/repo/Centos-7.repo
epel 拓展:http://mirrors.aliyun.com/repo/epel-7.repo
最后把这个也安装一下