Language
日本語
English

Caution

JavaScript is disabled in your browser.
This site uses JavaScript for features such as search.
For the best experience, please enable JavaScript before browsing this site.

Linux & Mac & Bash Command Dictionary

  1. Home
  2. Linux & Mac & Bash Command Dictionary
  3. dnf / yum

dnf / yum

dnf is the standard package manager for RPM-based Linux distributions such as RHEL, AlmaLinux, and CentOS Stream. Use dnf install to install packages, dnf update to update the entire system, dnf remove to uninstall packages, and dnf autoremove to remove orphaned dependencies in one go. Enabling the EPEL (Extra Packages for Enterprise Linux) repository gives you access to many packages not available in the official repositories. Note that yum is the legacy command used on RHEL 7 and earlier; RHEL 8 and later use dnf as the standard tool.

Syntax

# -----------------------------------------------
#  Update the package list
# -----------------------------------------------

# dnf check-update
#   → Checks the repository for available updates and lists upgradable packages.
#   → Does not actually perform any updates.
#   Example: sudo dnf check-update

# -----------------------------------------------
#  Install packages
# -----------------------------------------------

# dnf install {package} [{package} ...]
#   → Installs the specified package(s).
#   → Dependencies are resolved automatically.
#   → Multiple packages can be specified separated by spaces.
#   Example: sudo dnf install nginx
#   Example: sudo dnf install nginx php-fpm

# dnf install {package}-{version}
#   → Installs a specific version of a package.
#   Example: sudo dnf install nginx-1.24.0

# -----------------------------------------------
#  Update packages
# -----------------------------------------------

# dnf update
#   → Updates all installed packages to the latest available versions.
#   → Old packages may be replaced when dependency relationships change.

# dnf update {package}
#   → Updates only the specified package.
#   Example: sudo dnf update nginx

# -----------------------------------------------
#  Remove packages
# -----------------------------------------------

# dnf remove {package}
#   → Removes the specified package.

# dnf autoremove
#   → Removes orphaned packages that are no longer required by any other package.

# -----------------------------------------------
#  Search and inspect packages
# -----------------------------------------------

# dnf search {keyword}
#   → Searches package names and descriptions for the given keyword.

# dnf info {package}
#   → Displays detailed information about a package (version, dependencies, etc.).

# dnf list installed
#   → Lists all currently installed packages.

# dnf list available
#   → Lists all packages available from the configured repositories.

# -----------------------------------------------
#  Repository management (EPEL)
# -----------------------------------------------

# dnf install epel-release
#   → Enables the EPEL (Extra Packages for Enterprise Linux) repository.
#   → Makes many packages unavailable in the official repositories accessible.
#   Example: sudo dnf install epel-release

# dnf repolist
#   → Lists all enabled repositories.

# dnf config-manager --enable {repo-id}
#   → Enables the specified repository.

# dnf config-manager --disable {repo-id}
#   → Disables the specified repository.

Syntax Reference

OperationCommandDescription
Check for available updatesdnf check-updateLists packages that have updates available. Lets you preview updates without installing them.
Install a packagednf install {package}Installs the specified package. Dependencies are resolved automatically.
Update all packagesdnf updateUpdates all installed packages to their latest versions.
Update a specific packagednf update {package}Updates only the specified package to its latest version.
Remove a packagednf remove {package}Removes the specified package, taking dependencies into account for a safe removal.
Remove orphaned packagesdnf autoremoveRemoves packages that are no longer required by any other installed package.
Search for a packagednf search {keyword}Searches package names and descriptions using the given keyword.
Show package detailsdnf info {package}Displays detailed information including version, dependencies, and a description.
List installed packagesdnf list installedLists all packages currently installed on the system.
List available packagesdnf list availableLists all packages available from the configured repositories.
Install a specific versiondnf install {package}-{version}Installs a fixed version of a package. Useful when you need to pin a known-good version.
Enable EPELdnf install epel-releaseEnables the EPEL repository. Makes many packages not in the official repositories available.
List repositoriesdnf repolistLists all enabled repositories. Use dnf repolist all to also see disabled repositories.
Enable a repositorydnf config-manager --enable {repo-id}Enables the specified repository. Requires the dnf-plugins-core package.
Disable a repositorydnf config-manager --disable {repo-id}Disables the specified repository without removing it, temporarily stopping its use.
Clear the cachednf clean allRemoves all cached downloaded package files, freeing up disk space.

Examples

Basic command examples
# -----------------------------------------------
#  Bring the system up to date
# -----------------------------------------------

# Check which packages have updates available first.
sudo dnf check-update

# Update all installed packages to the latest versions.
sudo dnf update

Run the following command:

$ sudo dnf check-update
Last metadata expiration check: 0:05:12 ago on Wed Mar 25 10:00:00 2026.

bash.x86_64               5.1.8-6.el9_1          baseos
glibc.x86_64              2.34-60.el9_2.4        baseos
openssl.x86_64            3.0.7-25.el9_3         baseos
Install Nginx and verify it is running
# -----------------------------------------------
#  Install and verify Nginx
# -----------------------------------------------

# Install Nginx.
sudo dnf install nginx

# Check the installed version.
nginx -v

# Start Nginx and enable it to start automatically on boot.
sudo systemctl enable --now nginx

Run the following command:

$ nginx -v
nginx version: nginx/1.20.1
Enable the EPEL repository and install additional packages
# -----------------------------------------------
#  Enable EPEL and install htop
#  (htop is available in EPEL, not in the standard repositories)
# -----------------------------------------------

# Enable the EPEL repository first.
sudo dnf install epel-release

# Confirm that EPEL has been added.
dnf repolist

# Install htop.
sudo dnf install htop

# Launch htop to inspect running processes.
htop

Run the following command:

$ dnf repolist
repo id              repo name
appstream            AlmaLinux 9 - AppStream
baseos               AlmaLinux 9 - BaseOS
epel                 Extra Packages for Enterprise Linux 9 - x86_64
extras               AlmaLinux 9 - Extras
Remove packages and clean up
# -----------------------------------------------
#  Remove a package and clean up afterwards
# -----------------------------------------------

# Remove Apache httpd (cleanup after migrating to Nginx).
sudo dnf remove httpd

# Remove any orphaned packages that were pulled in by httpd.
sudo dnf autoremove

# Delete cached downloaded package files to free up disk space.
sudo dnf clean all

# Confirm that httpd has been removed.
dnf list installed | grep httpd

Run the following command:

$ dnf list installed | grep httpd
(no output means the package has been removed successfully)
Check available versions and install a specific one
# -----------------------------------------------
#  Inspect available versions and install a pinned version
# -----------------------------------------------

# List all available versions of the package.
dnf list --showduplicates nginx

Run the following command:

$ dnf list --showduplicates nginx
Last metadata expiration check: 0:10:45 ago on Wed Mar 25 10:00:00 2026.
Available Packages
nginx.x86_64    1:1.20.1-14.el9_2.1    appstream
nginx.x86_64    1:1.22.1-3.el9         appstream

The following example demonstrates this:

# Install the specified version.
sudo dnf install nginx-1.20.1

# Confirm that the version is pinned correctly.
nginx -v

Run the following command:

$ nginx -v
nginx version: nginx/1.20.1

Overview

dnf is the standard package manager for RPM-based Linux distributions including RHEL, AlmaLinux, Rocky Linux, and CentOS Stream. It was officially adopted in RHEL 8 as the successor to yum (Yellowdog Updater Modified), bringing faster dependency resolution, reduced memory usage, and a full migration to Python 3. On RHEL 7 and earlier, the yum command is used, but its basic operations (install / update / remove) share almost identical options with dnf. Enabling the EPEL repository (epel-release) makes many additional packages available — including htop, redis, and certbot — that are not included in the official repositories. For package management on Debian- and Ubuntu-based systems, see the apt page.

If you find any errors or copyright issues, please .