Table of Contents

Ubuntu - Packages - Package Priorities

APT supports setting priorities associated with each package source.

It is possible to assign a priority to each available package (the same package can have several priorities depending on its version or the distribution providing it).

These priorities will influence APT's behavior: for each package, it will always select the version with the highest priority (except if this version is older than the installed one and if its priority is less than 1000).

Different priorities can also be used to extend one distribution with one or two newer packages from Testing, Unstable or Experimental.


Priority Settings

Priority ValuesAction
<0Package will never be installed
0-100Package will only be installed if no other version of the package is already installed
100-500Package will only be installed if there is no other newer version installed or available in another distribution
501-990Package will only be installed if there is no newer version installed or available in the target distribution
990-1000Package will be installed except if the installed version is newer
>1000Package will always be installed even if it forces APT to downgrade to an older version

Changing Package Priority

Edit the /etc/apt/preferences file.

/etc/apt/preferences
Package: *
Pin: release a=stable
Pin-Priority: 900
 
Package: *
Pin: release o=Debian
Pin-Priority: -10

Force no upgrades of a package

Assume that you have a server with several local programs depending on the version 5.14 of Perl and that you want to ensure that upgrades will not install another version of it. You could use this entry:

/etc/apt/preferences
Package: perl
Pin: version 5.14*
Pin-Priority: 1001