更改yum源为阿里云的yum源

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了更改yum源为阿里云的yum源相关的知识,希望对你有一定的参考价值。

更改centos6的yum源为阿里云的yum源

方法:

1、进入到/etc/yum.repos.d/目录下,备份之前的CentOS-Base.repo地址。

cd /etc/yum.repos.d/

mv CentOS-Base.repo CentOS-Base.repo.bak

2、下载阿里云yum源

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格式备份,然后在执行一次上面的命令即可!

CentOS7对应地址:http://mirrors.aliyun.com/repo/Centos-7.repo

 

二、更改为网易的centos yum源

wget http://mirrors.163.com/.help/CentOS6-Base-163.repo

mv CentOS6-Base-163.repo CentOS-Base.repo


本文出自 “jinchuang” 博客,请务必保留此出处http://jinchuang.blog.51cto.com/8690689/1844416

以上是关于更改yum源为阿里云的yum源的主要内容,如果未能解决你的问题,请参考以下文章

CemtOS7更改yum网易 阿里云的yum源。

Linux(CentOS7.1)修改默认yum源为国内的阿里云yum源

Linux(CentOS7.1)修改默认yum源为国内的阿里云yum源

Linux(CentOS6.5)修改默认yum源为国内的阿里云网易yum源

centos8将yum源更换为国内(阿里云)源

CentOS修改yum源为阿里云