A software repository is a database of software packages stored on a remote server. Generally, these packages are retrieved using a package manager in the local machine.
Linux comes preconfigured with some repositories that allow us to download and install the updates or packages officially released by that distribution. Sometimes you may need to download packages from a different source.
In this case, first, you will have to add that repository and then you can download or install the software. You can see how to add a repository in Linux. Ahead in this article, we will discuss to list the enabled or active repositories in a system.
Enabling a repository in Ubuntu
The package manager in Ubuntu and its derivatives gets the information of repositories from
/etc/apt/sources.list or files listed in
/etc/apt/sources.list.d. Enabling a repository means apt can download the packages from it. Now if you open the
sources.list file in a text editor it will look something like this-
#(hash symbol) at the beginning of the given software source means currently it is disabled. So if you want to enable it just remove that
# sign and save this file.
Now if you look into the
/etc/apt/sources.list.d directory you may find some other files. Execute the following command to list the files in this directory –
In Linux Mint, the official repositories are mentioned in the
official-package-repositories.list. Look at the image below, It shows the content of this file –
Now if you want to know how to enable repositories in RPM-based distributions such as RHEL, CentOS or Fedora then you can read this.
List the enabled repositories in Debian, Ubuntu and Linux Mint
A debian based system uses
apt-get package manager. We can use this to list the enabled repositories in distributions such as Ubuntu, Linux Mint, etc. Now to list it just open your terminal by pressing ctrl+alt+t and then enter the following command –
When you use this command without any argument. It displays the priority of each source or repositories.
List the enabled repositories in CentOS, RHEL, Fedora
RPM-based distributions such as CentOS, RHEL, etc use yum(yellow dog updater modified) package manager. So, Yum is the tool used for installing, updating, and removing RPM packages. Execute the below command to display the list of enabled repositories –
In RHEL and CentOS –
yum repolist enabled
In Fedora –
Fedora Linux uses dnf(Dandified yum) which is a fork of yum package manager. From Fedora version 22 dnf is the default package manager. To display the list of enabled repositories use –
dnf repolist enabled
That’s all for now. In this article, you have learned to enable the repositories and listing them in the terminal. If you have any questions related to this topic then write to us in the comments below.