Linux Package Managers

On Linux, you rarely download a .exe or .dmg installer. Instead, you use a package manager — a tool that downloads, installs, upgrades, and removes software while automatically handling all dependencies. It's like an app store, but for your entire system.

What is a Package?

A package is a compressed archive containing: the program's binary files, configuration files, documentation, and metadata (name, version, description, dependencies). Two major formats:

FormatExtensionUsed byLow-level tool
Debian.debUbuntu, Debian, Mintdpkg
RPM.rpmFedora, RHEL, openSUSErpm
Pacman.pkg.tar.zstArch, Manjaropacman

Repositories — Where Packages Come From

Where does apt actually download software from? From repositories — servers maintained by your distribution. Ubuntu's official repos are at archive.ubuntu.com. The list of repos your system knows about lives in /etc/apt/sources.list and /etc/apt/sources.list.d/.
# View configured repos (Ubuntu/Debian) cat /etc/apt/sources.list # Add a third-party PPA (Ubuntu) sudo add-apt-repository ppa:deadsnakes/ppa # View repo list (Fedora) dnf repolist

APT — Debian and Ubuntu

# Update local package index (always do this first) sudo apt update # Upgrade all installed packages sudo apt upgrade # Install a package sudo apt install nginx # Remove a package (keep config files) sudo apt remove nginx # Remove package AND config files sudo apt purge nginx # Search for a package apt search python3 # Show package info apt show nginx # List installed packages dpkg -l

apt update doesn't install anything — it just refreshes the local database of what versions are available. Always run it before installing.

DNF (Fedora) and Pacman (Arch)

# DNF (Fedora/RHEL) sudo dnf update # update all packages sudo dnf install nginx # install sudo dnf remove nginx # remove dnf search nginx # search # Pacman (Arch Linux) sudo pacman -Syu # sync + update all sudo pacman -S nginx # install sudo pacman -R nginx # remove sudo pacman -Ss nginx # search

Dependency Resolution

What happens when a package needs another package? The package manager reads each package's dependency list and automatically installs everything needed. If you install a web app that needs Python, nginx, and PostgreSQL, the package manager figures out the full dependency tree and installs them all in the right order.

This is why package managers are so powerful compared to manual installs — you never end up with "DLL hell" where software can't find the libraries it needs.

Universal Formats: Snap, Flatpak, AppImage

These newer formats bundle all dependencies into one package, working across distributions:

FormatCompanySandboxed?Best for
SnapCanonical (Ubuntu)YesDesktop apps, servers
FlatpakCommunityYesDesktop GUI apps
AppImageCommunityNoPortable, no install needed

Frequently Asked Questions

What will I learn here?

This page covers the core concepts and techniques you need to understand the topic and progress confidently to the next lesson.

How should I use this page?

Start with the overview, then follow the section links to deepen your understanding. Use the table of contents on the right to jump to specific sections.

What should I read next?

Use the navigation below to continue to the next lesson or explore related topics.