$linuxjunkies
>

apt-pinning

also: pinning, apt preferences

A mechanism in Debian/Ubuntu systems to control which package versions are installed or prioritized from different repositories, preventing unwanted upgrades or enforcing specific versions.

apt-pinning allows you to set preferences for package versions across different repositories (like stable, testing, unstable, or third-party PPAs). The system assigns a priority pin to each package version, and apt will install the version with the highest pin priority.

Common use cases include: staying on a stable release while selectively upgrading specific packages from testing, preventing a package from upgrading beyond a certain version, or prioritizing packages from one repository over another.

Pinning is configured in the /etc/apt/preferences file or files in /etc/apt/preferences.d/. For example, to pin a package to a specific release:

Package: nginx
Pin: release a=stable
Pin-Priority: 1000

Pin priorities typically range from -1 (never install) to 1000+ (always prefer this version). The default priority for unspecified versions is 500.

Related terms