Setup Debian Testing sources apt repository on Debian Stable
This guide adds the Debian Testing sources repositories to Debian Stable without changing the standard system behaviour.
This howto is tested on :
- Debian 6.0 Squeeze
- Debian 7.0 Wheezy
Paramters
Provide the name of the repository version to install:
DEBIAN_VERSION="testing"
Note: This howto is also valid to install the repositories of the previous Debian stable version:
# DEBIAN_VERSION="squeeze"
Installation
Install the needed software:
command apt-get install lsb-release
Detect the distribution name:
CURRENT_DEBIAN_VERSION="$(command lsb_release -cs)"
Detect the mirror used by the installation:
MIRROR="$(command egrep "^deb.*${CURRENT_DEBIAN_VERSION}" '/etc/apt/sources.list' \
| command egrep -v "updates|-src|cdrom" \
| command sed -e 's/[ \t][ \t]*/ /g' \
| cut --delimiter=" " --fields=2)"
Repository setup
Add the sources repositories to the apt configuration :
command echo "# Debian ${DEBIAN_VERSION} sources repository.
deb ${MIRROR} ${DEBIAN_VERSION} main contrib non-free
deb-src ${MIRROR} ${DEBIAN_VERSION} main contrib non-free" \
> "/etc/apt/sources.list.d/${DEBIAN_VERSION}.list"
Assign a very low priority to repository packages to prevent system pollution :
command echo "Package: *
Pin: release o=Debian,a=${DEBIAN_VERSION},l=Debian
Pin-Priority: 90" \
> "/etc/apt/preferences.d/${DEBIAN_VERSION}"
Update the list of available packages :
command apt-get update
Usage
You can now download sources for software available in the added repositories.
Install a package from testing repositories with:
# command apt-get install package/testing
To get a software sources from Testing repositories, use the -t option :
# command apt-get -t "testing" source "package"
Thanks
- Thanks to jeyg.info (fr) for Les branches Debian et l'APT Pinning (fr).