centos7下更改阿里yum源并禁用fastestmirror等插件

1,备份
进入到/etc/yum.repos.d/目录下

 [root@hadhive ~]# cd /etc/yum.repos.d/

备份CentOS-Base.repo

[root@hadhive yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.bkp 

也可以直接输入绝对路径进行备份

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

如果找不到repo文件所在位置可以输入以下命令进行查找

[root@hadhive ~]# find / -name "*.repo"

2,下载新的CentOS-Base.repo 到/etc/yum.repos.d/

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

然后运行以下命令

yum clean all
yum makecache

3,配置阿里云的epel源。
备份(如有配置epel源)

mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.bkp 

下载新repo 到/etc/yum.repos.d/

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

4,禁用插件
可以先查看所加载的插件信息

[hadhive@hadhive ~]$ yum info yum

编辑/etc/yum.conf将plugins设置为0(0为禁用插件,1为启用插件)
在这里插入图片描述
每个已安装的 yum插件都有自己的配置文件,文件位于 /etc/yum/pluginconf.d/ 目录下
我们可以直接编辑某个插件的配置文件,禁用是将enabled设置为0,启用是设置为1
在这里插入图片描述如果你只是想在某个 yum 命令执行时禁用所有插件,可使用 --noplugins

[root@hadhive ~]# yum update --noplugins

如果你只是想在某个yum命令执行时禁用某个插件,可以用 --disableplugin=
如果禁用多个插件,插件名称之间用逗号分隔

[root@hadhive ~]# yum update --disableplugin=fastestmirror,refresh-pack* 
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值