Ade Malsasa Akbar contact
Senior author, Open Source enthusiast.
Friday, December 15, 2023 at 23:22

This tutorial will explain Debian repository and how to configure to use it to install and update software packages. You will learn about sources.list configuration file as well as Software & Source graphical configuration program to practice it. Debian GNU/Linux is a complete computer operating system alternative to Windows and MacOS as well as the most respected community-managed free software distribution. We hope this tutorial will be helpful to you. Now let's practice.

 

Subscribe to UbuntuBuzz Telegram Channel to get article updates.

Debian Packages

Debian is basically a software distribution, that is, a collection of copies of a lot of software distributed to computer users, but unlike Windows or MacOS, Debian is free software, meaning it distributes software which the users are free (referring to software freedom not price) to use, study, modify and share (including buying and selling them). In Debian, every software is organized in a form of file that is called package. A package is divided into two, source code package in .orig.tar.xz format, and binary code package in .deb format ( similar to .exe and .apk on Windows and Android, respectively). 

 

(Screenshot showing a program Geany Text Editor placed in Home directory in form of binary package .deb and source code package .orig.tar.gz with both total size 8MB)

 

Debian Repository

A repository in Debian is a collection where all of Debian software packages, both source and binary, stored and as the source for Debian users to take their software installation from. Debian repository is located online at archive.debian.org or offline in form of DVD discs and other storages.

 

 

(Screenshot of the Debian repository archive.debian.org viewed using web browser with four of its folders visible dists, pool (containing the actual software packages), project, and tools)


Debian OS Versions

Debian is under constant development and maintenance. Today, Bookworm, Bullseye and Buster and three names of the latest version releases of Debian 12, 11, and 10 respectively released in the year 2023, 2021 and 2019 as a result of that constant development. Debian code names are taken from Toy Story's characters' names. 

 

(Screenshot of table of Debian releases history from 1994 to 2023)


In every OS version, Debian is divided into three releases:

  • stable
  • testing
  • unstable

In 2019, stable release is Debian 10 "Buster." In 2021, stable is Debian 11 "Bullseye". In 2023, stable is "Bookworm". By time, once a release is stopped being developed, it will no longer receive updates, and moved into another release named oldstable or even oldoldstable.

 

(A quick way to tell what version of Debian one is using is to run About from the applications menu then a window like picture below saying "Debian GNU/Linux 12 Bookworm" will show)

 

A Debian user must be a user of either one of the three and please note that most users are users of stable releases of Debian.

Note that stable release has stable repository, testing release has testing repository, and unstable release has unstable repository as well, respectively. 

Note that all Debian repositories are not compatible with each others and must be used exactly matching the user's release version for example the user of Debian bookworm must use bookworm repository and must not mix it with bullseye repository.


Debian Repository Components

In every Debian release, the repository is divided into three components ("choices"):

  • main
  • contrib
  • nonfree 

 

main is free software packages repository.

contrib is free software packages repository, but packages in it pull proprietary software usually from non-free repository.

non-free is proprietary software repository. (Note that non-free here does not mean non-gratis or paid but simply does not respect user's freedom.)

This means for example, in 2023, Debian release version "stable" also known has "bookworm" has three components a user can choose to enable any of them "main", "contrib" and "non-free." 

In the same year, the "testing" release also known as "trixie", will also have three of "main", "contrib" and "non-free." Note that trixie will be Debian 13 when it would have been released perhaps several years later.

Still in the same year, "oldstable" release also known as "bullseye" will still have three of "main", "contrib" and "non-free."

 

Debian sources.list File

In Debian, there is a file named sources.list inside /etc/apt directory. This sources.list is the configuration of a Debian system in installing and updating software packages and upgrading the whole system. There are many ways to read this file, for example:

$ cat /etc/apt/sources.list
$ nano /etc/apt/sources.list
$ emacs /etc/apt/sources.list
 

An example of Debian sources.list content may look like the following:

Code:

deb http://deb.debian.org/debian/ bookworm main non-free contrib
deb-src http://deb.debian.org/debian/ bookworm main non-free contrib
deb [trusted=yes] file:/run/live/medium bookworm main non-free-firmware

Screenshot:


Lines of code above are taken from Debian 12 "Bookworm" and in this year this article is written it is the "stable" release.

The meaning of the lines of code above is as the following:

deb : sign of enabling binary packages repository.

deb-src : sign of enabling source code packages repository.

archive.debian.org : url address of the repository.

bookworm : name of the Debian release repository to be used.

main : sign of enabling main component of the repository.

contrib : sign of enabling contrib component of the repository.

non-free : sign of enabling non-free component of the repository.

non-free-firmware : sign of enabling non-free-firmware component of the repository. This component is newly introduced in 2023.


How to configure Debian repository

Configuring Debian repository for the users means choosing which one repository to use and which one not to. This can be achieved in basically tho methods:
 

By using Software & Sources

This graphical method is more familiar to most users coming from Microsoft Windows-like experiences.

1. Open applications menu.

2. Type Software & Sources.

3. Click Software & Sources application icon.

4. The application will show a list of repositories consisting of "main", "contrib" and "non-free" along with others like "Sources" and mirrors.

 

Please note that since Debian 12 in 2023, there is a new component introduced "non-free-firmware" containing special software required for many GPU and WIFI to function properly but they are not libre.

5. Give check mark to a repository to enable it, remove check mark to disable it. 

6. Click Close.

7. Click Reload. This requires internet access.

8. Once Reload is finished, Debian repositories are ready to use.

 

Now you can start installing software using GNOME Software.

 

By using console

This command line interface based method is faster and better for many users who have been accustomed to Debian GNU/Linux configurations. 

1. Open Terminal.

2. Run console text editor with administrator access:

$ sudo nano /etc/apt/sources.list 

3. Edit the configuration text as you need and save as with Ctrl+O and exit with Ctrl+X. An example of full Debian 12 repositories with all components enabled is as the following:

deb http://deb.debian.org/debian bookworm main contrib non-free
deb http://deb.debian.org/debian bookworm-updates main contrib non-free
deb http://deb.debian.org/debian-security bookworm-security main contrib non-free

deb-src http://deb.debian.org/debian bookworm main contrib non-free
deb-src http://deb.debian.org/debian bookworm-updates main contrib non-free
deb-src http://deb.debian.org/debian-security bookworm-security main contrib non-free

To disable a repository completely, meaning disabling a line, simply put hashtag character ( # ) in the beginning of its line. Mentioning a component name means enabling it, deleting a component name means disabling it. 

4. Once editing finished, you need to refresh APT so Debian recognizes the new repository configuration:

$ sudo apt-get update 

Note that if a user want Debian to be closer to software freedom, he/she in general can disable contrib and non-free and he/she can live with only main repository. (We encourage everyone who has the abilities to reverse engineer and develop free firmware so Debian in particular and GNU/Linux in general will be able to run all hardware without non-free firmware anymore in the future.)


5. Once refresh finished, Debian is ready to update, install and upgrade software from the configured repositories.

 

Happy hacking!


References

https://wiki.debian.org/DebianRepository

https://wiki.debian.org/DebianSoftware

https://wiki.debian.org/SourcesList

https://www.debian.org/doc/manuals/debian-reference/ch02 

 

****


This article is licensed under CC BY-SA 3.0.