Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: How to Set Priotrities for YUM Repositories  (Read 1714 times)

0 Members and 1 Guest are viewing this topic.

vinayakk

  • Guest
How to Set Priotrities for YUM Repositories
« on: December 29, 2013, 11:57:34 pm »
Sometime when you have enabled many YUM Repositories like local repository, rpmforge, ATrpms for your server and it’s quite difficult to manage packages where you want that the package which you want to install too be searched on Local Repository first, then to CentOS Base, update and if it doens’t find the package here it will go for any other Third Party Repositories.

This Task can be done by setting up Priority for the Yum Repositories. Following are the steps to set Priorities for YUM Repositories

1) Install yum-priorities

The yum-priorities is used to enforce ordered protection of repositories, by giving priorities to repositories. Packages from repositories with a lower priority will never be used to upgrade packages that were installed from a repository with a higher priority. The priorities are also in effect when a new package is installed – if a package is in more than one repository, it will be installed from the repository with the highest priority. This plugin is particularly useful for anyone who uses one or more third-party repositories, as these repositories may update system files, which can potentially compromise the stability of your CentOS installation. This Package can be installed using following YUM Command.

[root@server ~]# yum install yum-priorities -y

**using option -y with yum will allow yum to install package with taking permission from user.

2) Applying Priorities

Priorities for a Repository need to be added in .repo file. Following is the syntax for setting Priority

priority=[NUM]

Here [NUM] will be the Priority. The Repository with higher priority will be used for installing any package. e.g. if you want your local repository should have highest priority than you can set highest priority for the same like below

[localrepo]
name = CentOS $releasever – MyLocalRepo
baseurl = file:///opt/CENTOS/RPMS/
enabled=1
gpgcheck=0
priority=10

All other repositories will have lesser value as compared to Local Repository.