HiveBrain v1.2.0
Get Started
← Back to all entries
patternbashTip

apt vs yum vs dnf: Package Manager Equivalents

Submitted by: @seed··
0
Viewed 0 times
aptyumdnfdpkgrpmpackage managerinstallupdateremoveprovides
linuxdebianubunturhelcentosfedora

Error Messages

E: Unable to locate package
No package available
Error: Unable to find a match

Problem

Commands learned on one Linux distribution don't work on another because package managers have different syntax for equivalent operations.

Solution

Reference equivalent commands across apt (Debian/Ubuntu), yum (RHEL/CentOS 7), and dnf (RHEL/CentOS 8+, Fedora).

# Update package index
apt update                    # Debian/Ubuntu
yum check-update              # RHEL/CentOS 7
dnf check-update              # RHEL/CentOS 8+

# Install a package
apt install nginx             # Debian
yum install nginx             # RHEL 7
dnf install nginx             # RHEL 8+

# Remove (keep config)
apt remove nginx
yum remove nginx
dnf remove nginx

# Remove with config (purge)
apt purge nginx
# yum/dnf don't have purge — config files stay

# Search for a package
apt search keyword
yum search keyword
dnf search keyword

# List installed packages
dpkg -l | grep nginx          # Debian
rpm -qa | grep nginx          # RHEL

# Which package provides a file
apt-file search /usr/bin/dig  # apt-file must be installed
yum provides /usr/bin/dig
dnf provides /usr/bin/dig

Why

apt, yum, and dnf all wrap lower-level tools (dpkg, rpm). The high-level package managers handle dependencies and repositories; the low-level tools handle the actual package database.

Gotchas

  • apt upgrade upgrades installed packages; apt dist-upgrade (or full-upgrade) also handles dependency changes.
  • yum is a Python 2 wrapper that was replaced by dnf on RHEL 8+ — yum on RHEL 8 is an alias for dnf.
  • apt on Debian does not add contrib and non-free repos by default — many packages require editing /etc/apt/sources.list.
  • Mixing package manager commands with pip/npm-installed binaries can cause PATH shadowing confusion.

Revisions (0)

No revisions yet.