How to list repositories on Linux

Knowing which repositories yous are using can shed light on how your organisation manages updates.

A Linux repository is a storage location from which your system retrieves and installs Os updates and applications. Each repository is a collection of software hosted on a remote server and intended to be used for installing and updating software packages on Linux systems. When y'all run commands such as "sudo apt update" or "sudo apt upgrade", you may be pulling package information and package updates from a number of repositories.

Repositories incorporate thousands of programs. Standard repositories provide a high degree of security, since the software included is thoroughly tested and built to be compatible with a particular distribution and version. Then, you lot can expect the updates to occur with no unexpected "side effects."

Repositories may be standard or non-standard. One time a non-standard repository has been added to your system'south list of repositories, the system tin can install software from it, also as from the standard ones; otherwise, it cannot. In full general, adding a non-standard repository is a simple stride. The sudo apt-add-repository command on Ubuntu, for instance, tin can be used to add a repository. The --help option for the apt-add-repository command shows these command examples:

                apt-add-repository 'deb http://myserver/path/to/repo stable myrepo'     apt-add-repository 'http://myserver/path/to/repo myrepo'     apt-add-repository 'https://packages.medibuntu.org free non-costless'     apt-add-repository http://extras.ubuntu.com/ubuntu     apt-add-repository ppa:user/repository     apt-add-repository ppa:user/distro/repository     apt-add together-repository multiverse              

The apt-add together-repository command likewise supports removing a repository with use of the -r option.

On Fedora, the command for adding a repository looks like this:

dnf config-manager --add-repo                repository_url              

You should be careful, nonetheless, when adding a non-standard repository to be sure that it has been tested and is known to work on your detail organisation.

If you're curious nigh which repositories your system is using, you can issue a command on the command line to accept your Linux system provide that information to you.

RPM-based systems

On RedHat, Fedora and similar systems, y'all would utilize a command like the ane shown below to view the repositories that your update commands utilise. Note that we're using the dnf control in this example. This is the replacement for the older yum command.

$ sudo dnf repolist Concluding metadata expiration cheque: 0:18:37 ago on Sat 15 Sep 2018 12:28:02 PM EDT. repo id        repo name                            condition *fedora        Fedora 28 - x86_64                   57,327 *updates       Fedora 28 - x86_64 - Updates         18,739              

The status field in the output higher up represents the number of packages in each of the repositories. If you add together the "all" specification, you will also see disabled (not used) repositories. In the command below, we encounter that quite a number of other repositories are disabled.

$ sudo dnf repolist all Last metadata expiration check: 0:nineteen:39 ago on Sat xv Sep 2018 12:28:02 PM EDT. repo id                            repo proper noun                        status *fedora                            Fedora 28 - x86_64               enabled: 57,327 fedora-cisco-openh264              Fedora 28 openh264 (From Cisco)  disabled fedora-cisco-openh264-debuginfo    Fedora 28 openh264 (From Cisco)  disabled fedora-debuginfo                   Fedora 28 - x86_64 - Debug       disabled fedora-source                      Fedora 28 - Source               disabled *updates                           Fedora 28 - x86_64 - Updates     enabled: 18,739 updates-debuginfo                  Fedora 28 - x86_64 - Updates - D disabled updates-source                     Fedora 28 - Updates Source       disabled updates-testing                    Fedora 28 - x86_64 - Test Update disabled updates-testing-debuginfo          Fedora 28 - x86_64 - Examination Update disabled updates-testing-source             Fedora 28 - Test Updates Source  disabled              

Enabling a repository tin can exist done with a command like this:

# dnf config-manager --set-enabled repository_url              

Y'all can also add repositories fairly easily with commands like this:

# dnf config-managing director --add together-repo http://www.example.com/case.repo              

Debian-based systems

For Debian systems such as Ubuntu, yous could use a control like the one shown beneath to listing the repositories that are used when you update your system. This control selects sources from the /etc/apt/sources.listing file and /etc/apt/sources.list.d directory on the organization where this information is maintained. The ^[^#] argument is suppressing the comments.

$ grep ^[^#] /etc/apt/sources.list /etc/apt/sources.list.d/* /etc/apt/sources.list:deb http://us.archive.ubuntu.com/ubuntu/ bionic main restricted                /etc/apt/sources.list:deb http://united states.archive.ubuntu.com/ubuntu/ bionic-updates main restricted                /etc/apt/sources.list:deb http://u.s..archive.ubuntu.com/ubuntu/ bionic universe                /etc/apt/sources.listing:deb http://us.annal.ubuntu.com/ubuntu/ bionic-updates universe                /etc/apt/sources.list:deb http://usa.annal.ubuntu.com/ubuntu/ bionic multiverse                /etc/apt/sources.listing:deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates multiverse                /etc/apt/sources.list:deb http://united states of america.annal.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse                /etc/apt/sources.list:deb http://security.ubuntu.com/ubuntu bionic-security chief restricted                /etc/apt/sources.list:deb http://security.ubuntu.com/ubuntu bionic-security universe                /etc/apt/sources.listing:deb http://security.ubuntu.com/ubuntu bionic-security multiverse                /etc/apt/sources.list.d/teejee2008-ubuntu-ppa-bionic.list:deb http://ppa.launchpad.net/teejee2008/ppa/ubuntu bionic master                              

One thing you might detect when looking at the listing above is the use of the terms restricted, universe, and multiverse. These terms identify some of import distinctions:

  • Main – officially supported, open-source software. Approved provides official support for these packages. Every open-source software package included in the default installation is included along with another of import packages.
  • Restricted – officially supported, closed-source software – e.grand., hardware drivers -- supported for the length of the release.
  • Universe – community-maintained, open up-source. The majority of the Ubuntu software comes from this repository. Canonical does not provide official support or updates.
  • Multiverse – unsupported, airtight-source and patent-encumbered software.

Wrap-upwards

Standard Linux repositories provide:

  • Reliable locations to go software with confidence, knowing that it'south costless from malware and properly tested
  • Uncomplicated installations without concerns for dependencies (all the required packages are provided)
  • Like shooting fish in a barrel ways to discover and download what you need

Knowing which repositories you are using can shed light on how your system manages updates. In full general, this is very straighforward. If you apply non-standard repositories, information technology's probably a expert idea to occassionally review your software sources.

Join the Network World communities on Facebook and LinkedIn to comment on topics that are top of mind.

Copyright © 2018 IDG Communications, Inc.