Configure software repositories in Fedora

Your Fedora system gets its software from repositories, or repos. Each of these repos can have any number of software apps available for you to install and use. The official Fedora repos contain thousands of free and open source apps. Some repos may have free or proprietary apps. Some only contain one. You may want to configure software repositories at certain times.

Fortunately, this is easy in Fedora. For instance, you may want to get a package to test and see if it fixes a bug. In that case, you’d want to turn on Fedora’s testing repo. You might want to leave it on to get more packages for testing. Or you might want to turn it off, to stop participating.

Configuring with the command line

To configure repos at the command line, use the dnf command. To see a list of all enabled repos, use this command:

sudo dnf repolist

You can use command options to change configuration for just one command. To enable or disable a repo just once, use a command option:

sudo dnf --enablerepo=<reponame>...
sudo dnf --disablerepo=<reponame>...

Follow the option with the actual dnf command. For instance, to install the latest kernel from Fedora’s test repo:

sudo dnf --enablerepo=updates-testing install kernel\*

You can combine several enable and disable options together. For example:

sudo dnf --enablerepo=repo1 --disablerepo=repo2,repo3 install <package>

If you want to change the defaults permanently, use these commands:

sudo dnf config-manager --set-enabled <reponame>
sudo dnf config-manager --set-disabled <reponame>

Backing out confusion

Perhaps you install, update, or remove a lot of software using different setups. In this case, things may get confusing. You might not know which software is installed from what repos. If that happens, try this.

First, disable extra repos such as those ending in –testing. Ideally, enable only fedora and updates repos. Run this command for each unwanted repo:

sudo dnf config-manager --set-disabled <unwanted-repo>

Then run this command to synchronize your system with just stable, updated packages:

sudo dnf distro-sync

This ensures your Fedora system is only using the latest packages from specific repos.

For lots more detail on repositories, visit the Fedora documentation pages.

For System Administrators Using Software

8 Comments

  1. Matt

    What is the correct way to upgrade third-party repositories when upgrading to new Fedora releases? Let’s say I install ffmpeg from the Fedora 24 RPMFusion repository. When I want to upgrade to Fedora 25, I disable the Fedora 24 RPMFusion repo and go ahead with the upgrade. After the upgrade, I install the Fedora 25 RPMFusion repo, leaving the previous repo disabled. Will ffmpeg continue to get updates from the new repo I installed?

    • Actually, assuming the rpmfusion repo is ready at F25 release, you can simply upgrade without turning it off. But if it’s not, that’s when things get more complicated.

  2. Thanks. I did not know how to manage repos in Fedora before reading this. Great article.

  3. Suman Bandyopadhyaya

    I have tried to install avro keyboard for bangla language, doing this I have downloaded- ‘/etc/yum.repos.d/home:sarimkhan.repo’,
    Now when I am giving the command –
    sudo dnf config-manager –set-disabled
    It is giving following message-

    Warning: failed loading ‘/etc/yum.repos.d/home:sarimkhan.repo’, skipping.
    Failed to synchronize cache for repo ‘google-chrome’, disabling.
    Last metadata expiration check: 2:23:38 ago on Sat Nov 12 07:16:48 2016.
    repo id repo name status
    *fedora Fedora 24 – i386 42,022
    rpmfusion-free RPM Fusion for Fedora 24 – Free 264
    rpmfusion-free-updates RPM Fusion for Fedora 24 – Free – Updates 285
    *updates Fedora 24 – i386 – Updates 9,768

    Now how to remove sarimkhan.repo

  4. If my software repository doesn’t contain software I require than how to search and add that package into my current repo ?

    • Matthew Bunt

      You’ll want to find a repository (using internet searches, duckduckgo, google etc) that does contain the software you are looking for and then add that repo using the techniques described above. If you cannot locate such a repository, you can also install .rpm packages individually but if you use that method you will have to update them manually by downloading the .rpm again when a new version is available. You may also want to have a look at copr, there are many user created repos for lots of different software. However, beware that copr, while it is part of the Fedora project, it does not have the same quality assurance that the rest of Fedora packages have.

  5. Leslie Satenstein

    To permenantly remove the saramkhan repo,

    sudo su
    cd /etc/yum.repos.d
    rm sarimkhan.repo
    exit

  6. samwel

    good info

Comments are Closed

The opinions expressed on this website are those of each author, not of the author's employer or of Red Hat. Fedora Magazine aspires to publish all content under a Creative Commons license but may not be able to do so in all cases. You are responsible for ensuring that you have the necessary permission to reuse any work on this site. The Fedora logo is a trademark of Red Hat, Inc. Terms and Conditions