Enable RPM Fusion Repository on Rocky Linux 9 | Easy Steps

Posted on

Enable RPM Fusion Repository on Rocky Linux 9 | Easy Steps

Enable RPM Fusion Repository on Rocky Linux 9 | Easy Steps

In this tutorial, we will guide you through the process of enabling the RPM Fusion repository on Rocky Linux 9. RPM Fusion is a community-maintained, third-party software repository that provides packages that the Fedora project and Red Hat can’t ship due to legal or other restrictions. It significantly expands the software availability on your Rocky Linux system. This guide provides easy steps to Enable RPM Fusion Repository on Rocky Linux 9.

RPM Fusion offers two main repositories: “free” and “nonfree”. The free repository contains packages that are Open Source, adhering to Fedora licensing guidelines. The nonfree repository includes redistributable packages that are not Open Source and/or packages that are not free for commercial use. You can install both repositories simultaneously without conflicts. If you only want free software, you can install only the free repository and add the nonfree one later if required. This article provides an easy method to Enable RPM Fusion Repository on Rocky Linux 9.

Before proceeding, ensure you have a non-root user with sudo privileges on your Rocky Linux 9 server. If not, refer to a guide on setting up initial server configurations with Rocky Linux 9.

1. Install EPEL Repository on Rocky Linux 9

The Extra Packages for Enterprise Linux (EPEL) repository is often required as a dependency for RPM Fusion.

First, update your local package index:

sudo dnf update -y

Next, install the EPEL repository using one of the following commands:

sudo dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm

Alternatively:

sudo dnf install epel-release -y

2. Add RPM Fusion Repository on Rocky Linux 9

Now, you can add the RPM Fusion repositories.

For the free repository, use the following command:

sudo dnf install --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-$(rpm -E %rhel).noarch.rpm -y

For the non-free repository, use this command:

sudo dnf install --nogpgcheck https://mirrors.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-$(rpm -E %rhel).noarch.rpm -y

Verify the RPM Fusion installation with:

dnf repolist | grep rpmfusion
**Output**
rpmfusion-free-updates        RPM Fusion for EL 9 - Free - Updates
rpmfusion-nonfree-updates     RPM Fusion for EL 9 - Nonfree - Updates

3. List Available Packages in RPM Fusion Repo

You can now list the available packages within the RPM Fusion repositories.

To list free packages, use:

dnf repository-packages rpmfusion-free-updates list

To list non-free packages, use:

dnf repository-packages rpmfusion-nonfree-updates list

Search Packages in RPM Fusion Repo

Listing all packages can be time-consuming. To search for a specific package, for instance, VirtualBox:

dnf repository-packages rpmfusion-free-updates list | grep -i virtualbox
**Output**
VirtualBox.x86_64                                     6.1.40-1.el9                        rpmfusion-free-updates
VirtualBox-devel.x86_64                               6.1.40-1.el9                        rpmfusion-free-updates
VirtualBox-kmodsrc.noarch                             6.1.40-1.el9                        rpmfusion-free-updates
VirtualBox-server.x86_64                              6.1.40-1.el9                        rpmfusion-free-updates
VirtualBox-webservice.x86_64                          6.1.40-1.el9                        rpmfusion-free-updates
akmod-VirtualBox.x86_64                               6.1.40-1.el9                        rpmfusion-free-updates
kmod-VirtualBox.x86_64                                6.1.40-1.el9                        rpmfusion-free-updates
kmod-VirtualBox-5.14.0-70.el9_0.x86_64                6.1.40-1.el9                        rpmfusion-free-updates
python3-VirtualBox.x86_64                             6.1.40-1.el9                        rpmfusion-free-updates

4. Disable RPM Fusion Repo on Rocky Linux 9

If you wish to disable RPM Fusion, use the following commands.

For the free repository:

sudo dnf config-manager --set-disabled rpmfusion-free-updates

For the non-free repository:

sudo dnf config-manager --set-disabled rpmfusion-nonfree-updates

To completely remove the repositories:

Free repository:

sudo dnf remove rpmfusion-free-release

Non-free repository:

sudo dnf remove rpmfusion-nonfree-release

Conclusion

You have now successfully learned how to Enable RPM Fusion Repository on Rocky Linux 9. RPM Fusion provides access to a wider range of software, including multimedia codecs, GPU drivers, and other applications not found in the default Rocky Linux repositories. This guide provides easy steps to Enable RPM Fusion Repository on Rocky Linux 9.

Here are some other articles you might find interesting:

FAQs

What is the difference between “Free” and “Non-Free” repositories in RPM Fusion?

Free: Contains open-source software.
Non-Free: Includes proprietary software like NVIDIA drivers and firmware.

Is RPM Fusion safe to use?

Yes, it’s widely trusted, but always verify package sources before installing.

Alternative Solutions for Adding Software Repositories

While the above method of directly installing the RPM Fusion release packages is straightforward, there are alternative approaches to managing software repositories on Rocky Linux 9. Here are two such alternatives:

1. Using dnf config-manager (After initial RPM installation)

This method builds upon the initially installing the RPM Fusion packages using dnf install, but uses the dnf config-manager to manage the repository after the initial setup. This can be useful for more granular control over repository enabling/disabling and prioritizing different repositories.

Explanation:

After initially installing the RPM Fusion release packages, the dnf config-manager tool can be used to modify the repository configuration files. This allows you to set properties like enabled=1 or enabled=0, change the priority of the repository, or add exclude rules. This method is beneficial if you need to temporarily disable a repository without completely removing it, or if you want to prioritize packages from one repository over another.

Code Example:

First, install the RPM Fusion repositories using the original method (as shown above). Then, use dnf config-manager to view the current repository configuration:

sudo dnf config-manager --dump rpmfusion-free-updates
sudo dnf config-manager --dump rpmfusion-nonfree-updates

This will display the current settings for the repositories. To disable a repository using dnf config-manager:

sudo dnf config-manager --set-disabled rpmfusion-free-updates
sudo dnf config-manager --set-disabled rpmfusion-nonfree-updates

To enable a repository:

sudo dnf config-manager --set-enabled rpmfusion-free-updates
sudo dnf config-manager --set-enabled rpmfusion-nonfree-updates

To change the priority of a repository (lower number means higher priority):

sudo dnf config-manager --setopt=rpmfusion-free-updates.priority=10
sudo dnf config-manager --setopt=rpmfusion-nonfree-updates.priority=11

2. Creating Custom Repo Files Manually

This involves manually creating .repo files in the /etc/yum.repos.d/ directory. While more advanced, this method gives you the most control over repository configuration.

Explanation:

Rocky Linux (and other RPM-based distributions) read repository configurations from .repo files located in the /etc/yum.repos.d/ directory. Each file defines one or more repositories. Manually creating these files allows you to specify all repository parameters directly, including the base URL, enabled status, GPG key, and other options. This method is useful when you need to customize the repository configuration beyond what dnf config-manager can easily provide, or when you need to add a repository that isn’t available through a standard package.

Code Example:

First, you need to determine the base URLs for the RPM Fusion repositories. You can find this information on the RPM Fusion website or by examining the existing .repo files after installing them using the standard method.

Create a file named /etc/yum.repos.d/rpmfusion-free.repo with the following content (modify the baseurl and mirrorlist as needed based on the current RPM Fusion setup):

[rpmfusion-free]
name=RPM Fusion for EL 9 - Free
baseurl=https://mirrors.rpmfusion.org/free/el/9/$basearch/os
#mirrorlist=https://mirrors.rpmfusion.org/mirrorlist?repo=free-el-9&arch=$basearch
enabled=1
metadata_expire=7d
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-free-el-9

[rpmfusion-free-updates]
name=RPM Fusion for EL 9 - Free - Updates
baseurl=https://mirrors.rpmfusion.org/free/el/updates/9/$basearch
#mirrorlist=https://mirrors.rpmfusion.org/mirrorlist?repo=free-el-updates-9&arch=$basearch
enabled=1
metadata_expire=7d
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-free-el-9

Create a similar file for the non-free repository named /etc/yum.repos.d/rpmfusion-nonfree.repo:

[rpmfusion-nonfree]
name=RPM Fusion for EL 9 - Nonfree
baseurl=https://mirrors.rpmfusion.org/nonfree/el/9/$basearch/os
#mirrorlist=https://mirrors.rpmfusion.org/mirrorlist?repo=nonfree-el-9&arch=$basearch
enabled=1
metadata_expire=7d
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-nonfree-el-9

[rpmfusion-nonfree-updates]
name=RPM Fusion for EL 9 - Nonfree - Updates
baseurl=https://mirrors.rpmfusion.org/nonfree/el/updates/9/$basearch
#mirrorlist=https://mirrors.rpmfusion.org/mirrorlist?repo=nonfree-el-updates-9&arch=$basearch
enabled=1
metadata_expire=7d
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-nonfree-el-9

Important Notes:

  • Replace $basearch with the correct architecture (e.g., x86_64) if needed. It’s usually better to leave it as $basearch so the repo file works on different architectures.
  • The gpgkey path should point to the correct GPG key file. You might need to import the RPM Fusion GPG keys manually if you choose this method. See the RPM Fusion documentation for how to obtain and import these keys.
  • Double-check the URLs and paths to ensure they are correct. Incorrect URLs will prevent dnf from accessing the repository.

After creating these files, run sudo dnf makecache to rebuild the DNF cache. Then, you can use the dnf command to install packages from the RPM Fusion repositories.

These alternative methods provide more flexibility in managing software repositories on Rocky Linux 9. Choose the method that best suits your needs and technical expertise. This tutorial provided easy steps to Enable RPM Fusion Repository on Rocky Linux 9.