Posted on Wed 17 August 2016
Let us suppose that you are running Debian stable, but there are some packages that you would like from the backports archive. However, you don’t want all backports replacements to be brought in.
In etc/apt/sources.list.d/backposts.list
add the
backports repo. As I write this, Jessie is stable, so:
deb http://http.debian.net/debian jessie-backports main contrib non-free
Note that the source lists must end with .list
or they
will be ignored.
In etc/apt/preferences.d/priorities
:
Package: *
Pin: release a=jessie
Pin-Priority: 900
Package: *
Pin: release a=jessie-backports
Pin-Priority: 50
and run apt-get update
There are magic levels for the numbers in the priority field. They
are explained, at length, in man apt_preferences
. The
highlights:
P >= 1000 causes a version to be installed even if this constitutes a downgrade of the package
990 <= P < 1000 causes a version to be installed even if it does not come from the target release, unless the installed version is more recent
500 <= P < 990 causes a version to be installed unless there is a version available belonging to the target release or the installed version is more recent
100 <= P < 500 causes a version to be installed unless there is a version available belonging to some other distribution or the installed version is more recent
0 < P < 100 causes a version to be installed only if there is no installed version of the package
P < 0 prevents the version from being installed
Now, to install a single backported package,
apt-get install packagename/jessie-backports
, and to
install a backported package plus any dependencies which are also
backported, use apt-get -t jessie-backports packagename