DNF (Dandified YUM) is the latest package manager in Red Hat-based systems such as RHEL, Fedora, CentOS, etc. It builds upon the foundation of the YUM package manager. Just as YUM streamlined package management, DNF builds upon that legacy and offers advanced capabilities beyond RPM’s basic. It simplifies the intricacies of package installation, dependency resolution, version management, software removal, etc. It enhances the user experience in Linux/Unix systems. In this article, I will guide you on how you can use the dnf package manager to install a local rpm package in your Red Hat-based system.
Key Takeaways
- Learning the process of locally installing an app package in your system.
Requirements
- A Red Hat-based distribution is required.
- Sudo privilege is required.
Process Flow Chart
[Distro Used Throughout the Tutorial: RHEL 9.2]
2 Cases to Install a Local Package Using DNF
When it comes to package management, installing software is a crucial task. There are instances when the package you need or a specific version of the package is not available in the remote repositories. In such cases, if you have access to the rpm file of that package or that particular version then you can locally install that app package in your Linux system.
DNF offers 2 simple approaches for this task: using the “dnf install” command and using the “dnf localinstall” command. These methods are perfect for any Red Hat-based Linux system. You can easily handle this task using the dnf package manager in the Command Line Interface (CLI). In this article, I will walk you through the process of using the dnf package manager to install an app package from a local rpm file in any Red Hat-based distributions.
If you want to learn about how to install app packages using dnf, check this detailed article “How to Install RPM Packages Using DNF”. If you want to list all installed app packages using dnf, go through this simple article “5 Ways to List Installed Packages in RHEL Using DNF With Cases”.To know how to install app packages using yum, check this detailed article on “How to Install RPM Packages Using YUM”.
Case 1: Install Local Package Using “dnf install” Command
In dnf, the “install” option allows the installation of the local package, allowing greater control over the package management. To install an app package from a local file using the “dnf install” command, just follow these step-by-step processes:
Steps to Follow >
- To begin, launch the Terminal on your system.
- Next, use the cd command to navigate to the directory containing your local rpm package file, as shown in the following image:
cd Downloads/
-
-
- cd: Changes the current directory to the destination directory.
- Downloads/: Name of the destination directory.
-
- After that, run the following command to confirm that your desired package file is present in that directory:
ls
-
-
- ls: List all files and folders of the current directory in the command line.
-
- Now, execute the following command to install an app package from the local .rpm file. It will look similar to the above image.
sudo dnf install audacity-2.3.3-2.el8.x86_64.rpm
After running this you will be prompted to enter your sudo user password as shown in the next image. Provide your sudo password.
- After that, press “Y” to confirm the installation as shown in the above image.
- Then, your app package will be automatically installed from the local file like the image below:
Finally, upon successful installation, your system will display a confirmation message. With these simple step-by-step instructions, you have successfully installed a local package using the “dnf install” command.
Case 2: Install Local Package Using “dnf localinstall” Command
In this case, I will explore the method of installing local packages using the “dnf localinstall” command. This option allows you to specify the path to a rpm package file on your local system and install it directly. To install an app package from a local file using the “dnf localinstall” command follow these instructions:
Steps to Follow >
- First, open the Terminal on your system.
- Secondly, use the cd command to navigate to the directory where your local app package file is located:
cd Downloads/
- Next, type the following command to view all the files and folders in that directory as shown in the previous image:
ls
- Now, run the following command to install an app package from the local .rpm file. It will look similar to the next image.
sudo dnf localinstall audacity-2.3.3-2.el8.x86_64.rpm
EXPLANATION- localinstall: Install an app package from a local rpm file using dnf.
Warning: The “localinstall” command alias is no longer recommended in DNF. Instead, users should use the standard “install” command for package installations, including local packages. This change aims to maintain consistency and reduce potential confusion among users.After running this you will be asked for your sudo user password shown in the following image. Provide your sudo password.
- After that, you will be prompted to confirm the installation. Type “Y” and press ENTER to proceed as shown in the following image:
- Then, your app package will be installed automatically from the local file.
Finally, once the installation of the app package from the local file is complete, you will get a confirmation message of the successful installation in your system as shown in the above image.
Conclusion
In this comprehensive guide, I have explored the process of installing local packages using the DNF package manager in Red Hat-based Distributions. By following the step-by-step instructions provided in this guide you now possess the knowledge and skills to install local packages using the dnf command in your Linux system. Whether you choose “dnf install” or “dnf localinstall” I hope you will be able to manage an up-to-date Linux system.
People Also Ask
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 Local Package Using RPM [A Quick Guide]
- 2 Ways to Install Group Packages 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
FUNDAMENTALS A Complete Guide for Beginners