DNF (Dandified Yum) Commands Explained!
II. DNF Examples: Install, Remove, Upgrade, and Downgrade
Install a Package
Syntax:
dnf install <package>
Install a Single Package – Example:
dnf install mysql-server
Where mysql-server is the package name.
Install Multiple Packages – Example:
dnf install mysql-server mysql
Where mysql-server and mysql are the package names.
Upgrade / Update a Package
Upgrade Every Package:
dnf upgrade
Upgrade a Single Package – Example:
dnf upgrade mysql-server
Where mysql-server is the package name.
Upgrade Multiple Packages – Example:
dnf upgrade mysql-server mysql
Where mysql-server and mysql are the package names.
Reinstall a Package
Syntax:
dnf reinstall <package>
Reinstall a Single Package – Example:
dnf reinstall mysql-server
Where mysql-server is the package name.
Reinstall Multiple Packages – Example:
dnf reinstall mysql-server mysql
Where mysql-server and mysql are the package names.
Downgrade a Package
Downgrades the specified package(s) to the highest of all known lower versions, if possible.
Syntax:
dnf downgrade <package>
Downgrade a Single Package – Example:
dnf downgrade mysql-server
Where mysql-server is the package name.
Downgrade Multiple Packages – Example:
dnf downgrade mysql-server mysql
Where mysql-server and mysql are the package names.
Remove a Package
By removing a specified package(s) from the server, you’ll also remove ANY packages dependent on the package(s) being removed.
Syntax:
dnf remove <package>
Remove a Single Package – Example:
dnf remove mysql-server
Where mysql-server is the package name.
Remove Multiple Packages – Example:
dnf remove mysql-server mysql
Where mysql-server and mysql are the package names.
List of All Available Commands
autoremove
check-update
clean
distro-sync
downgrade
group
help
history
info
install
list
makecache
provides
reinstall
remove
repolist
repository-packages
search
updateinfo
upgrade
Related Articles:

About the Author: J. Mays
As a previous contributor, JMays shares his insight with our Knowledge Base center. In our Knowledge Base, you'll be able to find how-to articles on Ubuntu, CentOS, Fedora and much more!
Our Sales and Support teams are available 24 hours by phone or e-mail to assist.
Latest Articles
CentOS Linux 7 EOL — everything you need to know
Read ArticleHow to install Node.js on Linux (AlmaLinux)
Read ArticleUpgrading or installing PHP on Ubuntu — PHP 7.2 and Ubuntu 22.04
Read ArticleWhy is your IP blocked?
Read ArticleLiquid Web Terraform Provider Deploying WordPress
Read Article