Package Managers Reference

Quick Lookup Table

Task RHEL/Fedora (dnf) Arch (pacman) Debian/Ubuntu (apt)

Install

dnf install pkg

pacman -S pkg

apt install pkg

Remove

dnf remove pkg

pacman -R pkg

apt remove pkg

Remove + deps

dnf autoremove pkg

pacman -Rs pkg

apt autoremove pkg

Remove + config

dnf remove pkg + manual

pacman -Rns pkg

apt purge pkg

Update repos

dnf check-update

pacman -Sy

apt update

Upgrade all

dnf upgrade

pacman -Syu

apt upgrade

Full upgrade

dnf distro-sync

pacman -Syu

apt full-upgrade

Search

dnf search keyword

pacman -Ss keyword

apt search keyword

Info

dnf info pkg

pacman -Si pkg

apt show pkg

List installed

dnf list installed

pacman -Q

apt list --installed

List files

rpm -ql pkg

pacman -Ql pkg

dpkg -L pkg

Find owner

rpm -qf /path/file

pacman -Qo /path/file

dpkg -S /path/file

Clean cache

dnf clean all

pacman -Sc

apt clean

List repos

dnf repolist

cat /etc/pacman.conf

apt policy

Download only

dnf download pkg

pacman -Sw pkg

apt download pkg

DNF (RHEL/Fedora)

Installation

# Single package
sudo dnf install nginx

# Multiple packages
sudo dnf install nginx php-fpm mariadb

# Specific version
sudo dnf install nginx-1.24.0

# From local RPM
sudo dnf install ./package.rpm

# Group install
sudo dnf groupinstall "Development Tools"

Removal

# Remove package
sudo dnf remove nginx

# Remove with unused dependencies
sudo dnf autoremove

# Remove specific with autoremove
sudo dnf remove nginx && sudo dnf autoremove

Updates

# Check for updates
dnf check-update

# Upgrade all packages
sudo dnf upgrade

# Upgrade specific package
sudo dnf upgrade nginx

# Security updates only (RHEL/CentOS)
sudo dnf upgrade --security

# Rollback transaction
sudo dnf history
sudo dnf history undo 15

Search & Info

# Search by name
dnf search nginx

# Search in descriptions
dnf search all nginx

# Package info
dnf info nginx

# List available versions
dnf list nginx --showduplicates

# List installed packages
dnf list installed
dnf list installed "python3*"

# Provides (what package has this file)
dnf provides /usr/bin/python3

Repositories

# List repos
dnf repolist
dnf repolist all

# Enable/disable repo
sudo dnf config-manager --enable repo-name
sudo dnf config-manager --disable repo-name

# Add repo
sudo dnf config-manager --add-repo https://example.com/repo.repo

# Enable EPEL (RHEL/Rocky/Alma)
sudo dnf install epel-release

# Enable RPM Fusion (Fedora)
sudo dnf install \
  https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm \
  https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm

Package History

# View transaction history
dnf history

# View specific transaction
dnf history info 15

# Undo transaction
sudo dnf history undo 15

# Redo transaction
sudo dnf history redo 15

Module Streams (RHEL 8+)

# List modules
dnf module list

# List module streams
dnf module list nodejs

# Enable stream
sudo dnf module enable nodejs:18

# Install module
sudo dnf module install nodejs:18

# Reset module (to change streams)
sudo dnf module reset nodejs

Pacman (Arch Linux)

Installation

# Single package
sudo pacman -S nginx

# Multiple packages
sudo pacman -S nginx php-fpm mariadb

# Sync repos and install
sudo pacman -Sy nginx

# Install from local file
sudo pacman -U ./package.pkg.tar.zst

# Answer yes to all
sudo pacman -S --noconfirm nginx

Removal

# Remove package only
sudo pacman -R nginx

# Remove with dependencies
sudo pacman -Rs nginx

# Remove with deps and config
sudo pacman -Rns nginx

# Remove orphaned packages
sudo pacman -Rns $(pacman -Qdtq)

Updates

# Full system upgrade (ALWAYS use this)
sudo pacman -Syu

# Force database refresh
sudo pacman -Syyu

# Download only
sudo pacman -Syuw
Never run pacman -Sy package (partial upgrade). Always use -Syu.

Search & Info

# Search repos
pacman -Ss nginx

# Search installed
pacman -Qs nginx

# Package info (repos)
pacman -Si nginx

# Package info (installed)
pacman -Qi nginx

# List files in package
pacman -Ql nginx

# Find package owning file
pacman -Qo /usr/bin/nginx

# List explicitly installed
pacman -Qe

# List orphans
pacman -Qdt

Cache Management

# Clean old packages (keep 3 versions)
sudo paccache -r

# Clean all cached packages
sudo pacman -Sc

# Clean everything (including installed)
sudo pacman -Scc

AUR (yay/paru)

# Install yay
cd /tmp
git clone https://aur.archlinux.org/yay.git
cd yay && makepkg -si

# Usage (same as pacman)
yay -S package-name
yay -Syu              # Update including AUR
yay -Ss search-term

Mirrorlist

# Edit mirrors
sudo vim /etc/pacman.d/mirrorlist

# Use reflector to optimize
sudo reflector --country US --age 12 --sort rate --save /etc/pacman.d/mirrorlist

APT (Debian/Ubuntu)

Installation

# Update repos first (important!)
sudo apt update

# Single package
sudo apt install nginx

# Multiple packages
sudo apt install nginx php-fpm mariadb-server

# Specific version
sudo apt install nginx=1.24.0-1

# From local deb
sudo apt install ./package.deb
# or
sudo dpkg -i package.deb && sudo apt install -f

Removal

# Remove package
sudo apt remove nginx

# Remove with config files
sudo apt purge nginx

# Remove unused dependencies
sudo apt autoremove

# Remove + purge + autoremove
sudo apt purge nginx && sudo apt autoremove

Updates

# Update package lists (metadata only)
sudo apt update

# Upgrade installed packages
sudo apt upgrade

# Full upgrade (handles dependency changes)
sudo apt full-upgrade

# Distribution upgrade
sudo apt dist-upgrade

Search & Info

# Search
apt search nginx

# Package info
apt show nginx

# Policy (versions and repos)
apt policy nginx

# List installed
apt list --installed

# List upgradable
apt list --upgradable

# List files (installed)
dpkg -L nginx

# Find package owning file
dpkg -S /usr/sbin/nginx

Repositories

# List repos
cat /etc/apt/sources.list
ls /etc/apt/sources.list.d/

# Add PPA (Ubuntu)
sudo add-apt-repository ppa:ondrej/php
sudo apt update

# Add repo manually
echo "deb https://example.com/repo stable main" | \
  sudo tee /etc/apt/sources.list.d/example.list

# Add GPG key
curl -fsSL https://example.com/gpg.key | \
  sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/example.gpg

Hold Packages

# Prevent package from upgrading
sudo apt-mark hold nginx

# Remove hold
sudo apt-mark unhold nginx

# Show held packages
apt-mark showhold

RPM Commands (Low Level)

# Query all installed
rpm -qa

# Query specific package
rpm -q nginx

# Query package info
rpm -qi nginx

# List files in package
rpm -ql nginx

# Find package owning file
rpm -qf /usr/sbin/nginx

# Verify package
rpm -V nginx

# Install RPM directly
sudo rpm -ivh package.rpm

# Upgrade RPM
sudo rpm -Uvh package.rpm

# Remove RPM (use dnf instead)
sudo rpm -e nginx

DPKG Commands (Low Level)

# List all installed
dpkg -l

# Query package
dpkg -s nginx

# List files
dpkg -L nginx

# Find owner
dpkg -S /usr/sbin/nginx

# Install deb directly
sudo dpkg -i package.deb

# Fix broken dependencies after dpkg
sudo apt install -f

# Remove
sudo dpkg -r nginx

# Purge (with config)
sudo dpkg -P nginx

# Reconfigure package
sudo dpkg-reconfigure nginx

Finding Equivalent Packages

Same Package, Different Names

Purpose RHEL/Fedora Arch Debian/Ubuntu

Apache

httpd

apache

apache2

Development tools

@development / gcc

base-devel

build-essential

Python 3

python3

python

python3

Vim

vim-enhanced

vim

vim

Network tools

net-tools

net-tools

net-tools

Cron

cronie

cronie

cron

Quick Reference Card

# === Install ===
dnf install pkg          # RHEL/Fedora
pacman -S pkg            # Arch
apt install pkg          # Debian/Ubuntu

# === Remove ===
dnf remove pkg           # RHEL/Fedora
pacman -Rns pkg          # Arch (with deps+config)
apt purge pkg            # Debian/Ubuntu (with config)

# === Update Everything ===
dnf upgrade              # RHEL/Fedora
pacman -Syu              # Arch
apt update && apt upgrade  # Debian/Ubuntu

# === Search ===
dnf search term          # RHEL/Fedora
pacman -Ss term          # Arch
apt search term          # Debian/Ubuntu

# === What package owns file? ===
rpm -qf /path/to/file    # RHEL/Fedora
pacman -Qo /path/to/file # Arch
dpkg -S /path/to/file    # Debian/Ubuntu

# === List files in package ===
rpm -ql pkg              # RHEL/Fedora
pacman -Ql pkg           # Arch
dpkg -L pkg              # Debian/Ubuntu