yum新增镜像源


红帽官方手册RHEL7提到添加yum源的两种方式,一种是修改配置文件yum.conf,另一种是新增repo.d文件,并推荐读者使用第二种方式。

To define a new repository, you can either add a [repository]
section to the /etc/yum.conf file, or to a .repo file in the
/etc/yum.repos.d/ directory. All files with the .repo file extension
in this directory are read by yum, and it is recommended to define
your repositories here instead of in /etc/yum.conf.

两行代码添加新的yum源

yum-config-manager --add-repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all & yum makecache

多个镜像yum如何选择?

系统默认配置了fastestmirror插件,该插件能够告诉yum那个mirror速度最快。

cat /etc/yum/pluginconf.d/fastestmirror.conf

#开启fastestmirror插件
enabled=1

例如,我安装了阿里、网易、腾讯的yum源,系统会选择最快的网易源,帮我安装软件。

[root@VM-0-5-centos yum]# ls -ltr /etc/yum.repos.d/
total 56
-rw-r--r-- 1 root root 1572 Dec  1  2016 CentOS7-Base-163.repo
-rw-r--r-- 1 root root 2523 Jun 16  2018 Centos-7.repo
-rw-r--r-- 1 root root  474 Apr 24  2019 nodesource-el7.repo
-rw-r--r-- 1 root root  616 Nov 23 23:08 CentOS-x86_64-kernel.repo
-rw-r--r-- 1 root root 8515 Nov 23 23:08 CentOS-Vault.repo
-rw-r--r-- 1 root root 1331 Nov 23 23:08 CentOS-Sources.repo
-rw-r--r-- 1 root root  630 Nov 23 23:08 CentOS-Media.repo
-rw-r--r-- 1 root root  314 Nov 23 23:08 CentOS-fasttrack.repo
-rw-r--r-- 1 root root  649 Nov 23 23:08 CentOS-Debuginfo.repo
-rw-r--r-- 1 root root 1309 Nov 23 23:08 CentOS-CR.repo
-rw-r--r-- 1 root root  230 Dec 22 19:06 CentOS-Epel.repo
-rw-r--r-- 1 root root  614 Dec 22 19:06 CentOS-Base.repo

在这里插入图片描述

  • 2
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值