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 Values | Action |
---|---|
<0 | Package will never be installed |
0-100 | Package will only be installed if no other version of the package is already installed |
100-500 | Package will only be installed if there is no other newer version installed or available in another distribution |
501-990 | Package will only be installed if there is no newer version installed or available in the target distribution |
990-1000 | Package will be installed except if the installed version is newer |
>1000 | Package 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
- a=stable defines the name of the selected distribution.
- o=Debian limits the scope to packages whose origin is “Debian”.
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