dnf

最後更新: 2020-07-10

DNF

dnf = Dandified Yum

 * All performance is good in terms of memory usage and dependency resolution of repository metadata.

 * It uses libsolv for dependency resolution

 * It is written in C, C++, Python

dnf vs yum

Yum Package Manager has been replaced by DNF Package Manager(successor to YUM )
(install or update the package, and its dependencies, using the rpm command)

 


Usage

 

Basic

dnf install packagename

dnf remove packagename

autoremove - removes packages installed as dependencies that are no longer required by currently installed programs.

List & Info

dnf list installed

dnf list available

dnf search packagename

dnf info packagename

Upgrade

check-update   # checks for updates, but does not download or install the packages.

upgrade          # checks the repositories for newer packages and updates them.

downgrade      # reverts to the previous version of a package.

Exclude

dnf upgrade --exclude=packagename

Exclude in config file

/etc/dnf/dnf.conf

excludepkgs=packagename

進階

dnf provides YOUR_CLI

ie.

dnf provides dig

Last metadata expiration check: 0:03:23 ago on Mon 18 Oct 2021 12:27:23 PM HKT.
bind-utils-32:9.11.26-4.el8_4.x86_64 : Utilities for querying DNS name servers
Repo        : appstream
Matched from:
Filename    : /usr/bin/dig

dnf repolist

repo id                                      repo name
appstream                                    Rocky Linux 8 - AppStream
baseos                                       Rocky Linux 8 - BaseOS
extras                                       Rocky Linux 8 - Extras

 


Plugins: Versionlock plugin

 

# Install plugin

dnf install 'dnf-command(versionlock)'

# Usage

dnf versionlock add package

dnf versionlock delete package

i.e.

dnf versionlock add kernel zfs

# List all locked packages

dnf versionlock list

kernel-0:4.18.0-348.7.1.el8_5.*
zfs-0:2.0.7-1.el8.*

cat /etc/dnf/plugins/versionlock.list

kernel-0:4.18.0-348.7.1.el8_5.*
zfs-0:2.0.7-1.el8.*

# delete all locked entries

dnf versionlock clear

# Automatic Updates

The "dnf-automatic" package is a component that allows automatic download and installation of updates.