更改centos7的yum源为阿里云的yum源
一、更改centos7的yum源为阿里云的yum源
1、进入到/etc/yum.repos.d/目录下,备份本地CentOS-Base.repo地址
[root@promote /]# cd /etc/yum.repos.d/
[root@promote yum.repos.d]# mv CentOS-Base.repo Centos-Base.repo.bak
2、下载阿里云yum源
centos7:wget -O CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
centos6:wget -O CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
centot5:wget -O CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
3、将服务器上的软件包信息缓存到本地,以提高搜索安装软件的速度
yum makecache
如果你在执行上面命令时,报错:Error:Cannot retrieve metalink for repository:epel.Please verify its path and try again
建议用如下方法解决:检查/etc/yum.repos.d/下是否有epel.repo文件,如果有,重命名为epel.repo_bak,前往不要以.repo格式备份;然后再执行一次上面的命令即可!
二、更改为网易的centos yum源
wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
mv CentOS6-Base-163.repo CentOS-Base.repo
三、更改为epel.repo源
方法一:安装epel源
RHEL/CentOS 6:
# yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
RHEL/CentOS 7:
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
方法二:使用阿里开源镜像提供的epel源
使用阿里开源镜像提供的epel源
cd /etc/yum.repo.d/
wget http://mirrors.aliyun.com/repo/epel-7.repo
yum clean all
yum makecache
https://fedoraproject.org/wiki/EPEL
©著作权归作者所有:来自51CTO博客作者靳闯博客的原创作品,原文链接:http://blog.51cto.com/jinchuang/1844416