18.09.2023

How to manage Debian repositories?

Introduction

In the Debian we have various way to update and download software to our system, that can be single archive with set of dependencies, index and etc. Usually that have format tar.gz or .deb, there are files with open-source code which need compile before using.

But some utilities, packets and software may be have snippet of malicious code, unstable or untrusted. For solve that purposes we have repositories with trusted, verified and stable packets, that we can install and using easily. They represent pack of hierarchy of packets, index, libraries needed for installation and sign for more secure usage.

Highlight!There are some repositories from non-official source, that you can use for at your own risk.

Requirements

Manage repositories

For the manage repositories we can use files for configuring our system, for that let's find catalog with label apt and check content:

cd /etc/apt/ && ls -l

Screenshot №1 — List of files

At the screenshot we can see bunch of different files and directories, that we can use for configuring our repositories. Let's consider all files in the catalog and give them explanation:

Consider the file sources.list and add line with repository:

nano /etc/apt/sources.list
deb http://security.debian.org/debian-security bullseye-security main

Screenshot №2 — Repositories list

After that we can update index by the command below:

apt update

Then we can use repository by apt, aptitude and etc command for controlling package in our local machine.

However, we can configuring system separated by the services:

cd /etc/apt/sources.list.d/ && ls

Screenshot №3 — Directory of repo

Go to text editor and consider the file, in your system may be there isn't needed file and you can create this.

For an existing file we just open it, for empty catalog, we create with .list:

nano mysql.list

Screenshot №4 — Repo list of MySQL

In that line we can indicate signed-file for repo, link and version of using servers, usually we need to add .gpg file into the system. In the moment of update index package our machine verified public key of our repo and then update all information. That mechanism of electronic signature help to save integrity and verify author of data. We can add key by the command, where key.asc will your public key:

gpg --import key.asc

Screenshot №5 — List of public keys

And now we can use repository for update and installation software, executing the command below:

apt update

Screenshot №6 — Update

We are installing software to check that repository work:

apt install dnsutils

Screenshot №7 — Installation

Conclusion

This guide provides a comprehensive understanding of repositories and their components, enabling users to effectively manage software sources on their Debian-based systems.