Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the Linux dnf command

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the relevant knowledge of "how to use the Linux dnf command". The editor shows you the operation process through the actual case. The operation method is simple, fast and practical. I hope this article "how to use the Linux dnf command" can help you solve the problem.

DNF is the new generation of rpm package manager. He first appeared in the Fedora 18 release. Recently, it replaced yum as the package manager for Fedora 22.

Dnf's new generation of RPM software package manager

It is added that the DNF package manager overcomes some bottlenecks of the YUM package manager and improves many aspects, including user experience, memory consumption, dependency analysis, running speed and so on. DNF uses RPM, libsolv, and hawkey libraries for package management operations. Although it is not pre-installed in CentOS and RHEL 7, you can use DNF while using YUM. You can learn more about DNF here: "DNF replaces YUM for reasons you don't know."

The latest stable release of DNF is version 1. 0, and the release date is May 11, 2015. This version of the DNF package manager (including all previous versions) is mostly written in Python, and the release license is GPL v2. 0.

Installing the DNF package manager DNF is not installed by default on RHEL or CentOS 7 systems, but Fedora 22 already uses DNF by default.

1. To install DNF, you must first install and enable epel-release dependencies.

Execute the following command in the system:

Yum install epel-release or

Yum install epel-release-y actually has no reason to force the use of "- y". On the contrary, without using "- y", users can see what is installed on the system during the installation process. But for users who don't have this requirement, you can use the "- y" parameter in YUM to install everything automatically.

2. Use the YUM command in the epel-release dependency to install the DNF package. Execute the following command in the system:

Yum install dnf then, the DNF package manager is successfully installed on your system. Next, it's time to start our tutorial! In this tutorial, you will learn 27 commands for the DNF package manager. Using these commands, you can easily and effectively manage RPM packages on your system. Now, let's learn the 27 common commands of the DNF package manager.

View the DNF package Manager version

Useful: this command is used to view the version of the DNF package manager installed on your system

Dnf-versionless Checkmuri DNFMurVersion

View the DNF software libraries available in the system

Use: this command is used to display the DNF software libraries available in the system

Dnf repolist views all DNF software libraries available and unavailable on the system

Useful: this command is used to display all DNF software libraries available and unavailable in the system

Dnf repolist all lists all RPM packages

Useful: this command is used to list all available software packages from the software library on the user's system and all software packages that have been installed on the system

Dnf list lists all installed RPM packages

Useful: this command is used to list all installed RPM packages

Dnf list installed lists all RPM packages available for installation

Useful: this command is used to list software packages available for installation from all available software libraries

Dnf list available searches for RPM packages in the software library

Usefulness: you can use this command to search for packages when you don't know the exact name of the software you want to install. You need to type the partial name of the software after the "search" parameter to search. (in this case we use "nano")

Dnf search nano looks up the provider of a file

Useful: you can use this command when you want to see which package provides a file in the system. (in this case, we will look for the provider of the file "/ bin/bash")

Dnf provides / bin/bash View package details

Useful: this command can help you when you want to view the details of a package before installing it. (in this case, we will look at the details of the package "nano")

Dnf info nano installation package

Usefulness: using this command, the system will automatically install the corresponding software and all its required dependencies (in this case, we will use this command to install nano software)

Dnf install nano upgrade package

Useful: this command is used to upgrade the custom package (in this case, we will upgrade the "systemd" package with the command)

Dnf update systemd checks system software packages for updates

Useful: this command is used to check for updates to all software packages in the system

Dnf check-update upgrades all system packages

Useful: this command is used to upgrade all software packages in the system that have available upgrades

Dnf update or dnf upgrade delete software package

Usefulness: delete the package specified in the system (in this case we will use the command to delete the package "nano")

Dnf remove nano or dnf erase nano remove useless orphaned packages

Usefulness: when there is no software to rely on them, some packages used to solve specific software dependencies will become meaningless, and this command is used to automatically remove these useless orphaned packages.

Dnf autoremove removes cached useless packages

Usefulness: in the process of using DNF, all kinds of outdated files and unfinished compilation projects will be left in the system for various reasons. We can use this command to delete these useless junk files.

Dnf clean all gets help on using a command

Usefulness: this command is used to get help on the use of a command (including parameters that can be used for the command and a description of the purpose of the command) (in this case we will use the command to get help on the use of the command "clean")

Dnf help clean views all DNF commands and their uses

Purpose: this command is used to list all DNF commands and their uses

Dnf help views the execution history of DNF commands

Useful: you can use this command to view the execution history of DNF commands on your system. In this way, you can know what software has been installed and uninstalled since you used DNF.

Dnf history views all package groups

Useful: this command is used to list all package groups

Dnf grouplist installs a package group

Purpose: this command is used to install a package group (in this case, we will install the package group "Educational Software" with the command)

Dnf groupinstall 'Educational Software' upgrades a package in a package group

Useful: this command is used to upgrade a package in a package group (in this case, we will upgrade the software in the package group "Educational Software" with the command)

Dnf groupupdate 'Educational Software' deletes a package group

Useful: this command is used to delete a package group (in this case, we will delete the package group "Educational Software" with the command)

Dnf groupremove 'Educational Software' installs specific software from a specific package library

Useful: this command is used to install specific software from a specific package library (in this case we will use the command to install the phpmyadmin package from the package library epel)

Dnf-enablerepo=epel install phpmyadmin updates the package to the latest stable release

Use: this command updates all installed software packages to the latest stable release from all available software sources

Dnf distro-sync reinstalls specific software packages

Useful: this command is used to reinstall a specific package (in this case, we will use the command to reinstall the package "nano")

Dnf reinstall nano rolls back the version of a particular software

Useful: this command is used to downgrade the version of a specific package (if possible) (in this case, we will use the command to downgrade the version of the package "acpid")

Dnf downgrade acpid sample output:

Using metadata from Wed May 20 12:44:59 2015No match for available package: acpid-2.0.19-5.el7.x86_64Error: Nothing to do. Original author's note: when executing this command, DNF did not downgrade the specified software ("acpid") as I expected. The problem has been reported.

Summary DNF package Manager as an upgrade alternative to YUM package Manager, it can automatically accomplish more operations. But in my opinion, because of this, DNF package managers are not very popular with experienced Linux system managers. Examples are as follows:

There is no-skip-broken command in DNF, and there is no alternative command to choose from.

It is not determined in DNF which package provides the specified dependent resolvedep command.

There is no deplist command in DNF to list a software dependency package.

When you exclude a software library from DNF, it will affect all your subsequent operations, unlike in YUM, where your exclusion will only work when you upgrade and install the software.

This is the end of the content about "how to use the Linux dnf command". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report