Ubuntu: Repo preferences over one to another?


if a same software (different version) are present in two repos both added in


then which one will get installed when I run install command

apt-get install x


Also how can I choice one repo over another if both provide application with same name ?


(This answer is based on the default setup of Ubuntu, with default repository preference)

If the same software has different versions, Apt will always try to use the most recent version of the software subject to dependency constraints.

*Please note that, Apt also look at the priority of a repository, if a higher priority of a repository has lower version, Apt won't upgrade the package. In default Ubuntu installation, all enabled repository has priority 500 except the backport repository, which has priority 100. So, if a software has higher versioned package in backport repository, that software will not be upgraded with sudo apt-get install x command. You need to explicitly tell apt to use that repository by using command like this: sudo apt-get install x/precise-backports. *

But, if two repo provide the same software with the same version, then Apt will install software from the repository which comes first in the sources.list file.

I'm quoting from apt_preference manual page:

   Several instances of the same version of a package may be available     when the sources.list(5) file contains references to more than one     source. In this case apt-get downloads the instance listed earliest in     the sources.list(5) file. The APT preferences file does not affect the     choice of instance, only the choice of version.  


It depends on which version is available where. To see which version will be installed, with the repositories in question added, you can run apt-cache policy x, to follow your example, and it will show you the installed version, and the candidate (which is the version which would be installed, if you install or upgrade).

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »