YUM源使用阿里镜像

备份系统自带的yum源

# 前提:需要联网才能使用

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
Centos如何安装阿里云yum源

下载和自己操作系统版本对应的yum源

(wget命令需要安装否则无法下载!)

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
Centos如何安装阿里云yum源

或者用另外一种方法下载

curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

epel : 扩展包安装

curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

建议采用后面一种方法下载,感觉效率要高些

Centos如何安装阿里云yum源

运行`yum makecache`生成缓存

Centos如何安装阿里云yum源
vim /etc/yum.repos.d/CentOS-Base.repo

查看里面的内容,确实已经由系统自带的yum源替换为了阿里的yum源了

Centos如何安装阿里云yum源

使用yum源安装测试速度

yum -y groupinstall "GNOME Desktop"

如图所示,下载rpm包的速度得到了明显的提升

Centos如何安装阿里云yum源
原文地址:https://www.cnblogs.com/Mercury-linux/p/11505500.html