Linux 下 yum 的配置,加速插件和更改默认yum源

yum 安装完成后生成的配置文件及目录

  1. 主配置文件:/etc/yum.conf
  2. 资源库配置目录:/etc/yum.repos.d
  3. 重要文件: /etc/yum.repos.d/CentOS-Base.repo

yum 加速插件
实现的功能:可以自动选择速度最快的镜像

  1. 安装yum 加速插件:
    yum install yum-plugin-fastestmirror
  2. 加速插件的配置文件:
    /etc/yum/pluginconf.d/fastestmirror.conf
  3. yum镜像的速度测试记录文件:
    /var/cache/yum/timedhosts.txt

更换系统默认yum 源
举例:以更换yum源为阿里云yum源

  1. 备份系统默认的yum源

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

  2. 下载阿里云yum源

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

  3. 添加 epel 源

    yum -y install epel-release.noarch
    常用的yum源
    epel源:https://fedoraproject.org/wiki/EPEL
    repoforge源:http://repoforge.org/use/
    php和mysql源:https://webtatic.com

  4. 清理缓存

    yum clean all

  5. 生成新的缓存

    yum makecache

转载于:https://blog.51cto.com/snowlai/2136283

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值