Yum Priorities on CentOS 6.5 - rharmonson/richtech GitHub Wiki
#Yum Priorities on CentOS 6.5
Reference:
http://wiki.centos.org/PackageManagement/Yum/Priorities
Using yum priorities plugin, we can avoid package conflicts as a result of having multiple repositories enabled. Typically, used to not overwrite base packages or avoid package conflicts when using two or more third party repositories, i.e. nginx repo vs. epel.
##Install yum priorities plugin
# yum install yum-plugin-priorities
##Configure Repositories After installation, edit each repo file and add "priority=#" where # is 1 or more. Highest priority is lowest number, i.e. 1 versus 99. For example, below is the CentOS Base repository with the last line added, [color=#ff0000]priority=1[/color].
[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=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
priority=1
##Recommendations One author's recommendation is to use the following values:
[base], [addons], [updates], [extras] ... priority=1[/li]
[centosplus] priority=1 (same priority as base and updates) but should be left disabled[/li]
[contrib] ... priority=2[/li]
Third Party Repos ... priority=N (where N is > 10 and based on your preference)[/li]
One additional suggestion is to do not use priorities in consecutive numbers, but skip by five or tens. This means you can add repositories, later, without revising existing priorities.
##Review Repository Priorities You can list all repositories set up on your system by a yum repolist all. However, this does not show priority scores. Here's a one liner for that. If no number is defined, the default is the lowest priority (99).
sed -n -e "/^\[/h; /priority *=/{ G; s/\n/ /; s/ity=/ity = /; p }" /etc/yum.repos.d/*.repo | sort -k3n