Apt Pinning

I normally stick with Debian Stable on my laptop. But atleast there was one package which I needed out of testing or unstable, git. So I thought of using the Debian backports repository. I followed the instructions to use the backports repository and came through this very good APT Pinning document. This is how I installed git on my laptop.

I added the following line to my /etc/apt/source.list file

# Debian backports
deb http://www.backports.org/debian/ sarge-backports main contrib non-free

and the following to my /etc/apt/preferences file. I needed to create this file as I was not using multiple repositories before, so I had to make all the entries. However, only the middle entry which pins the priority of the sarge-backports repository is required. If most of the time stable is preferred then the priority of stable has to be higher than that of sarge-backports. The last pinning which specifies the priority of -10 to other Debian releases is just a proactive measure to make sure that if I add a new Debian repository to the /etc/apt/sources.list file then I need to specify a pinning preference explicitly in this file, else it will have the priority of -10 which is lowest or no priority at all.

# Debian stable has a higher priority than the
# backports repository
Package: *
Pin: release o=Debian,a=stable
Pin-Priority: 900

Package: *
Pin: release a=sarge-backports
Pin-Priority: 200

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

This entry was posted in FLOSS and tagged , . Bookmark the permalink.