Package Management – Linux Teaching Plan

Duration: 2 hours (≈ 12 min per command). Target audience: Novice Linux users who need to learn how to install, upgrade and remove software on common distributions.

Learning Objectives

  1. Identify the role of package managers and repository metadata.
  2. Install, upgrade and remove software with apt/dpkg (Debian/Ubuntu).
  3. Install, upgrade and remove software with yum/dnf (CentOS/RHEL/Fedora).
  4. Install, upgrade and remove software with pacman (Arch/Manjaro).
  5. Work with snap and flatpak for universal packaging.
  6. Manipulate RPM packages directly with rpm.
  7. Use zypper on openSUSE and SUSE Linux Enterprise.
  8. Inspect package database with dpkg (Debian).
  9. Query repository metadata and package information.
  10. Automate a simple package‑management workflow in a script.

Schedule & Topics

  1. Intro & terminology (5 min)
  2. APT/Dpkg – Debian/Ubuntu (10 min)
  3. YUM – CentOS 7 (10 min)
  4. DNF – Fedora 33 (10 min)
  5. Pacman – Arch/Manjaro (10 min)
  6. Zypper – openSUSE (10 min)
  7. Snap – Universal packages (10 min)
  8. Flatpak – Universal packages (10 min)
  9. RPM – low‑level package handling (10 min)
  10. Mini‑project: “Create a reproducible install script for a 3‑tier web stack” (15 min)
  11. Q&A & wrap‑up (5 min)

Command Topics & Hands‑On Exercises

1. apt update – Refresh Repository Metadata

sudo apt update

2. apt install – Install a Package

sudo apt install -y htop
apt show htop

3. apt remove – Uninstall a Package

sudo apt remove -y htop
apt list --installed | grep htop

4. yum update – Refresh Repos (CentOS 7)

sudo yum check-update
sudo yum update -y

5. dnf install – Install a Package (Fedora 33)

sudo dnf install -y tree
dnf info tree

6. pacman -S – Install a Package (Arch/Manjaro)

sudo pacman -Sy
sudo pacman -S --noconfirm exa
pacman -Qi exa

7. zypper install – Install a Package (openSUSE/SUSE)

sudo zypper refresh
sudo zypper install -y vim
zypper se vim

8. snap install – Universal Snap Packages

sudo snap install hello-world
snap list hello-world

9. flatpak install – Universal Flatpak Packages

sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
sudo flatpak install -y flathub org.gnome.Evince
flatpak list

10. rpm -i – Low‑Level Package Install (Red Hat family)

sudo yum install -y rpm-build   
curl -O https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo rpm -ivh epel-release-latest-7.noarch.rpm
sudo rpm -qi epel-release

11. dpkg -i – Low‑Level Debian Package Install

curl -O https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.34.1.deb
sudo dpkg -i git-2.34.1.deb
sudo apt-get install -f   

12. pacman -R – Remove a Package (Arch/Manjaro)

sudo pacman -Rns exa
pacman -Q | grep exa

13. snap remove – Uninstall a Snap

sudo snap remove hello-world
snap list | grep hello-world

14. flatpak uninstall – Uninstall a Flatpak

sudo flatpak uninstall -y org.gnome.Evince
flatpak list | grep Evince

15. dnf upgrade-minimal – Smart Upgrade (Fedora 33)

sudo dnf upgrade-minimal -y

Mini‑Project: “Fully Automated Web App Stack Installer”

Each student will create a single shell script that:

  1. Detects the host distribution (Ubuntu/Debian, CentOS/RHEL, Fedora, Arch, openSUSE, SUSE, or generic RPM).
  2. Updates the package database using the appropriate command (`apt update`, `yum check-update`, `dnf update`, `pacman -Sy`, `zypper refresh`, `dnf check-update`).
  3. Installs the following components automatically:
  4. Configures the web server to serve a simple “Hello World” page.
  5. Starts the services with `systemctl start` and ensures they are enabled on boot.
  6. Installs a minimal firewall rule set (using `iptables` or `nftables`) to expose only HTTP/HTTPS and SSH.
  7. Writes a status log file `/var/log/webstack-install.log` capturing timestamps, package versions, and any error messages.
  8. At the end, the script should be idempotent: running it again should detect that everything is already installed and skip re‑installations.

Students will run the script on a fresh VM and present the command sequence, the output logs, and a short video of the web stack in action.

Assessment

  1. Quick quiz (5 min) – 5 true/false questions about the differences between apt, yum, pacman, snap, etc.
  2. Hands‑on test (10 min) – each student installs a small package using the three package managers of their choice and verifies the install with a command from the list.
  3. Project walk‑through (10 min) – peer review of the installer script. The instructor asks questions about each section and the students answer.

Resources

Feel free to tailor the mini‑project to the specific learning goals of your class – e.g., swap PostgreSQL for MySQL, or add a Docker container to the stack. The key is that students gain confidence in using the most common Linux package managers, understand their differences, and can automate a complete software deployment cycle.