You are here: Home / Debian GNU/Linux / System / Software / Setup the contrib and non-free Debian repositories

Setup the contrib and non-free Debian repositories

by Pierre-Yves Landuré last modified Nov 26, 2016 09:52

The default Debian installation only provide software from the "main" repository. In order to have access to all Debian softwares, contrib and non-free repositories must be configured. This howto describe an automated process to enable the contrib and non-free repositories in Apt.

This howto is tested on:

  • Debian 6.0 Squeeze
  • Debian 7.0 Wheezy

Installation

Install the Linux Standard Base software :

command apt-get install lsb-release

Detect the distribution name :

DEBIAN_VERSION="$(command lsb_release -cs)"

Detect the currently used download mirror :

MIRROR=$(command egrep "^deb.*${DEBIAN_VERSION}" '/etc/apt/sources.list' \
    | command egrep -v "updates|-src|cdrom" \
    | cut --delimiter=" " --fields=2)

Add the contrib repository to Apt configuration :

command echo "# Debian contrib repository.
deb http://ftp.fr.debian.org/debian/ ${DEBIAN_VERSION} contrib
deb-src http://ftp.fr.debian.org/debian/ ${DEBIAN_VERSION} contrib

deb http://security.debian.org/ ${DEBIAN_VERSION}/updates contrib
deb-src http://security.debian.org/ ${DEBIAN_VERSION}/updates contrib" \
    > '/etc/apt/sources.list.d/contrib.list'

Add the non-free repository to Apt configuration :

command echo "# Debian non-free repository.
deb http://ftp.fr.debian.org/debian/ ${DEBIAN_VERSION} non-free
deb-src http://ftp.fr.debian.org/debian/ ${DEBIAN_VERSION} non-free

deb http://security.debian.org/ ${DEBIAN_VERSION}/updates non-free
deb-src http://security.debian.org/ ${DEBIAN_VERSION}/updates non-free" \
    > '/etc/apt/sources.list.d/non-free.list'

Update the list of available packages :

command apt-get update