How do I pin packages in APT?

You can tell APT to use a particular newer version of a package from the ‘testing’ Debian distribution (“jessie”) using APT package “pinning”. You’ll need to specify any dependent packages as well. For example, to run “graphite” from ‘testing’, create /etc/apt/preferences.d/graphite:

Package: graphite-web python-django-tagging graphite-carbon python-whisper libc6 libc6-dev
Pin: release n=jessie
Pin-Priority: 900

Make sure to specify your default distribution preferences. Create a file like /etc/apt/preferences.d/preferred-distro:

Package: *
Pin: release a=wheezy
Pin-Priority: 900

Package: *
Pin: release a=jessie
Pin-Priority: -10

Package: *
Pin: release a=experimental
Pin-Priority: -10

Package: *
Pin: release o=Debian
Pin-Priority: -10

..and make sure APT knows to load the package lists from each distribution that you’ll be referencing in /etc/apt/sources.list:

deb wheezy         main
deb-src wheezy         main
deb   wheezy/updates main
deb-src   wheezy/updates main

deb jessie         main
deb-src jessie         main

deb experimental         main
deb-src experimental         main

Share: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Twitter
  • Facebook
  • Google Bookmarks
  • LinkedIn
  • Reddit
  • StumbleUpon

Leave a Reply

Your email address will not be published. Required fields are marked *