如何更换CentOS6的yum源

将yum源设置为国内yum源,可以提升软件包安装和更新的速度,同时避免一些常见软件版本无法找到。

国内免费提供yum源的网站有很多,如果,阿里、网易、清华、中科大等。

这里以阿里yum源为例

访问阿里开源镜像站:https://developer.aliyun.com/mirror

点击“centos”,根据官网文档,选择对应系统版本的yum源

1、备份原来的yum源

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

2、下载CentOS 6的yum源

wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-6.repo

3、下载epel扩展源

点击“epel”,根据官网文档,选择对应系统版本的yum源

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo

4、清理缓存,生成新缓存

yum clean all

yum makecache

 

原文地址:https://www.cnblogs.com/opsprobe/p/9679800.html