The best way to Handle Packages on RPM-Primarily based Linux Distros With DNF

One of the most attractive features of the Linux operating system is its ease of installation or automation of the installation of software packages from secure remote repositories.

This guide will walk you through installing and managing software packages on RPM-based Linux distributions such as Fedora and Red Hat Enterprise Linux (RHEL) using DNF, the next-generation package manager for RPM-based Linux distributions.

What is DNF?

DNF is the successor program to YUM (Yellowdog Updater Modified) and is the standard package manager on Fedora and RHEL. The name DNF is short for Dandified YUM.

The main purpose of DNF is to make it easier to install, query, and manage software packages on servers and desktops. Like other mainstream package managers on Linux, DNF resolves all software package dependencies during installation.

DNF also maintains backward compatibility with YUM, so your older scripts will run without any problems. Indeed, if you have the yummy Command on new Linux distributions, it actually uses DNF in the background. You can check this by running the command:

MAKEUSEO VIDEO OF THE DAY
ls -l / usr / bin / yum

As you can see in the output, the yummy Command is simply a symbolic link to dnf.

Find software packages with DNF

An important part of package management is querying or looking for packages that interest you both locally and in remote repositories. You can search for packages by package name, package content or keywords, etc.

For example, if you want to find some web browsers that you might be able to install, you can start with a general search with the keyword "browser".

dnf search browser

The output is a list of all software packages that contain the word "browser" in the package name or description.

If you would like more information about a particular package, for example the Firefox browser, you can use the the information Subcommand as follows:

dnf info firefox

The output gives you more detailed information about the package, such as: B. Architecture, package size, version number, license, etc.

You can also list all of the packages available for installation from the configured repositories by using the perform Method. We have the fewer Command to list the packages in full screen.

dnf list available | fewer

Use the F. to scroll forward and the B. to scroll backwards. You can also search the output for a keyword by pressing / and then entering your keyword. Press Q to end the command output.

Use the following command to view all of the installed software packages on your PC:

dnf list installed

Install software packages

Installing packages with DNF is pretty straightforward. However, you need elevated privileges as a root or sudo user. For example, to install the Firefox browser just run the following command and then press Yes in the command prompt that appears to agree to the conditions:

sudo dnf install Firefox

As mentioned earlier, the dnf command takes care of installing all of the dependencies for a package. To view all of the dependencies installed as part of the Firefox installation, use the dissolve Subcommand followed by the package name.

dnf deplist firefox

Uninstalling software packages

Removing packages is an equally important exercise in managing software. One of the easiest ways to remove or uninstall a package is to use the Extinguish Method.

sudo dnf remove firefox

Another way to remove software packages is through the story Subcommand. DNF keeps a record of all transactions in which software packages are installed or removed. To view previous DNF transactions, you can run the following command:

dnf story

The output lists previous actions or transactions in tabular form. In this case the output shows that we previously installed vim and chromium.

With the story You can use subcommand to undo or remove all previous transactions. For example, to remove the vim package, just run the story Command with the cancel followed by the transaction ID, and then press Y when prompted to continue.

sudo dnf undo history 3

As a best practice, you should get more details about a transaction before undoing it to avoid side effects. You can view the details of a transaction with the following command:

sudo dnf story info 3

Remember to replace 3 with the corresponding transaction ID that you are interested in.

Related: The Best Desktop Alternatives to Fedora

Remove unused dependencies

One of the things that take up space on Linux PCs is packages and dependencies that are no longer needed by the system.

Run the following command to remove such dependencies:

sudo dnf autoremove

In addition, DNF can also be used to remove data that was downloaded along with installed packages.

sudo dnf clean packages

You can also clean up your software package cache and other metadata that is part of the installed packages by running the following command:

sudo dnf clean metadata

Reinstallation of software packages

Occasionally, you may only need to install certain components of a package. For example, if you accidentally remove certain software packages from the Fire fox, you can reinstall them by running:

sudo dnf reinstall Firefox

Update packages with DNF

Keeping your software up to date is one of the best ways to keep a robust and secure system as new software includes the latest security patches and bug fixes.

To get the latest software package updates from remote repositories, you can use the Check update Subcommand as follows:

sudo dnf check-update

After getting the updates, you can use them with. apply to all installed software packages To update.

sudo dnf update

The output shows the total number of packages DNF will update.

You can also update a specific package, for example Firefox, with the following command:

sudo dnf update firefox

Learn More: Why You Should Update Packages Before Installing Software on Linux

Alternative and modern package management

This guide examined how to use the DNF command to manage software packages on RPM-based Linux distributions such as Fedora and Red Hat Enterprise Linux (RHEL). You can also use YUM and RPM package managers on Fedora.

Another modern way to distribute software packages on Linux is Flatpak, a solution that allows you to build and distribute a package on multiple supported Linux distributions.

Can you get by with a Linux desktop just for Flatpak?

Linux distributions offer their users several ways to download software. But how does it feel to use a Linux desktop just for Flatpak?

Continue reading

About the author

Mwiza Kumwenda
(39 published articles)

Mwiza is a professional developer of software and writes extensively on Linux and front-end programming. His interests include history, economics, politics, and corporate architecture.

More
By Mwiza Kumwenda

Subscribe to our newsletter

Subscribe to our newsletter for tech tips, reviews, free e-books, and exclusive offers!

Click here to subscribe

Leave a Reply

Your email address will not be published. Required fields are marked *