Skip to content
PHASE 07 Intermediate 1 week

Package Management

Objective: Understand how Linux installs, updates, and removes software.

Every service you've installed used apt. But do you understand what happened? Where did the software come from? How does your system know what's available? What happens when packages conflict?

Instead of downloading .exe files from random websites, Linux pulls software from curated repositories. The package manager handles downloading, installing, dependency resolution, and updates.

  • Repositories : Servers that host software packages. Ubuntu has: main (officially supported), universe (community), restricted (proprietary), multiverse (non-free).

  • Dependencies : Software that other software needs to run. apt resolves these automatically.

  • PPAs : Personal Package Archives. Third-party repos. Use with caution.

  • Updating vs. Upgrading : apt update refreshes the package list. apt upgrade installs newer versions.

sudo apt update Refresh the package index from all repos
sudo apt upgrade Upgrade all installed packages to latest available
sudo apt install [package] Install a package
sudo apt remove [package] Remove (keeps config files)
sudo apt purge [package] Remove package and its config files
sudo apt autoremove Remove packages no longer needed as dependencies
apt search [keyword] Search available packages
apt show [package] Show detailed info about a package
dpkg -l List all installed packages
dpkg -L [package] List all files installed by a package
apt-cache policy [package] Show available versions and which repo they come from
6 tasks
  1. 1

    Run sudo apt update && sudo apt upgrade. Document what happened. How many packages were upgraded? Were any held back? Why?

  2. 2

    Install a package you haven't used (e.g., tree, ncdu, tmux). Use dpkg -L to see every file it installed. Where did the binary end up? Where are the config files?

  3. 3

    Remove with apt remove. Check if config files remain. Remove them with apt purge. Explain the difference.

  4. 4

    Run apt-cache policy nginx. What version is available? Which repo is it coming from?

  5. 5

    View /etc/apt/sources.list. Document what repos your system pulls from. Explain what main, universe, and restricted mean.

  6. 6

    Simulate a broken dependency: install a package, manually remove a dependency with dpkg --remove. See what happens. Fix with sudo apt --fix-broken install.