Sources.list is the file located in Debian 12 which determines from where the software packages are retrieved. This is important because it ensures that the system should get the latest software updates and also security updates.
In this guide, with the help of the step-by-step method, the configuration of the sources.list file has been explained. Let’s start with the understanding of the sources.list file in Debian 12.
What are the sources.list File on Debian 12?
The sources.list file is used to manage the software and security update on Debian 12. It tells the computer from where the latest security updates, as well as package updates, should be downloaded on the computer.
The sources.list file is located in the /etc/apt/ directory and is an important part of the software management system. The below-mentioned components are being directly managed by the sources.list file:
- Installation and Updates of Software: The package manager including the apt package manager, follows the sources.list file to download the latest updates of the software packages.
- Security: By downloading the latest security updates from the mentioned file, Debian remains secure.
- Third-party Software: This file also helps in downloading the software from the third party by ensuring that the Debian software environment remains functional.
- Dependencies Issue: It also installs the dependencies of most of the packages by default which ensures the smooth operation of the installed packages.
The sources.list file consists of four major parts:
- Archive Type: One can use two types of archive types, either “deb” for binaries of the repository or “deb-src” for source file format packages.
- URL: It directs the URL from where the updates are supposed to download.
- Distribution: This will define the Linux distribution name for which the file is being configured.
- Component: This will indicate the type of repository which can be main, universal, multiverse, or restricted.
What is the Method for Configuring the sources.list on Debian 12?
To configure the sources.list file in Debian 12, open the terminal, and execute the commands, mentioned in the steps.
Step 1: Open the Root Terminal
To make changes in the configuration files, it is recommended to open the root terminal:
$ sudo su
If you do not want to open the root terminal, then use the “sudo” command after ensuring the user is in the sudoers file.
Step 2: Create a Backup
To make changes in the configuration files of the system, it is supposed to be a good practice to create a backup. To create a backup of the sources.list file, run the command:
# cp /etc/apt/sources.list /etc/apt/sources.list.bak
Step 3: Open the sources.list File
Now opens the file to configure it:
# nano /etc/apt/sources.list
Step 4: Edit the File
To make sure that the updates including security and software should be downloaded from Debian’s official repositories by replacing the below-mentioned lines:
# Debian Main Repositories
deb http://deb.debian.org/debian/ bookworm main contrib non-free
deb-src http://deb.debian.org/debian/ bookworm main contrib non-free
# Debian Security Updates
deb http://security.debian.org/debian-security bookworm-security main contrib non-free
deb-src http://security.debian.org/debian-security bookworm-security main contrib non-free
# Debian Updates
deb http://deb.debian.org/debian/ bookworm-updates main contrib non-free
deb-src http://deb.debian.org/debian/ bookworm-updates main contrib non-free
One can notice the above configuration follows the major parts of sources.file as explained in the above section.
Step 5: Update the Packages
Now update the Debian’s repository to get the latest software packages and security updates:
# apt update
Step 6: Upgrade the Packages
Now as we can see that there are some packages whose upgrades are available, upgrade them:
# apt upgrade -y
Step 7: Verify the Changes
To verify the changes which are configured, use the command:
# cat /etc/apt/sources.list
Step 8: Exit the Root Terminal
To exit the root terminal, use the “exit” command:
This is all about the configuration of the Debian 12 which should be ensured after installing it.
To configure the sources.list on Debian 12 for ensuring the latest updates of security and software packages, open the sources.list file located at /etc/apt directory. After opening the file, make the changes explained in this blog, after which it will download all the updates released and verified on the official repositories of Debian 12.