yum更新源优先级插件yum-priorities



这个插件是用来设置yum在调用软件源时的顺序的。因为官方提供的软件源,都是比较稳定和被推荐使用的。因此,官方源的顺序要高于第三方源的顺序。

1.安装 yum-priorities

yum install yum-priorities

2.priorities的配置文件是/etc/yum/pluginconf.d/priorities.conf,确认其是否存在。
其内容为:

[main]
enabled=1   # 0禁用 1启用

3.编辑 /etc/yum.repos.d/目录下的*.repo 文件来设置优先级。

参数为:

priority=N # N的值为1-99

推荐的设置为:
[base], [addons], [updates], [extras] … priority=1
[centosplus],[contrib] … priority=2
Third Party Repos such as rpmforge … priority=N (where N is > 10 and based on your preference)

数字越大,优先级越低

例如

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
priority=1

#released updates 
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
priority=1

要禁用yum优先级功能,只需要在 /etc/yum/pluginconf.d/priorities.conf 中将 enable=1 改为 enable=0 即可。不建议

标签: linux, yum

相关文章

评论已关闭