Module 7 · Package Management 45 min

No more hunting the web for .exe files, clicking Next-Next-Next through installers, unticking sneaky toolbars. apt is the Microsoft Store and Windows Update rolled into one — free, fast, and it actually works.

By the end of this module, you will:

  • Install, update, and remove software using apt
  • Update the full system with a single command sequence
  • Search for a package by name before installing
  • Explain the difference between apt, snap, and manual installation
  • Keep the system tidy with apt autoremove, autoclean, and clean
  • Identify the four Ubuntu repositories (main, universe, restricted, multiverse) and what a PPA is
  • Translate apt commands to dnf for use on Fedora systems
apt — the package manager
# Update the package list (like refreshing the Store catalogue)
$ sudo apt update

# Upgrade all installed software
$ sudo apt upgrade

# Install software
$ sudo apt install firefox vlc git neofetch

# Remove software (keeps config files)
$ sudo apt remove firefox

# Remove software AND config files
$ sudo apt purge firefox

# Search for software
$ apt search "video editor"

The five ways apps get onto Linux

Format How to install Best for Equivalent
apt (deb)sudo apt install appSystem softwareWindows Update
Snapsudo snap install appUniversal apps, sandboxedMicrosoft Store
Flatpakflatpak install appDesktop apps, sandboxedMicrosoft Store
AppImageDownload, chmod +x, runPortable apps.exe portable
Winewine program.exeRunning Windows .exe filesCompatibility layer

Your favourite Windows apps — what to use instead

Microsoft Office → LibreOffice (free, opens Word and Excel files) | Photoshop → GIMP or Krita | Notepad++ → Kate or VS Code | iTunes → Rhythmbox | WinRAR → already built in, no install needed | "Everything" search → the find command, or FSearch if you want clicks

apt update vs apt upgrade — they sound the same, they're not

These two commands always go together but do completely different jobs. Running the second one without the first is the most common mistake people make.

What each one actually does

apt updateRefreshes the shopping list. Downloads the newest catalogue — what's available, what version. Doesn't install anything, doesn't change anything. Like refreshing a web page to see today's prices.
apt upgradeActually installs the updates. Looks at the catalogue, compares it to what you've got, and upgrades anything that has a newer version. Always run apt update first — otherwise you'll install yesterday's version.
apt update && apt upgrade -yThe right sequence. The && means "only run the second bit if the first one worked". The -y answers "yes" to the confirmation prompt for you. Safe to leave running.

The four apt errors you'll see — and how to fix them

apt will fail on you sometimes. These are the four errors you'll bump into most often, and what each one means. You'll see at least two of them in your first month.

1
"E: Unable to locate package packagename"

The name's wrong, or that program isn't in the catalogue. First, run sudo apt update — your list might be old. Then check the spelling: apt search keyword finds the real name. On Fedora the same program might have a different name — try dnf search keyword.

2
"E: Could not get lock /var/lib/dpkg/lock"

apt is already running somewhere else (usually the automatic update service running in the background). Wait 2 or 3 minutes and try again. If it's still stuck, run sudo rm /var/lib/dpkg/lock-frontend and then sudo dpkg --configure -a.

3
"W: GPG error" or "NO_PUBKEY"

A repository's security key is missing or expired. This usually happens with third-party repositories you added yourself. Look up the program's official docs — they'll have the command to import the new key. Normal stuff; not a sign anything's broken.

4
"Dependency is not satisfiable"

The thing you're installing needs another thing that isn't in your catalogue. Almost always means you've downloaded a package built for a different Ubuntu version. Check you've got the right one — for Ubuntu 24.04 LTS (Noble Numbat) — and try again.

Honest talk about Wine

Wine lets some Windows programs run on Linux — not all of them. Simple stuff (older games, little utilities) usually works. Heavy work software (the full Microsoft Office desktop app, specialist accounting tools, most big company apps) usually doesn't. Wine tries its best, but there's no guarantee. For serious Windows software you actually need at work, run a Windows virtual machine — that's the proper fix, not Wine.

Cleaning up: autoremove and autoclean

After a few months of installing and updating, leftover bits pile up on your disk. These four commands keep things tidy. Run them every couple of weeks.

The four cleanup commands

sudo apt autoremoveRemoves leftover bits. When you install a program, apt also installs all the smaller bits it needs to work. When you uninstall the program, those smaller bits usually stay behind. autoremove sweeps them out. Often frees a few hundred MB.
sudo apt autocleanDeletes old downloads. apt keeps a copy of every .deb file it ever downloaded in /var/cache/apt/archives/. autoclean deletes the ones that are no longer in the catalogue (i.e. truly out of date).
sudo apt cleanDeletes ALL downloads. The big hammer — wipes the whole download cache. Frees more space than autoclean, but if you reinstall something it'll have to download again.
apt list --installed | grep keywordCheck what you've got. Quick way to see if a program is installed. The | grep keyword bit filters the long list down to the names you care about.

Where the programs actually come from — repositories

apt doesn't grab software from random websites. It only downloads from trusted online catalogues called repositories. Ubuntu comes with four official ones switched on, each with a different level of trust.

Repository What's inside How safe
mainOfficially supported open-source software. The company behind Ubuntu (Canonical) keeps it patched and secure.Highest — safe by default
universeCommunity-maintained open-source software. Most apps you'll install end up coming from here.High — the community looks after it
restrictedClosed-source drivers (NVIDIA and so on). You need these for some hardware to work properly.Closed-source but checked over
multiverseSoftware with awkward licensing rules — things like video codecs.Read the licence before installing

PPAs: extra catalogues you add yourself (be careful)

A PPA (Personal Package Archive) is an extra catalogue, made by one developer or a small group, that anyone can add to their Ubuntu. Useful when you want a newer version of an app than Ubuntu ships, or a program that isn't in any official catalogue at all. Add one with sudo add-apt-repository ppa:owner/name. Treat PPAs the way you treat browser extensions — only add ones from people you actually trust. A nasty PPA can install anything it likes with full admin powers. Always read the PPA's Launchpad page first.

On Fedora? Use dnf — here's the translation

Same idea as apt, different words. If your workplace put Fedora on your machine instead of Ubuntu, here's the side-by-side.

What you want to do On Ubuntu / Mint / Pop!_OS / Debian (apt) On Fedora (dnf)
Refresh the cataloguesudo apt updatesudo dnf check-update
Install a programsudo apt install firefoxsudo dnf install firefox
Update everythingsudo apt upgradesudo dnf upgrade
Uninstall a programsudo apt remove firefoxsudo dnf remove firefox
Search for a programapt search keyworddnf search keyword
See what's installedapt list --installeddnf list installed
Clear out leftover bitssudo apt autoremovesudo dnf autoremove

The idea is exactly the same — one tool to install, update and remove programs, all from trusted online catalogues. Only the spelling changes. Read any apt tutorial, swap apt for dnf, and it'll usually just work.

Quick word about licences — why "free" is actually free

Every program you install with apt comes with a licence — the rules for what you can do with it. On Windows, that licence is usually a 40-page End User Licence Agreement you scroll straight past. On Linux, almost every program is open source, and only a handful of licences do most of the work. You don't need to memorise them — but knowing the names helps when you land on a project's website and the legal bit isn't a wall of text any more.

Licence family What it actually says, plain English Things you've already used
GPL (GNU General Public Licence) — the original "copyleft"You can use it, change it and pass it on. But if you pass on a changed version, you have to share your changed source code too. That "share-alike" rule is what "copyleft" means.The Linux kernel itself · GNU coreutils (ls, cp, mv) · Bash · GIMP
MIT / BSD / Apache — the "do whatever" licencesUse it, change it, ship it inside a paid product — go wild. Just don't sue the people who wrote it. No "share back" rule.Most npm and Python packages · React · the LLVM compiler · curl
Creative Commons (CC0, CC-BY, CC-BY-SA …)Not for software — for art, writing, video and photos. Same kind of idea though: a few standard rules instead of "all rights reserved".Wikipedia text (CC-BY-SA) · This course's diagrams (CC-BY)

Four words you'll see thrown around:

Why this matters when you install something

Ubuntu's official catalogues are split into four parts — main, universe, restricted and multiverse (you saw these above). The split is mostly about licences. main and universe are pure open source. restricted and multiverse have closed-source bits in them — NVIDIA drivers, MP3 codecs, certain firmware. When something refuses to install by default, the licence is usually why. The fix is turning on multiverse with one command. So this isn't just trivia — it's the answer when an install fails for no obvious reason.