Linux – How to only allow a package to be downloaded from a specific repository using Yum

linuxpackage-managementpackagesyum

Context:

We've got multiple custom-added yum repositories (on CentOS 6), and our users regularly install various/arbitrary software via yum to test things.

We have a package that is available on multiple repositories. It's named the exact same thing on two different repositories, call them Y and Z, but the packages are NOT identical. Both repositories are used for other things/installations, but the package in question should only ever be installed from repo Y.

What I've Tried:

When I manually install the package in question, I exclude/include repos to ensure that I'm getting the correct version. However, ordinary users a) forget to do that, and b) sometimes install other packages that depend on the package in question, and it gets installed from the wrong repo as part of the dependency installation process.

Question:

Is there any way to configure yum's defaults to say that "if package X is available from more than one source, prefer/insist on source Y over source Z?"

My goal is not to have to change the normal yum install process that our users currently have; they should still be able to install arbitrary software using the simplest syntax possible. It's just that specific packages (either installed manually or as part of dependency installation) should only be allowed to come from certain repos.

Best Answer

There is the yum-plugin-priorities package.
That allows you to give priority to configured repositories.
See here: http://wiki.centos.org/PackageManagement/Yum/Priorities#head-6f52124e909c1691eb0c501ba38ae9202b66d6da

Or you can exclude packages in /etc/yum.conf.
http://linux.die.net/man/5/yum.conf:

exclude List of packages to exclude from updates or installs. This should be a space separated list. Shell globs using wildcards (eg. * and ?) are allowed.

This can be set globally or per repository.