Translation(s): English - Español - Français - Italiano - Português (Brasil) - Русский

How to manage the list of places you can download packages from. For more general information, see PackageManagement.

Introduction

Adding third-party repositories, or repositories from multiple versions of Debian, can break your system in ways that are hard to fix.

Apt downloads and installs packages from one or more software repositories (sometimes called suites, distributions, versions, or even sources).

A repository, such as the official DebianStable repository, is generally accessed from a web server. Local directories or CDs/DVDs can also be used.

Adding repositories lets you manage non-Debian packages using normal Debian tools. For example, Debian can't review the Opera browser because its source code isn't publicly available, but you can add Opera's repository if you personally decide to trust them. Then you can install, upgrade and remove Opera with your package manager.

Commonly used APT sources

Using APT sources

Using a graphical program

Some programs allow configuring Apt sources through a graphical interface. For example:

Using a text editor

The main APT sources configuration file is /etc/apt/sources.list.d/debian.sources, but if you add a new source, it's best to add a new file. Put it in the same directory, preferably with a name that describes the source and ends with .sources (e.g. /etc/apt/sources.list.d/neurodebian.sources for NeuroDebian).

You can edit these files (as root) using your favourite text editor. For information about the format, see sources.list(5).

APT sources format

{i} See also Debian Reference Manual - 2.1.4. Debian archive basics

debian.sources format

Supported since (at least) bullseye, recommended since trixie (see the Trixie release notes).

To use this format, create a file called something like /etc/apt/sources.list.d/<name>.sources (replace <name> with a good name for your sources):

Types: deb deb-src
URIs: http://deb.debian.org/debian
Suites: trixie trixie-updates
Components: main non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg

{i} This is technically known as deb822 format, and is also used for the files that store the information displayed by apt show.

sources.list format

Older and less readable, likely to be deprecated in a future release.

To use this format, create a file called something like /etc/apt/sources.list.d/<name>.list (replace <name> with a good name for your sources):

# TYPE URI                       SUITE    COMPONENTS...
deb http://deb.debian.org/debian bookworm main non-free-firmware
deb http://deb.debian.org/debian bookworm-updates main non-free-firmware
deb-src http://deb.debian.org/debian bookworm main non-free-firmware
deb-src http://deb.debian.org/debian bookworm-updates main non-free-firmware

Upgrading to the new format

Old sources.list files should be converted to the modern debian.sources format:

  1. run apt modernize-sources

    • optionally add --assume-yes or --assume-no to auto-accept or -deny the prompt

  2. compare your new files to the .list.bak files your old configuration has been renamed to

Alternatively, install software-properties-gtk and modify repositories with Applications menu > System > Administration > Software Sources.

Details of the APT source format

Archive Type

The Type says what is in the repository:

{i} the old sources.list format required repositories with both types to have one line for each type

Repository URI

The address of the repository. See the list of Debian repository mirrors.

Addresses often use http instead of https because Debian packaging security is designed not to need a secure network. If you build a minimal system but want to use https sources, remember to install ca-certificates.

{i} despite being called URIs, the new format only supports one URI per entry

Suite

Usually the codename of a release, like bookworm or sid. Can also be an alias like oldoldstable, oldstable, stable, testing or unstable - aliases trigger a full upgrade as soon as the next version of Debian is released.

For example, the current testing distribution is forky. If you want to stick with that release until end-of-life, set your suite to forky. Or if you want to help test whichever release is upcoming, use testing.

The stable alias is less useful than it initially seems - most people find themselves surprised by an upgrade of every package on their system at an unfortunate moment. It's probably better to set your suite to trixie, then update it to forky when you've got time to leave your computer updating overnight.

{i} the old sources.list format required repositories with multiple suites to have one line for each suite

Components

One or more parts of the repository, where users might not want to use all of them. Debian repositories generally include these components:

Examples

For a working configuration with all suites and components enabled, see:

debian.sources

Here is an example of a debian.sources for trixie:

Types: deb deb-src
URIs: https://deb.debian.org/debian
Suites: trixie trixie-updates
## If you want access to contrib and non-free components,
## add " contrib non-free" after "non-free-firmware":
Components: main non-free-firmware
Enabled: yes
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg

Types: deb deb-src
URIs: https://security.debian.org/debian-security
Suites: trixie-security
Components: main non-free-firmware
Enabled: yes
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg

{i} if you want backports that didn't make it into this version, add the trixie-backports suite.

sources.list

Here is an example of a sources.list for bookworm:

## If you want access to contrib and non-free components,
## add " contrib non-free" after every "non-free-firmware" in this file:
deb https://deb.debian.org/debian bookworm main non-free-firmware
deb-src https://deb.debian.org/debian bookworm main non-free-firmware

deb https://security.debian.org/debian-security bookworm-security main non-free-firmware
deb-src https://security.debian.org/debian-security bookworm-security main non-free-firmware

deb https://deb.debian.org/debian bookworm-updates main non-free-firmware
deb-src https://deb.debian.org/debian bookworm-updates main non-free-firmware

{i} if you want backports that didn't make it into this version, add the bookworm-backports suite.

Questions about the support cycle? Click here

Unstable

If you want the latest unstable versions of files, change the distribution to sid and remove the updates and security sources (not meaningful for the rolling development version). Your sources.list should look something like this:

Types: deb
URIs: https://deb.debian.org/debian/
Suites: sid
Components: main contrib non-free non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg

Using Tor with Apt

To use Tor, install the tor and apt-transport-tor packages, then use Debian's official onion services:

Types: deb deb-src
URIs: tor+http://2s4yqjx5ul6okpp3f2gaunr2syex5jgbfpfvhxxbbjwnrsvbk5v3qbid.onion/
Suites: trixie trixie-updates
## If you want access to contrib and non-free components,
## add " contrib non-free" after "non-free-firmware":
Components: main non-free-firmware
Enabled: yes
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg

Types: deb deb-src
URIs: tor+http://5ajw6aqf3ep7sijnscdzw77t7xq4xjpsy335yb2wiwgouo7yfxtjlmid.onion/
Suites: trixie-security
Components: main non-free-firmware
Enabled: yes
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg

CD-ROM

To use packages on a CD-ROM or DVD, insert the disk then do:

sudo apt-cdrom add

{i} Use -d <directory> to specify the directory to use

Name Resolution

Sometimes, a sufficiently broken Debian system may be unable to get updates:

$ sudo apt update
0% [Working]Unsupported socketcall: 20
Unsupported socketcall: 20
Unsupported socketcall: 20
Unsupported socketcall: 20
Unsupported socketcall: 20
Unsupported socketcall: 20
Unsupported socketcall: 20
Unsupported socketcall: 20
Err:1 https://deb.debian.org/debian testing InRelease
  Temporary failure resolving 'deb.debian.org'
Reading package lists... Done
W: Failed to fetch https://deb.debian.org/debian/dists/testing/InRelease  Temporary failure resolving 'deb.debian.org'
W: Some index files failed to download. They have been ignored, or old ones used instead.

If you expect updating will fix this, resolve your repository's IP address on another computer (e.g. by doing ping deb.debian.org or going to a DNS resolver site like nslookup.io), change the repository's domain name to its IP address, then try again:

# Hardcode your repository's IP address:
$ sudo cp /etc/apt/sources.list /etc/apt/sources.list.good
$ sudo sed -i -e 's/deb.debian.org/203.0.113.1/' /etc/apt/sources.list

# Update and upgrade:
$ sudo apt update
Get:1 https://203.0.113.1/debian testing InRelease [232 kB]
Get:2 https://203.0.113.1/debian testing/main s390x Packages [7583 kB]
Get:3 https://203.0.113.1/debian testing/main Translation-en [5134 kB]
Fetched 13.0 MB in 32s (403 kB/s)
Reading package lists... Done

$ sudo apt upgrade
...

# Reset your sources:
$ sudo mv /etc/apt/sources.list.good /etc/apt/sources.list

/!\ Repositories often have several IP addresses, and change those addresses from time to time. Hardcoding an IP address should only be used to work around short-term problems.

Debug Symbol Packages

Many packages have an associated dbgsym package that provides more information when debugging crashes. These require their own repositories, with the URI set to https://deb.debian.org/debian-debug and the suite set to e.g. testing-debug.

debian-debug.sources

Here is an example of a debian-debug.sources for trixie:

Types: deb deb-src
URIs: https://deb.debian.org/debian-debug
Suites: trixie-debug
## If you want access to contrib and non-free components,
## add " contrib non-free" after "non-free-firmware":
Components: main non-free-firmware
Enabled: yes
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg

sources-debug.list

Here is an example of a sources-debug.list for bookworm:

## If you want access to contrib and non-free components,
## add " contrib non-free" after "non-free-firmware":
deb https://deb.debian.org/debian-debug/ bookworm-debug main non-free-firmware

More information


CategoryPackageManagement