一、更换163源
#mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup #wget http://mirrors.163.com/.help/CentOS6-Base-163.repo #mv CentOS6-Base-163.repo CentOS-Base.repo #yum makecache #yum update
***********************************************************
二、添加epel源
1、安装yum优先级插件
#yum install yum-priorities epel简介: https://fedoraproject.org/wiki/EPEL/zh-cn #rpm -Uvh http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm #rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm 以上URL请按实际情况修改
2、查看是否安装成功
#rpm -q epel-release
3、导入key
#rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
4、修改/etc/yum.repos.d/epel.repo文件
在[epel]最后添加一条属性 priority=11 #vi /etc/yum.repos.d/epel.repo 意思是yum先去官方源查,官方没有再去epel的源找
5、重建缓存
#yum makecache
重建缓存中遇到如下报错:
Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again
解决办法:
修改文件“/etc/yum.repos.d/epel.repo”, 将baseurl的注释取消, mirrorlist注释掉。即可
原文:http://www.cnblogs.com/sellsa/p/5061968.html