APT will always install the latest version that isn't excluded by preferences. Preferences are indicated in the file /etc/apt/preferences
(and in files under /etc/apt/preferences.d
).
Some repositories have a configuration that prevents their packages from being installed automatically. For example, the Debian backports have release files (which you can see in /var/lib/apt/lists
) that contain
NotAutomatic: yes
ButAutomaticUpgrades: yes
If you have multiple sources for the exact same package (i.e. same package name, same version number), then APT downloads from the first source found in /etc/apt/sources.list
(or /etc/apt/sources.list.d/*
; the files are searched in lexicographic order, and the sources are searched in order inside each file). So list local mirrors first. The order in sources.list
is irrelevant for packages that have a different version number.