Skip to content

Linux Repository Management

Regardless of the distribution you use, it may be necessary to install a new software repository to install a particular package that is not part of the distribution’s software repository.

When this happens, the software manufacturer usually provides the URL of their repository to different distributions, in order for it to be installed. The correct URL must be chosen according to the Linux distribution used.

Repositories on Debian/Ubuntu

The suite of Software installation tools in Debian-based distributions uses the software repositories listed in the /etc/apt/sources.list file and also in the /etc/apt/sources.list.d directory.

By default, each Linux distribution maintains its software repository, indicating in this file where Linux should search for the packages that the distribution maintains.

That said, it’s entirely possible to add other third-party software repositories, or even change the default repository to a software repository in “beta” testing.

On Ubuntu, the sources.list file has the following content:

$ cat sources.list | grep -v “#” deb http://security.ubuntu.com/ubuntu eoan-security main restricted deb http://security.ubuntu.com/ubuntu eoan-security universe deb http://security.ubuntu.com/ubuntu eoan-security multiverse

The first word “deb” indicates that they are binary software packages, and the word “deb-src” indicates that they are source code packages.

Then, the full URL of the repository must be indicated, indicating the access protocol: http, https or ftp.

Then the name of the distribution follows. In the case of Debian, this could be the name of the version code (jessie, stretch, buster, sid) or the version class (oldstable, stable, testing, unstable) respectively.

Finally, the component is indicated, which determine the type of software:

  • MAIN: Contains all packages that are completely in accordance with the Debian Free Software Guilines.
  • CONTRIBURIB: It is a set of open source programs that cannot work without a non-free element.
  • NON-FREE: Contains programs that do not (completely) comply with these Free Software principles, but which can, however, be distributed without restrictions.
  • UPDATES: This repository receives package updates, with fixes and improvements.
  • BACKPORTS: The backports repository offers “backports packages”. The term refers to a recent software package that was recompiled for an older distribution, generally for Stable.
  • SECURITY: Security updates are not hosted on the usual Debian mirror network, but on security.debian.org.
  • PROPOSED-UPDATES: once published, the stable distribution is updated approximately every two months. The proposed updates repository is where the expected updates are prepared (under the supervision of stable version managers).
  • DEBIAN MULTIMEDIA: Provides packages for the purpose of editing video, image and codecs, among others.

This list of components may vary depending on the Linux distribution.

Adding a repository

To add a repository, simply include a line with the following syntax in the sources.list file:

deb https://servidor/caminho component distribution

After configuring a repository in the sources.list file, it is necessary to execute one of the commands from the apt tool suite of your choice, in order for the list of packages from the repository to be downloaded and the repository incorporated into the system:

$ apt-get update

Or

$ aptitude update

Or

$ apt update

The same command must be executed if a repository is removed from the system.

Repositories on Red Hat/CentOS (Yum)

YUM also allows software repositories to be customized in the yum.conf configuration file.

/etc/yum.conf example

[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=5
distroverpkg=centos-release

[fedora-us-3-core] name=Fedora Core 3 — Fedora US mirror baseurl= http://SERVERNAME/fedora/fedora/$releasever/$basearch/RPMS.os

[fedora-us-3-updates] name=Fedora Core 3 Updates — Fedora US mirror baseurl= http://SERVERNAME/fedora/fedora/$releasever/$basearch/RPMS.updates

In addition to the /etc/yum.conf configuration file, YUM allows you to place repository configuration files in the /etc/yum.pos.d/ directory. This directory contains the settings for each repository.

The files in this directory have the extension “.repo”.

$ ls -l /etc/yum.pos.d/
-rw-r--r--. 1 root root 1664 Aug 13 2018 Centos-Base.repo
-rw-r--r--. 1 root root 630 Aug 13 2018 Centos-Media.repo

You can add extra repositories or “beta-test” software repositories to the YUM repository list.

A repository file usually has a name and points to an Internet URL. See the Centos-Base.repo file:

[base]
name=Centos-$ReleasEver - Basic
mirrorlist= http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl = http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file: ///etc/pki/rpm-gpg/rpm-gpg-key-centos-7

Once a new repository is added to Yum, the updateinfo command updates the packages available in the repositories:

$ yum updateinfo <br></br>Plugins loaded: extras_suggestions, langpacks, priorities, update-motd <br></br>amzn2-core/2/aarch64 & nbsp; | 2.4 kB 00:00:00 <br></br>amzn2extra-docker/2/aarch64 & nbsp; | 1.8 kB 00:00:00 <br></br>amzn2extra-php7.3/2/aarch64 ; 1.8 kB 00:00:00

Updates Information Summary: updates
updateinfo summary done Conclusion

The installation of third-party packages can be done through repository management on Linux.

Learn much more about Linux in our online course. You can register here. If you already have an account, or want to create one, just log in or create your user here.

Did you like it?

Share