Saturday, August 7, 2010

Debian: How to apt-pinning

I am currently using debian testing but in some cases I needed to install newer versions of some packages which were only available in unstable (e.g. nvidia's driver). Therefore, I had to set up apt-pinning.

First of all you need to add the unstable repos in the /etc/apt/sources.list

deb http://ftp.debian.org/debian/ unstable main contrib non-free

Then edit /etc/apt/apt.conf and add the following line:

APT::Default-Release "testing";

Edit the /etc/apt/preferences file and add:

Package: *
Pin: release a=testing
Pin-Priority: 700

Package: *
Pin: release a=unstable
Pin-Priority: 500

For more info about the preferences take a look at apt_preferences man page.

Finally, run apt-get update

You can now install packages from unstable using the -t unstable option. For example,

apt-get install -t unstable iceweasel

You must be very careful while doing this and watch out for the dependencies that may be installed in order to avoid breaking packages already installed from testing. It may be useful to run apt-get install -t unstable -s iceweasel which just simulates the installation of the package without affecting the system to review any dependencies and upgrades.


No comments: