Ever wanted to run certain packages from one version of the operating system ( in this case Debian ) without having to upgrade (or downgrade) the entire system?
Well, the “Pin” option in the Apt package management system lets you do that. It’s pretty simple too!
1) Add the repositories for the two versions you want to have packages from in /etc/apt/sources.list. In this example we have Debian Stable and Testing:
#Stable deb http://ftp.us.debian.org/debian stable main non-free contrib deb http://non-us.debian.org/debian-non-US stable/non-US main contrib non-free #Testing deb http://ftp.us.debian.org/debian testing main non-free contrib deb http://non-us.debian.org/debian-non-US testing/non-US main contrib non-free
Run apt-get update to add the repositories to apt.
2) Next, modify the file /etc/apt/preferences. This is where the actual “pinning” takes place. By default, apt installs the highest version available. So let’s say we would have the two repositories and we would like to install the package “dovecot-common”. Apt will take the highest version of that package which is naturally available in the “Testing” repository. But say we wanted to run the older of version of “dovecot-common” (for our own reasons, doesn’t matter why), which is available in the “Stable” repository. We would have this in our /etc/apt/preferences file:
Package: dovecot-common Pin: release a=stable Pin-Priority: 700 Package: dovecot-common Pin: release a=testing Pin-Priority: 600
Notice that we have a higher priority number for “dovecot-common” in the “stable” release. In Apt, the package with the highest priority wins, no matter the package version.
So now that you know this, you can use it to mix-match between packages from different repositories, while using strictly apt, no forcing of install and keeping them updated (if a newer version appears in that repository, apt will install it).