Package Managers Introduction

Installing software on Linux isn't like Windows where you download .exe files from random websites. Linux has package managers - centralized systems that handle everything.

The Problem with Manual Installation

Imagine installing software manually:

  1. Find the download link
  2. Download the file
  3. Extract it
  4. Figure out dependencies
  5. Install dependencies first
  6. Then install your software
  7. Hope nothing breaks

Now multiply that by 50 programs. And updates? Forget it.

Package Managers Solve Everything

A package manager:

  • Downloads software from trusted repositories
  • Handles all dependencies automatically
  • Updates everything with one command
  • Removes software cleanly
  • Verifies package integrity
Terminal
$# Instead of manual chaos:
$sudo apt install nginx
Reading package lists... Done The following NEW packages will be installed: nginx nginx-common nginx-core 0 upgraded, 3 newly installed, 0 to remove

One command. Dependencies handled. Done.

Different Distros, Different Managers

DistributionPackage ManagerPackage Format
Ubuntu/Debianapt.deb
Fedora/RHELdnf.rpm
CentOS (older)yum.rpm
Arch Linuxpacman.pkg.tar
Alpineapk.apk
openSUSEzypper.rpm

Same Concepts, Different Commands

They all do the same things: install, remove, update, search. The commands differ slightly, but once you know one, learning others is easy.

Quick Cross-Reference

Actionapt (Debian/Ubuntu)dnf (Fedora/RHEL)pacman (Arch)
Installapt install pkgdnf install pkgpacman -S pkg
Removeapt remove pkgdnf remove pkgpacman -R pkg
Update listapt updatednf check-updatepacman -Sy
Upgrade allapt upgradednf upgradepacman -Syu
Searchapt search pkgdnf search pkgpacman -Ss pkg

RHCSA Note

If you're preparing for RHCSA certification, focus on dnf (and legacy yum). Enterprise Linux (RHEL, CentOS, Rocky) uses RPM packages.

How Packages Work

A package is a compressed archive containing:

  • The software itself (binaries)
  • Configuration files
  • Documentation
  • Metadata (dependencies, version, description)
  • Installation scripts
Terminal
$# See what's in a package
$apt show nginx
Package: nginx Version: 1.18.0-6ubuntu14 Depends: nginx-core | nginx-full | nginx-light | nginx-extras Description: small, powerful, scalable web/proxy server

Repositories - Where Packages Live

Packages come from repositories (repos) - servers that host thousands of packages:

Terminal
$cat /etc/apt/sources.list
deb http://archive.ubuntu.com/ubuntu jammy main restricted deb http://archive.ubuntu.com/ubuntu jammy-updates main restricted deb http://archive.ubuntu.com/ubuntu jammy universe
  • main: Officially supported software
  • universe: Community-maintained
  • restricted: Proprietary drivers
  • multiverse: Software with legal restrictions

Stick to Official Repos

Official repositories are tested and secure. Random PPAs and third-party repos? Use with caution.

Knowledge Check

What does a package manager NOT do?

Key Takeaways

  • Package managers centralize software installation
  • They handle dependencies automatically
  • Different distros use different managers (apt, dnf, pacman)
  • Packages come from repositories
  • One command to install, one to update

Next: mastering apt commands on Debian/Ubuntu.