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. 清理缓存
    yum clean all
  4. 生成新的缓存
    yum makecache

猜你喜欢

转载自blog.51cto.com/snowlai/2136283
今日推荐