How to Configure Software Repositories in Fedora

Your Fedora distribution obtains its software from repositories and each of these repositories comes with number of free and proprietary software applications available for you to install. The official Fedora repositories have thousands of free and open source applications.

In this article, we will show how to configure software repositories in Fedora distribution using the DNF package manager tool from the command line.

View Enabled Repositories in Fedora

To list all enabled repositories on your Fedora system, in the format repository ID, name, and status (number of packages it provides), run the following command.

$ sudo dnf repolist
List Enabled Repositories in Fedora

List Enabled Repositories in Fedora

You can list packages from a specified repository, for instance fedora, by running the following command. It will list all packages available and installed from the repository specified.

$ sudo dnf repository-packages fedora list

To display only a list of those packages available or installed from the specified repository, add the available or installed option respectively.

$ sudo dnf repository-packages fedora list available
$ sudo dnf repository-packages fedora list installed

Adding, Enabling, and Disabling a DNF Repository

Before you add a new repository to your Fedora system, you need to define it by either adding a [repository] section to the /etc/dnf/dnf.conf file, or to a .repo file in the /etc/yum.repos.d/ directory. Most developers or package maintainers provide DNF repositories with their own .repo file.

For example to define the repository for Grafana in a .repo file, create it as shown.

$ sudo vim /etc/yum.repos.d/grafana.repo

Then add the [repository] section in the file and save it. If you observe carefully, in the repository configuration shown in the image, it is not enabled as indicated by the parameter (enabled=0); we changed this for demonstration purposes.

Add New DNF Repository in Fedora

Add New DNF Repository in Fedora

Next, to add and enable new repository, run the following command.

$ sudo dnf config-manager --add-repo /etc/yum.repos.d/grafana.repo
Add and Enable DNF Repo

Add and Enable DNF Repo

To enable or disable a DNF repository, for instance while trying to install a package from it, use the --enablerepo or --disablerepo option.

$ sudo dnf --enablerepo=grafana install grafana  
$ sudo dnf --disablerepo=fedora-extras install grafana  
Install Package from Enabled Repository

Install Package from Enabled Repository

You can also enable or disable more than one repositories with a single command.

$ sudo dnf --enablerepo=grafana, repo2, repo3 install grafana package2 package3 
$ sudo dnf --disablerepo=fedora, fedora-extras, remi install grafana 

You can also enable and disable repositories at the same time, for example.

$ sudo dnf --enablerepo=grafana --disablerepo=fedora, fedora_extra, remi, elrepo install grafana

To permanently enable a particular repository, use the --set-enabled option.

$ sudo grep enable /etc/yum.repos.d/grafana.repo
$ sudo dnf config-manager --set-enabled grafana
$ sudo grep enable /etc/yum.repos.d/grafana.repo
Permanently Enable DNF Repo

Permanently Enable DNF Repo

To permanently disable a particular repository, use the --set-disabled switch.

$ sudo dnf config-manager --set-disabled grafana

That’s all for now! In this article, we have explained how to configure software repositories in Fedora. Share your comments or ask questions via the feedback form below.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

Aaron Kili

Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide
The Complete Linux System Administrator Bundle
Become an Ethical Hacker Bonus Bundle

You may also like...

2 Responses

  1. bluebat says:

    RPM Sphere: Collection of extra packages for Fedora Linux. Feel free to promote them in any form.

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.