如何更换CentOS7的yum源

国内的开源镜像站有很多,下面分别以阿里、网易、清华为例,更换CentOS系统的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 7的yum源

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

3、下载epel扩展源

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

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

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

yum clean all

yum makecache

二、进入网易镜像站:http://mirrors.163.com

点击使用帮助列的“centos使用帮助”

根据官网文档的“使用说明”操作即可。

三、清华镜像站:https://mirrors.tuna.tsinghua.edu.cn

点击右侧的“使用帮助”

在左侧选择“centos”,根据CentOS镜像使用帮助操作即可。

 

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