How to list repositories on Linux

Knowing which repositories y'all are using can shed calorie-free on how your system manages updates.

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

Repositories contain thousands of programs. Standard repositories provide a high caste of security, since the software included is thoroughly tested and built to exist compatible with a particular distribution and version. So, y'all can expect the updates to occur with no unexpected "side effects."

Repositories may exist standard or non-standard. Once a non-standard repository has been added to your system's list of repositories, the system can install software from it, too equally from the standard ones; otherwise, it cannot. In general, adding a not-standard repository is a simple stride. The sudo apt-add-repository command on Ubuntu, for example, tin can exist used to add a repository. The --help pick 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 not-costless'     apt-add together-repository http://extras.ubuntu.com/ubuntu     apt-add together-repository ppa:user/repository     apt-add-repository ppa:user/distro/repository     apt-add together-repository multiverse              

The apt-add-repository command besides supports removing a repository with use of the -r selection.

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

dnf config-managing director --add together-repo                repository_url              

You should be careful, even so, when adding a non-standard repository to exist certain that it has been tested and is known to work on your item system.

If you're curious nigh which repositories your system is using, you can event a control on the command line to take your Linux system provide that data to you.

RPM-based systems

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

$ sudo dnf repolist Last metadata expiration check: 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 above represents the number of packages in each of the repositories. If you lot add the "all" specification, y'all volition also see disabled (not used) repositories. In the command below, we see that quite a number of other repositories are disabled.

$ sudo dnf repolist all Last metadata expiration check: 0:nineteen:39 ago on Sabbatum 15 Sep 2018 12:28:02 PM EDT. repo id                            repo name                        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: xviii,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 - Exam Update disabled updates-testing-source             Fedora 28 - Test Updates Source  disabled              

Enabling a repository can be done with a control like this:

# dnf config-managing director --set up-enabled repository_url              

You tin can also add repositories fairly hands with commands similar this:

# dnf config-managing director --add together-repo http://world wide web.example.com/example.repo              

Debian-based systems

For Debian systems such as Ubuntu, you could utilize a control like the 1 shown below to list the repositories that are used when you update your system. This command selects sources from the /etc/apt/sources.list file and /etc/apt/sources.list.d directory on the organisation 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://the states.archive.ubuntu.com/ubuntu/ bionic main restricted                /etc/apt/sources.list:deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted                /etc/apt/sources.list:deb http://united states of america.archive.ubuntu.com/ubuntu/ bionic universe                /etc/apt/sources.list:deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates universe                /etc/apt/sources.list:deb http://us.archive.ubuntu.com/ubuntu/ bionic multiverse                /etc/apt/sources.list:deb http://u.s.a..annal.ubuntu.com/ubuntu/ bionic-updates multiverse                /etc/apt/sources.listing:deb http://united states.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse                /etc/apt/sources.listing:deb http://security.ubuntu.com/ubuntu bionic-security master restricted                /etc/apt/sources.list:deb http://security.ubuntu.com/ubuntu bionic-security universe                /etc/apt/sources.list:deb http://security.ubuntu.com/ubuntu bionic-security multiverse                /etc/apt/sources.list.d/teejee2008-ubuntu-ppa-bionic.listing:deb http://ppa.launchpad.internet/teejee2008/ppa/ubuntu bionic principal                              

One thing you might discover when looking at the listing to a higher place is the use of the terms restricted, universe, and multiverse. These terms identify some important distinctions:

  • Primary – officially supported, open up-source software. Canonical provides official support for these packages. Every open-source software parcel included in the default installation is included along with some other important packages.
  • Restricted – officially supported, closed-source software – eastward.g., hardware drivers -- supported for the length of the release.
  • Universe – customs-maintained, open up-source. The bulk of the Ubuntu software comes from this repository. Canonical does non provide official support or updates.
  • Multiverse – unsupported, closed-source and patent-burdened software.

Wrap-up

Standard Linux repositories provide:

  • Reliable locations to become software with confidence, knowing that it's free from malware and properly tested
  • Simple installations without concerns for dependencies (all the required packages are provided)
  • Easy ways to find and download what you need

Knowing which repositories you are using can shed light on how your system manages updates. In general, this is very straighforward. If yous utilise non-standard repositories, it'south probably a good idea to occassionally review your software sources.

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

Copyright © 2018 IDG Communications, Inc.