DNF Package Manager Part #3
Install dnf update or alias (up) check is list available.
~]# dnf update
...
===============================================================================
Package Arch Version Repo Size
===============================================================================
Installing:
kernel x86_64 5.14.0-239.el9 baseos 3.0 M
Upgrading:
NetworkManager x86_64 1:1.41.8-1.el9 baseos 2.2 M
NetworkManager-libnm x86_64 1:1.41.8-1.el9 baseos 1.8 M
...
Transaction Summary
===============================================================================
Install 12 Packages
Upgrade 204 Packages
Check-update dnf upgrade package_name… or alias (dg) command can be used to see which installed packages on your system have new versions.
~]# dnf upgrade zsh
...
===============================================================================
Package Architecture Version Repository Size
===============================================================================
Upgrading:
zsh x86_64 5.8-9.el9 baseos 3.2 M
Transaction Summary
===============================================================================
Upgrade n Package
Downgrade software dnf downgrade package_name… or alias (dg) to previous version reverts to the previous version of a package.
~]# dnf downgrade zsh
...
===============================================================================
Package Architecture Version Repository Size
===============================================================================
Downgrading:
zsh x86_64 5.8-7.el9 baseos 3.2 M
Transaction Summary
===============================================================================
Downgrade 1 Package
List of options dnf help or — help -h -?
~]# dnf help
usage: dnf [options] COMMAND
...
Combined dnf list installed | grep package_name… with the grep command, you can search whether a particular package is installed or not, as follows.
~]# dnf list installed | grep zsh
zsh.x86_64 5.8-9.el9 @baseos
Removes the specified packages dnf remove package_name… or alias (rm) from the system along with any packages depending on the packages being removed.
~]# dnf remove zsh
...
===============================================================================
Package Architecture Version Repository Size
===============================================================================
Removing:
zsh x86_64 5.8-9.el9 @baseos 7.6 M
Transaction Summary
===============================================================================
Remove 1 Package
Reinstall package dnf reinstall package_name… or alias (rei) if an error occurs in installation time.
~]# dnf reinstall zsh
...
===============================================================================
Package Architecture Version Repository Size
===============================================================================
Reinstalling:
zsh x86_64 5.8-9.el9 baseos 3.2 M
Transaction Summary
===============================================================================
dnf alias Create custom alias location of /etc/dnf/aliases.d/USER.conf dir.
~]# dnf alias
No aliases defined.
~]# dnf alias add sil=remove
Aliases added: sil
~]# dnf sil zsh
...
===============================================================================
Package Architecture Version Repository Size
===============================================================================
Removing:
zsh x86_64 5.8-9.el9 @baseos 7.6 M
Transaction Summary
===============================================================================
Remove 1 Package
dnf config-manager --add-repo repository_url … where repository_url is a link to the .repo file.
~]# dnf config-manager --add-repo https://example.com/repo
Adding repo from: https://example.com/repo
To display a list of all transactions, dnf history list start_id…end_id or history list or history undo and redo id.
~]# dnf history list 1..4
...
ID | Login user | Date a | Action | Altere
-------------------------------------------------------------------------------
4 | root <root> | 2015-04-16 18:35 | Erase | 1
3 | root <root> | 2015-04-16 18:34 | Install | 1
2 | root <root> | 2015-04-16 17:53 | Install | 1
1 | System <unset> | 2015-04-16 14:14 | Install | 668 E
Conclusion
The dnf command on Linux was the subject of this article. I hope this article was helpful in introducing you to dnf and that you will be able to use the command easily moving forward.