Monday, May 6, 2024
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 1616  / 1 Year ago, sun, february 12, 2023, 3:20:09

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




sources.list




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 ?


More From » apt

 Answers
6

(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.


[#35569] Monday, February 13, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
initiallartebeest

Total Points: 24
Total Questions: 118
Total Answers: 105

Location: Venezuela
Member since Thu, Jul 15, 2021
3 Years ago
;