When we want to expand the capabilities of our operating system, we have the option of add repositories in debian in order to have updated software, or which is not originally in its large software store available.
In this opportunity, we will see three ways to add repositories in Debian safely, without destabilizing the system. The latter deserves our attention. Remember that repositories are often created by people outside the Debian community. And it is in these cases that we have to take some time to find out whether the person providing this repository is trustworthy or not.
If we are sure of the repository we are going to add, we can start looking at the first method for add repositories in debian:
Editing the source.list
For those of us who are used to using the terminal, it may be easier for us to open the file containing the sources of the repositories and add the ones we need there.
To do this, we open the terminal and type the following:
sudo gedit /etc/apt/sources.list
In the example, we use “sudo” for root permissions. It works if we have “sudo” installed, otherwise we have to use “su”. Another detail is that we edit with “Gedit”, but we can use any other plain text editor, such as “Vi”. With this, the contents of this file will appear: a list of repositories that we have installed in our system.
We are going to be at the end of the sources.list file, and there we are going to add —as an example— the Docker repository in Debian 10:
deb [arch=amd64] https://download.docker.com/linux/debian buster stable
A second way to add repositories in debian from the terminal is by typing a direct command.
Add a deposit from the terminal
To do this, we first need to add support for adding repositories; it is done like this:
sudo apt-get install software-properties-common
After that, we will copy and paste the following command:
sudo add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/debian \ $(lsb_release -cs) \ stable"
In the above command we use add-apt-repository which makes it easy to add the repositories to our software listings.
The third method is to use support with a graphical interface, which we show below.
From the package manager
The way to avoid using Terminal — if you’re not used to it — is to use the GUI program called “Software and Updates”. In this program, we click on the “Other software” tab, then on the “Add…” button.
In the pop-up window, a text box allows us to write the repository we want to add. In order for the process to be completed, we must click on the “Add source” button.
We can do the same process from the Synaptic package manager. If you don’t have it installed on your system, it’s as simple as typing the command:
sudo apt-get install synaptic
Once installed, we open Synaptic and click on the “Settings” menu. We are looking for the “Repositories” submenu and the same window will open that we saw above in “Software and updates”.
We have the possibility add repositories in debian very easily as we have seen. But we must take into account that it is not the best idea to add third-party repositories if we are not sure of their origin. Let’s use the right and necessary ones, and that they come from reliable sources, to protect the safety of our team.
If you have any questions for us, remember that you can communicate through the comments section below.