Skip to content
PHASE 07Intermediate1 week

Package Management

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

The Mission

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.

Core concepts
  • 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.

apt and dpkg commands
  • sudo apt updateRefresh the package index from all repos
  • sudo apt upgradeUpgrade 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 autoremoveRemove packages no longer needed as dependencies
  • apt search [keyword]Search available packages
  • apt show [package]Show detailed info about a package
  • dpkg -lList 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
The Challenge6 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.

The Log
course-notes/phase-7-packages/
  • package-management-reference.md
    Every apt and dpkg command, what it does, when to use it.
  • repos-explained.md
    Your sources list breakdown, what each repo is, what PPAs are.
  • challenge-notes.md
    Output and notes from each challenge, including the broken dependency experiment.
Resources
All phases