July 11, 2026
Tutorials

How to Use dnf Package Manager in AlmaLinux 10 (Install, Update, Remove)

how to use dnf package manager on almalinux 10

dnf (Dandified YUM) is the default package manager for AlmaLinux 10 and every modern RHEL-based distribution. It is how you install new software, apply security updates, remove unwanted packages, manage repositories, roll back broken transactions, and automate patching across your entire server fleet. This complete guide covers every essential dnf command with verified syntax, real-world examples, and production-relevant context so you can confidently manage software on AlmaLinux 10 from day one.

Table of Contents

What is dnf and how does it differ from yum?

dnf (Dandified YUM) is the next-generation RPM-based package manager that replaced yum as the default on Fedora 22 and later, and on RHEL 8, AlmaLinux 8, and all subsequent RHEL-family releases. On AlmaLinux 10, yum is simply a symlink that points to dnf. When you type yum install httpd, you are actually running dnf. The two share the same command syntax, repository format, and configuration files, so any guide written for yum applies equally to dnf on AlmaLinux 10.

The practical differences matter for production administrators: dnf resolves dependency conflicts significantly faster than old yum, uses far less memory during large update transactions, provides full transaction history with one-command rollback, and supports AppStream module streams that let you install specific software versions (for example, Node.js 20 vs. 22) without manually pinning packages.

Prerequisites

To follow this guide, you need access to an AlmaLinux 10 server or workstation with a non-root user that has sudo privileges or direct root access. An active internet connection is required to download packages from AlmaLinux’s official repositories. All commands that modify the system require sudo; read-only commands like dnf search and dnf info can be run without it.

How to Use dnf Package Manager in AlmaLinux 10

Learn how to use the DNF package manager in AlmaLinux 10 to install, update, remove, and manage software packages with simple terminal commands. This guide provides step-by-step examples, practical command explanations, and best practices to help beginners and system administrators manage packages efficiently. By following this tutorial, you can keep your AlmaLinux 10 system secure, up to date, and optimized using the latest DNF package management features.

1. Installing packages

The dnf install command downloads a package and all of its dependencies from the configured repositories and installs them on the system. It automatically resolves the full dependency tree; you never need to manually install dependencies one by one.

Install a single package AlmaLinux 10

Install the Apache web server.

sudo dnf install httpd

  sudo dnf install httpd

Install Nginx using the following command.

sudo dnf install nginx

  sudo dnf install nginx

Install the MariaDB database server.

sudo dnf install mariadb-server

  sudo dnf install mariadb-server

When you run dnf install without any flags, dnf shows a transaction summary listing all packages and dependencies to be downloaded, their sizes, and asks for confirmation. Type y and press Enter to proceed.

Install multiple packages at once

Install multiple packages in one transaction, faster than separate installs. Let’s install the php package.

sudo dnf install httpd mariadb-server php php-mysqlnd -y

  sudo dnf install httpd mariadb-server php php-mysqlnd -y

Install a package from a local RPM file.

sudo dnf install /path/to/package.rpm

Skip the confirmation prompt with -y

-y auto-answers “yes” to all prompts, essential for scripts and automation.

sudo dnf install git curl wget vim -y

  sudo dnf install git curl wget vim -y

Pro tip: use -y in scripts; skip it interactively.

In automation scripts, Ansible playbooks, or cloud-init templates, always use -y so installations never block waiting for keyboard input. For interactive sessions on production servers, omit -y and review the transaction summary before confirming; this habit has saved many sysadmins from accidentally installing unexpected dependencies.

2. Updating and upgrading packages

Keeping packages up to date is the single most important maintenance task on any Linux server. dnf update and dnf upgrade are identical aliases, both download and install all available updates for currently installed packages while respecting the system’s configured major version.

Check for available updates without applying them.

List all packages that have updates available, dry run, no changes made

dnf check-update

  dnf check-update

Check for security updates only.

dnf updateinfo list security

  dnf updateinfo list security

Apply all available updates.

Update all installed packages to their latest available versions.

sudo dnf update

  sudo dnf update

dnf upgrade is a full synonym for dnf update, both do the same thing

sudo dnf upgrade

  sudo dnf upgrade

Update a specific package only.

Update only the Apache web server; leave everything else unchanged.

sudo dnf update httpd

  sudo dnf update httpd

Apply only security patches; leave non-security updates pending.

sudo dnf update –security -y

  sudo dnf update --security -y

Kernel updates require a reboot.

When dnf update installs a new kernel version, the running kernel is not replaced until you reboot the server. The new kernel is placed in /boot/ and becomes the default boot entry automatically. AlmaLinux 10 keeps the three most recent kernel versions by default (installonly_limit=3 in dnf.conf), so older kernels are pruned automatically to prevent /boot from filling up.

3. Removing packages and cleaning orphans

Removing packages you no longer need reduces the attack surface of your server and frees disk space. dnf remove uninstalls the specified package and all packages that depend on it; dnf always shows you the full list before asking for confirmation.

Remove a package

Remove the Apache web server and its dependent packages.

sudo dnf remove httpd

  sudo dnf remove httpd

Remove multiple packages in one transaction.

sudo dnf remove httpd php php-mysqlnd

  sudo dnf remove httpd php php-mysqlnd

Remove orphaned dependency packages

Remove packages that were installed as dependencies but are no longer needed.

Run this after removing packages to keep the system lean.

sudo dnf autoremove

  sudo dnf autoremove

Clean the dnf package cache

Remove all cached repository metadata and downloaded RPM files.

sudo dnf clean all

  sudo dnf clean all

Remove only cached packages (keeps repository metadata)

sudo dnf clean packages

  sudo dnf clean packages

Rebuild the metadata cache from scratch, useful after repo changes.

sudo dnf makecache

  sudo dnf makecache

Review before removing

Always review the transaction summary that dnf removes displays before typing y. Because dnf enforces dependency consistency, removing one package may cascade into removing others that depend on it. If the removal list includes packages you did not intend to remove, press n to cancel and investigate the dependency chain with dnf repoquery –whatrequires <package> first.

4. Searching for and inspecting packages

Before installing a package whose exact name you are unsure of, use dnf search to find it. Use dnf info to read its description, version, and repository source. Use dnf provides to find which package supplies a specific file or command.

Search package names and summaries for a keyword.

dnf search nginx

  dnf search nginx

Show full description, version, repo, and size for a package.

dnf info nginx

  dnf info nginx

Find which package provides a specific file or command. Useful when a command is missing, and you need to know what to install.

dnf provides /usr/bin/netstat

  dnf provides /usr/bin/netstat

List all installed packages.

dnf list installed

  dnf list installed

List all available packages in configured repositories.

dnf list available

  dnf list available

Check if a specific package is installed.

dnf list installed | grep httpd

  dnf list installed | grep httpd

5. Package groups and environments

DNF groups let you install a curated collection of related packages with a single command. On AlmaLinux 10, groups range from “Development Tools” (compilers, debuggers, build utilities) to full environment groups like “Server with GUI” or “Minimal Install.” This is far more efficient than installing individual packages when setting up a role-specific server.

List all available package groups.

dnf group list

  dnf group list

Show what packages a specific group contains.

dnf group info “Development Tools”

  dnf group info

Install a complete package group, which installs all packages in the group.

sudo dnf group install “Development Tools” -y

  sudo dnf group install

Install the minimal server environment group.

sudo dnf group install “Minimal Install” -y

  sudo dnf group install

Development Tools are a must for compiling from source

If you ever encounter an error like cc: command not found or make: not found when compiling software from source on a fresh AlmaLinux 10 server, run sudo dnf group install “Development Tools” -y. This single command installs GCC, G++, Make, automake, autoconf, and all other standard build tools in one shot.

Conclusion

To use the DNF package manager in AlmaLinux 10 to install, update, and remove software, you will interact with it via the command line using sudo privileges. DNF automatically handles downloading software packages and resolving their dependencies.

Frequently asked questions

1. How do I install a package using DNF in AlmaLinux 10?

Use the command sudo dnf install package_name to install software from the enabled repositories. DNF automatically resolves and installs required dependencies.

2. How do I update all packages in AlmaLinux 10 using DNF?

Run sudo dnf update or sudo dnf upgrade to download and install the latest security patches, bug fixes, and package updates available in your repositories.

3. How do I remove a package with DNF without leaving unused dependencies?

Execute sudo dnf remove package_name. DNF can also remove unnecessary dependencies that are no longer required, helping keep your system clean.

4. How do I search for available packages in DNF?

Use dnf search package_name to find software packages and dnf info package_name to view detailed package information before installation.

5. How do I clear the DNF cache in AlmaLinux 10?

Run sudo dnf clean all to remove cached metadata and packages, then use sudo dnf makecache to rebuild the repository cache if needed. This helps resolve repository and package metadata issues.

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video