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.
Contents
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
DebianStable: official Debian repository for the current release
StableProposedUpdates: official Debian repository for upcoming point releases (security and important bug fixes every ~2 months)
StableUpdates: official Debian repository for changes that cannot wait for the next point release, packages are also added to StableProposedUpdates for inclusion in the next point release
DebianSecurity: official Debian repository for frequent security updates
DebianBackports: more recent versions of some packages, compatible with DebianStable.
DebianTesting: current development state of the next stable Debian distribution
DebianUnstable: rolling development version containing the latest packages
DebianExperimental: development version containing the experimental/alpha/beta/untested packages
Using APT sources
Using a graphical program
Some programs allow configuring Apt sources through a graphical interface. For example:
Applications menu > Synaptic > Settings > Repositories
Applications menu > Settings > Software and updates
requires the software-properties-gtk package
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
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
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:
run apt modernize-sources
optionally add --assume-yes or --assume-no to auto-accept or -deny the prompt
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:
deb indicates that the archive contains normal binary packages (.deb)
deb-src indicates source packages (.dsc)
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.
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.
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:
DFSG-compliant packages that only depend on other DFSG-compliant packages
- only these packages are considered part of Debian proper
DFSG-compliant packages that depend on non-DFSG-compliant packages
- non-DFSG-compliant packages that are considered important enough to make available anyway
- e.g. widely-used fonts with odd licensing requirements
- non-DFSG-compliant firmware packages (for network cards etc.)
see Firmware for more information
Examples
For a working configuration with all suites and components enabled, see:
/usr/share/doc/apt/examples/debian.sources (trixie and later)
/usr/share/doc/apt/examples/sources.list (bookworm and earlier)
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
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
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
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
A list of UnofficialRepositories to get extra software (Opera, Google, etc.)
DebianRepository/UseThirdParty - Instructions to use to a third-party repository
sources.list(5) manual page
