How to Install Local Package Using DNF [2 Practical Cases]

LINUX
FUNDAMENTALS
A Complete Guide for Beginners Enroll Course Now

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]

step by step process of using DNF package manager to install app package from local rpm file using command line interface (CLI) in Red Hat-based Distributions

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/
EXPLANATION
      • cd: Changes the current directory to the destination directory.
      • Downloads/: Name of the destination directory.

change directory and check if the file is in that directory

  • After that, run the following command to confirm that your desired package file is present in that directory:

 

ls
EXPLANATION
      • ls: List all files and folders of the current directory in the command line.

install local package using dnf install command

  • 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
EXPLANATION
      • sudo: Permits administrative permission.
      • dnf: Package manager in Red Hat-based distributions.
      • install: Install an app package using dnf.
      • audacity-2.3.3-2.el8.x86_64.rpm: Name of the local file.

After running this you will be prompted to enter your sudo user password as shown in the next image. Provide your sudo password.

press Y to confirm installation

  • 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:

 

installation complete

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 >

  1. First, open the Terminal on your system.

  2. Secondly, use the cd command to navigate to the directory where your local app package file is located:
    cd Downloads/

    change directory and list all files and folders

  3. Next, type the following command to view all the files and folders in that directory as shown in the previous image:
    ls

  4. 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.

    install local package using dnf localinstall command

  5. After that, you will be prompted to confirm the installation. Type “Y” and press ENTER to proceed as shown in the following image:press Y to confirm installation

  6. Then, your app package will be installed automatically from the local file.installation complete

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

How to install local RPM file using yum?

To install a local RPM file using YUM, open the terminal then navigate to the directory containing the RPM file using the cd command, and use the command sudo yum install <package.rpm>. YUM will handle dependencies and install the package on your system.

How to download RPM using DNF?
To download an RPM package using DNF, use the following command dnf download <package_name>. DNF will fetch the specified RPM without installation, placing it in your current directory.

How to install RPM file locally?
The command for installing an RPM file locally varies with the package manager. The sudo rpm -i package_name is used in the rpm package manager, sudo yum localinstall package_name is used in the yum package manager, and in the dnf package manager sudo dnf install package_name is used to install an RPM app package locally.

Related Articles


<< Go Back to Package Installation in Linux | Package Management in Linux | Learn Linux Basics

4.8/5 - (18 votes)
Ridoy Chandra Shil

Hello everyone. I am Ridoy Chandra Shil, currently working as a Linux Content Developer Executive at SOFTEKO. I am a Biomedical Engineering graduate from Bangladesh University of Engineering and Technology. I am a science and tech enthusiast. In my free time, I read articles about new tech and watch documentaries on science-related topics. I am also a big fan of “The Big Bang Theory”. Read Full Bio

Leave a Comment