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?



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


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.

  • 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? – Honey Badger Apr 27 '13 at 4:37
  • Yes. If package names are absolutely the same. – Danila Ladner Apr 27 '13 at 4:56
  • 2
    Really? I've never seen it do that. – Michael Hampton Apr 27 '13 at 5:05
  • I'm actually observing the behaviour described in the initial answer. – Amir Abiri Nov 19 '15 at 15:56

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.

  • 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. – Danila Ladner Apr 27 '13 at 5:11
  • @DanilaLadner It chooses the higher version package every time. – Michael Hampton Apr 27 '13 at 5:11
  • what if both repos have this rpm "php-mysql-5.4.6-1.x86_64.rpm"? – Danila Ladner Apr 27 '13 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). – Michael Hampton Apr 27 '13 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. – Danila Ladner Apr 27 '13 at 5:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.