Repository Management

Learn about the layout of the Debian repository and the different files a repository contains.

Paths to repositories

Debian machines pull packages from repositories. The paths to repositories are configured in the file /etc/apt/source.list/ or /etc/apt/sources.list.d/*.list, in the format:

deb <URL> <DISTRIBUTION> [<COMPONENT>]+
deb-src <URL> <DISTRIBUTION> [<COMPONENT>]+

For example:

deb http://ftp.debian.org/debian bullseye main contrib non-free

The above line specifies that for a binary package (deb-src would be for source packages), the repository root URL is http://ftp.debian.org/debian for the distribution bullseye, which configures the use of the components main, contrib, and non-free.

Let’s talk about how a repository works and how to create and manage one.

Repository layout

A Debian repository consists of a bunch of plain text files and .deb files, following a naming and content schema documented in the Debian Wiki.

The Release file

When a command like apt update downloads information from a repository, it first fetches a file called Release from the path <URL>/dists/<DISTRIBUTION>/Release. For our example above, this would be http://ftp.debian.org/debian/dists/bullseye/Release.

In addition, apt fetches a file from the same path but with the extension .gpg, which contains a cryptographic signature of the Release file.

Instead of a combination of Release and Release.gpg, apt also accepts a file InRelease, which contains both the contents of the Release file and a cryptographic signature inline.

Get hands-on with 1200+ tech skills courses.