FUNDAMENTALS A Complete Guide for Beginners
DNF (Dandified YUM) is the latest package manager tailored for Red Hat-based Linux/Unix operating systems like RHEL, Fedora, CentOS, etc. It provides many advanced features compared to its predecessor RPM(Red Hat Package Manager) and YUM (Yellowdog Updater Modified). Installing a package is a very important part of package management. Depending on your need you need to use different commands and options for installing app packages. In this article, I will demonstrate many cases with examples using the dnf package manager to install rpm packages in Red Hat-based Linux distributions.
[Distro Used Throughout the Tutorial: RHEL 9.2]
4 Cases of Installing RPM Packages Using DNF
In the world of Linux, mastering the art of package management is a crucial skill for any enthusiast or professional. When it comes to Red Hat-based systems DNF emerges as a powerful ally for handling RPM packages.
Whether you’re looking to install a single package, or multiple packages at once, install packages from a specific repository, or install a particular version of a package, I have got you covered. In this article, I will explore all these cases of installing RPM packages on your Linux system.
Case 1: Install an RPM Package Using DNF
If you want to install an individual rpm app package in Red Hat-based distributions, using the dnf package manager you will be able to do that effortlessly by following these simple steps:
-
First, open your terminal and run the following command to search for the app package you want to install:
sudo dnf search audacity
EXPLANATION- sudo: Permits administrative permission.
- dnf: Package manager in Red Hat-based distributions.
- search: Search for the app package in the remote repository using dnf.
- audacity: Name of the package I want to install.
If you’re prompted for the sudo user’s password, provide it. Following that, your terminal will display outcomes similar to the image shown above. If the specific app package you are looking for is not visible in the list, you can follow the guidance provided in the article titled How to Install Local Package Using DNF
-
Now, To install your desired rpm package, execute the following command :
sudo dnf install audacity
EXPLANATION- install: Install an app package from the remote repository using dnf.
-
Following that, press “Y” to confirm the installation as shown in the image above. Then your desired app package will be downloaded and installed automatically afterward.
Once the installation is finished, you will receive a confirmation message resembling the above image.
Case 2: Install Multiple RPM Packages Using DNF
Installing multiple RPM app packages at once can significantly streamline the process of setting up your Linux system. Rather than installing each package individually, you can use a single command to install them all simultaneously. Here is a step-by-step process on how you can install multiple app packages using the dnf command:
-
First you need to check whether the packages are available in the remote repository or not. To do so you can run the following commands:
sudo dnf search audacity
sudo dnf search totem
sudo dnf search gimp
EXPLANATION- audacity totem gimp: Name of the app packages I want to install.
-
Now, execute the following command as shown in the following image to install multiple packages simultaneously:
sudo dnf install audacity totem gimp
-
After running the command, dnf will check the package repositories, resolve dependencies, and prompt you to confirm the installation. Type “Y” and press ENTER to proceed.
Once the installation is complete, you will see a confirmation message indicating a successful installation.
Case 3: Install Specific Version of a Package Using DNF
In the world of Linux package management, precision is the key. There are scenarios where you need a specific version of a package. It can be because of compatibility issues or some particular feature available on that version. The following section of this article will give you a step-by-step process of using dnf package manager to install a specific rpm package version:
-
First, open the Terminal on your system.
-
Now, type the following command to check all available versions of the app package in the remote repositories:
dnf --showduplicate list php
EXPLANATION- showduplicate: Display duplicates (other versions) of the package in the output.
- list: This option can show all available and installed packages in your system.
- php: Name of the app package I want to install.
-
After that, hit ENTER. All available versions of the app package from the remote repositories will be shown in the terminal. Now, review the list of available versions, and identify the version you want to install. It will look similar to the above image.
-
Now, to install a specific version from the list from the remote repositories, run the following command:
sudo dnf install php-8.0.20-3.el9.x86_64
EXPLANATION- php-8.0.20-3.el9.x86_64: Specific version of the app I want to install.
Upon execution of the command, the system will prompt you to enter your sudo user password as shown in the image above. Provide your sudo password. Your specified version of the app package will be shown then with all necessary dependencies.
-
After that, press “Y” to confirm the installation as shown in the above image.
-
Then, your app package with all of its dependencies will be downloaded and installed automatically like the image below:
Finally, the installation of the specific version of the specific app package will be completed in your system.
Case 4: Install App Package from a Specific Repository Using DNF
Red Hat-based Linux distributions often maintain multiple repositories as some repositories contain some packages that are exclusive to them. Sometimes you may have a specific repository in mind from which you want to install an app package. It may be due to the specific repository having the cutting-edge version of a package that is not present in other repositories. You can easily do that in a Red Hat-based distribution using the dnf package manager. Follow the steps described below to do so:
-
First, open your terminal and run the following command to search for the app package you want to install:
sudo dnf --enablerepo=epel install audacity
EXPLANATION- enablerepo: Enable a specific repository while executing this command.
- epel: Specific repository I want to use.
- audacity: Name of the package I want to install.
Note: You need to have the specific remote repository you want to use installed beforehand. To add the epel remote repository in your Red Hat-based distro run this command:sudo dnf install https://dl.fedoraproject.org/pub/epel/9/Everything/x86_64/Packages/e/epel-release-9-7.el9.noarch.rpm
Or, you can download the latest version of the EPEL release from the Fedora Project and then install that RPM file using dnf.
Then provide the sudo user password. You can see that the app package is listed from your desired repository. If a dependency is present in your desired repository then it will use that repository or else it will use the default repository for solving dependencies.
-
After that, press “Y” to confirm the installation as shown in the image below.
-
Then the app package download and installation process will start afterward. After installation is complete you will get a confirmation message like the above image.
Conclusion
In this guide, I have explored the versatility of DNF for installing RPM packages on Red Hat-based systems. Whether you are installing a single package, multiple packages, a specific version of a package, or a package from a specific repository, you now have the required knowledge to do so using the dnf package manager. I hope this will enhance your Linux experience.
People Also Ask
How to install dependency RPM?
To install a package using RPM, first run sudo rpm -i main_package.rpm
. If you encounter dependency errors, resolve them by installing the required dependencies with sudo rpm -i dependency_1.rpm dependency_2.rpm
. Afterward, retry installing the original package with sudo rpm -i main_package.rpm
to ensure successful installation.
How to install local file with dnf?
To install a local package in any Red Hat-based Linux system using dnf, first move to the download folder using cd Download/
then run sudo dnf install filename.rpm
or you can just run sudo dnf install path/filename.rpm
in the terminal. It will install the local package in your system using the DNF package manager.
How do you upgrade a specific package using yum?
In Red Hat-based distributions dnf is the latest package manager. You can upgrade a specific app package by executing the sudo dnf update <package_name>
command in the terminal.
How do I install a specific version of a program in Linux?
The command for installing a specific package version varies with the Linux distribution and package manager. The sudo apt install <package_name>=<version>
is used in Debian-based Linux, sudo dnf install <package_name>-<version>
is used in Red Hat-based distribution, and for Arch Linux sudo pacman -S <package_name>=<version>
is used to install a specific version of an app package.
How do I list installed packages in Linux?
Depending on the Linux distribution and package manager the command changes to check installed packages in Linux command. The apt list --installed
is used in Debian-based Linux, the dnf list installed
is used in Red Hat-based distribution, and for Arch Linux pacman -Q
is used to see all installed packages.
Related Articles
- How to Show List of Installed Packages Using YUM [2 Cases]
- How to Check if Package is Installed Using YUM [3 Solutions]
- How to Install Specific Version of a Package Using YUM
- How to Install Local Package Using YUM [2 Practical Cases]
- How to List Installed Packages Using RPM [2 Practical Cases]
- 3 Ways to Install Pacman Package Manager in Ubuntu
- How to Install RPM Packages Using YUM [4 Interactive Cases]
- How to Install Local Package Using RPM [A Quick Guide]
- 2 Ways to Install Group Packages Using DNF [With Cases]
- 5 Ways to List Installed Packages in RHEL Using DNF With Cases
- How to Install RPM Packages From Text File [5 Simple Cases]
<< Go Back to Package Installation in Linux | Package Management in Linux | Learn Linux Basics