Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 24

Managing DNF Repositories and Installing Packages

Recommended resources

Introduction

Welcome to the next lesson in our journey through Fedora's package management. In our last session, you learned how to list and manage the software repositories that are configured on your system by default. We saw that you can enable or disable these "software warehouses" to control what dnf has access to.

This raises an important question: What do you do when the software you need isn't in any of Fedora's official repositories? This is a common scenario, especially for web developers and users who need multimedia codecs or proprietary drivers. Fedora's commitment to only shipping free and open-source software means some very common applications are left out due to licensing or patent restrictions.

Today, you will learn how to solve this by adding a trusted third-party repository. Specifically, we will focus on adding the RPM Fusion repository and installing packages from it. This is one of the most common and essential "first steps" for any new Fedora user and a critical skill for a system administrator.


Why Do We Need Third-Party Repositories?

Fedora maintains a strict policy about the software it includes in its official repositories. If a piece of software is proprietary (closed-source) or is encumbered by software patents (like many common audio and video codecs), it cannot be included.

This is where third-party repositories come in. They are maintained by community members or other organizations and provide packages that aren't available in the official Fedora repos. RPM Fusion is the most well-known and trusted third-party repository for Fedora users.

RPM Fusion itself is split into two parts:

  • Free: Contains open-source software that Fedora, for various legal or policy reasons (primarily patent concerns in the US), does not ship.
  • Non-Free: Contains proprietary but redistributable software, such as graphics card drivers or certain applications like Steam.

The following article gives a great overview of what RPM Fusion is and why it's necessary.

Add Third-Party RPM Fusion Repositories in Fedora to Get Access to a Huge Number of Additional Software

To understand the role of RPM Fusion, please read the introductory part of this article from It's FOSS.

Read from the beginning down to the start of 'Part 1: Enabling RPM Fusion Repositories in Fedora'. Focus on the explanation of why some software isn't available by default and the description of the 'free' and 'non-free' RPM Fusion repositories.


Adding the RPM Fusion Repository

Now for the practical part. How do we add these new repositories to our system? You might think it's a complicated process, but it's surprisingly simple. We'll use dnf to install a special .rpm package directly from the RPM Fusion website. This package doesn't contain a program; instead, it contains the repository configuration files (.repo files) and the GPG keys needed to securely verify packages from that repo.

The Fedora 43 Post-Install Guide provides a single, efficient command to enable both the free and non-free repositories at once.

Fedora 43 Post-Install Guide: 10 Essential Things to Do After Installing

This guide provides a clean, one-line command for setting up RPM Fusion. It's a perfect example of an efficient administrative command.

Focus only on the command under the heading '2. Enable RPM Fusion Repositories'. We will be running this command in the next step.

Let's break down the command before you run it:

sudo dnf install \
https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm \
https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
  • sudo dnf install ...: We are simply using the dnf install command you're already familiar with.
  • https://...: Instead of a package name, we're providing direct URLs to the .rpm packages we want to install.
  • $(rpm -E %fedora): This is a clever bit of shell scripting. This expression is evaluated by your terminal before dnf runs. It automatically inserts your current Fedora version number (e.g., '40' or '41'). This makes the command portable across different Fedora releases without needing to be edited.

Your Turn: Add and Verify RPM Fusion

It's time to expand your system's software library.

  1. Open your terminal and run the command above to install the RPM Fusion repository configuration packages. You will be prompted for your password.
  2. dnf will show you what it's about to install and ask for confirmation. Press y and Enter.
Installing RPM Fusion Repositories on Fedora via DNF
This is what the terminal output should look like when you install the RPM Fusion repository packages.
  1. Verify the installation. In the last lesson, you used dnf repolist. Run it now.
    dnf repolist
    
    In the output, you should now see new entries for RPM Fusion, such as rpmfusion-free, rpmfusion-free-updates, rpmfusion-nonfree, and rpmfusion-nonfree-updates. This confirms that dnf is now aware of these new software sources.

Installing Packages from RPM Fusion

Now that you've added the repositories, you can install packages from them just like you would from the official Fedora repos. dnf automatically searches all enabled repositories.

A very common use case for RPM Fusion is to install multimedia software. Let's install the popular VLC media player, which isn't in the Fedora repos due to patent issues with the codecs it supports.

  1. Search for VLC (optional but good practice):

    dnf search vlc
    

    You will see the vlc package in the search results.

  2. Install VLC:

    sudo dnf install vlc
    

    Notice that you didn't have to specify where to get it from. dnf finds it in the newly added RPM Fusion repository and handles all the dependencies for you.

Swapping Packages for Better Functionality

Sometimes, a third-party repository provides a more complete version of a package that is already included in Fedora's official repos. A prime example is ffmpeg, a core multimedia framework. Fedora ships a version called ffmpeg-free that has patented codecs removed. RPM Fusion provides the full ffmpeg package.

To get the full version, we need to swap the limited one with the complete one. The video below shows this process in detail.

Fedora 41 how to install video codecs - RPM Fusion tutorial - November 2024 - 62ee0c6b

This video clip from nmariusp demonstrates exactly why and how to replace Fedora's limited ffmpeg-free with the full version from RPM Fusion. Pay close attention to the use of the --allowerasing flag.

Watch the segment from 12:12 to 15:30. The presenter explains the package conflict and uses dnf install --allowerasing to resolve it by swapping the packages.

As you saw in the video, dnf is protective and won't remove an installed package to resolve a conflict unless you explicitly permit it.


Your Turn: The Multimedia Upgrade

Let's perform this common system upgrade task.

  1. Swap ffmpeg-free for the full ffmpeg: Run the following command. The --allowerasing flag tells dnf that it's okay to remove the conflicting ffmpeg-free package to complete this installation.

    sudo dnf swap ffmpeg-free ffmpeg --allowerasing
    

    This command is a more modern alias for what was shown in the video. dnf swap is the officially recommended way to perform this kind of replacement.

  2. Install the full multimedia group: To ensure all video players and applications can use the new codecs, it's a good idea to install the related codec groups from RPM Fusion.

    sudo dnf group upgrade --with-optional multimedia
    

    This single command installs a curated set of packages for sound and video playback, pulling them from the RPM Fusion repos you just added.

By completing these steps, you've not only learned how to add a repository but also solved a very practical problem on a fresh Fedora installation.


A Note on Other Repositories

RPM Fusion is the main third-party repository, but it's not the only one. For example, some individual developers or projects use Copr (Cool Other Package Repositories) to distribute their software. While the process of adding them is similar (sudo dnf copr enable ...), it's important to be more cautious. Copr repos are not officially vetted by Fedora and may not have the same level of stability or security as the official repos or RPM Fusion. As a system administrator, always consider the source of your software.

Enabling a Copr Repository on Fedora
An example of adding a Copr repository. Note the disclaimer text, which warns that the repository is not supported by Fedora and advises caution.

Conclusion

Great job! You have significantly expanded the capabilities of your Fedora system. You now have the skills to tap into the vast ecosystem of software that exists beyond the official repositories.

Key Takeaways:

  • Fedora's official repositories are limited to free and open-source software, excluding proprietary or patent-encumbered packages.
  • RPM Fusion is the primary, trusted third-party repository for Fedora, providing access to this wider range of software.
  • You add a repository by installing a special .rpm package that contains its configuration files.
  • The command sudo dnf install <URL-to-repo.rpm> is the standard way to add a repository like RPM Fusion.
  • Once a repository is enabled, dnf automatically uses it for searching and installing packages.
  • You can use dnf swap with the --allowerasing flag to replace a default package with a more feature-complete version from a third-party repo.

You've now performed several important package management operations: installing, removing, updating, and now adding a new source. What happens if one of these operations causes a problem? In our next lesson, we will dive into dnf's transaction history. You'll learn how to review every change you've made and, crucially, how to undo or roll back a transaction if needed.