2

EXAMPLE SCENARIO: Installing Nginx

I am installing Nginx. In order to get the latest repo, I download the RPM from the Nginx website. Like so:

rpm -Uvh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm

Since I need to install PHP-FPM, I also downloaded a couple more repos from somewhere else, like so:

rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm


rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

Now the first repo also contains Nginx. So when I type:

yum install nginx

Which repo will YUM use to install Nginx?

Thanks!

2 Answers 2

0

If the package name absolutely the same in both repos, yum will resolve this alphabetically.

Therefore it will download the rpm from repo which is first in the natural order. Usually in my experience though I would always install yum priorities plugin, which would help me to prioritize repos on user defined criterias. You can get more info here: http://wiki.centos.org/PackageManagement/Yum/Priorities

EDIT:

My accepted answer is not correct. If the package name is absolutely the same in both repos, yum will not resolve this alphabetically. Michael was correct. This is an official answer from redhat about this scenario:

So in this condition, yum will simply query the repositories and whichever gets the first fetch query, will reply back and the package with its dependencies will be fetched out from the same. There will not be any conflicts. The package downloaded will be random in nature.

4
  • Thanks @Danila. Just to clarify: So if I have "nginx.repo" and "epel-release-6-8.repo", it will install Nginx from "epel-release-6-8" since the alphabet E is before N? And the same happens when you run yum update? Apr 27, 2013 at 4:37
  • Yes. If package names are absolutely the same. Apr 27, 2013 at 4:56
  • 2
    Really? I've never seen it do that. Apr 27, 2013 at 5:05
  • I'm actually observing the behaviour described in the initial answer.
    – Amir Abiri
    Nov 19, 2015 at 15:56
5

By default, you get the highest version of the package available in any enabled repository. The repository name is completely irrelevant.

Of course, various yum plugins such as priorities and versionlock can change which packages or package versions are available to you.

8
  • 1
    What if the packages are with exact the same name in both repos. Setup 2 local repos with different names and add to both the same rpm with the same names which provides the same stuff and see which repo it will choose on yum install rpm name. Apr 27, 2013 at 5:11
  • @DanilaLadner It chooses the higher version package every time. Apr 27, 2013 at 5:11
  • what if both repos have this rpm "php-mysql-5.4.6-1.x86_64.rpm"? Apr 27, 2013 at 5:14
  • @DanilaLadner Then who knows what will happen. But you would have to contrive such a scenario; it's either rare or nonexistent in the real world, since most third party repositories tag their packages with abbreviations of their names (e.g. .el6.remi.x86_64.rpm). Apr 27, 2013 at 5:17
  • Yes, I understand that and it is not really relevant. It used to be before when on RHEL 4 priorities plugin came out, packagers would provide internal serial number and yum source code before used to account for that number as well, but I still believe in yum code there is alphabetical sort on the same repos somewhere, i will try to find it and post it here tomorrow. Also I had a job where I had local repositories, and that would be the case. I mean to be frank it is not that hard to test. Apr 27, 2013 at 5:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .