How to instruct yum to install a specific package (rpm) from a specific repo
Asked Answered
R

2

20

If the rpm package is available in multiple repos (configured in /etc/yum.repos.d/ directory), yum is scanning all the repo files and installing it from the one which has the latest version of that package.

I want the package to be downloaded from a specific repo, also I don't want to completely disable the other repositories, instead, I want just one package to be fetched from a specific repo, and disable it from getting downloaded from other repo.

I also don't want to use the version as a filter as there could be the same version of the same package present on multiple repos.

Rochelle answered 22/8, 2018 at 9:29 Comment(0)
D
47

you can tell yum which repositories he can use:

yum --disablerepo="*" --enablerepo="<desired-repo-id>" install package-name

This does not permanently enable/disable repositories; just for this command execution.

Domenicadomenico answered 22/8, 2018 at 10:1 Comment(2)
The downside of this approach is that dependencies have to be installed beforehand if the enabled repo doesn't have them.Photoplay
@LucasBustamante which is quite logical... If you have dependencies outside the repositories you use...Domenicadomenico
B
12

If you don't want to disable all repos, then only solution here is to use yum-priorities. It's a plugin.

$ yum install yum-plugin-priorities

Then in a yum repo in /etc/yum.repos.d/*.repo, you can use,

[some_repo]
....
priority=1

Note, the lowest numerical value represents the highest priority. If your package is available in multiple repos, installation/update will occur from the highest priority repo.

Read more here: https://wiki.centos.org/PackageManagement/Yum/Priorities

Buyse answered 28/8, 2018 at 18:33 Comment(1)
This works for rpm-ostree.Grundy

© 2022 - 2024 — McMap. All rights reserved.