建议使用阿里yum源
6版本
1、下载阿里Yum源并使用
[root@123 ]# cd /etc/yum.repos.d/ && rm -f *.repo
[root@123 yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo && wget -P /etc/yum.repos.d/ http://mirrors.aliyun.com/repo/epel-6.repo
[root@123 yum.repos.d]# sed -i 's/$releasever/6/g' CentOS-Base.repo
[root@123 yum.repos.d]# sed -i 's/$basearch/x86_64/g' CentOS-Base.repo
[root@123 yum.repos.d]# sed -i 's/$basearch/x86_64/g' epel-6.repo
2、清除原有缓存,重建缓存
[root@123~]# yum clean all && yum makecache fast
7版本
获取阿里源配置文件
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
更新epel仓库
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
清除原有缓存,重建缓存
[root@123~]# yum clean all && yum makecache fast