Module 7 · Package Management
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
The five ways apps get onto Linux
| Format | How to install | Best for | Equivalent |
|---|---|---|---|
| apt (deb) | sudo apt install app | System software | Windows Update |
| Snap | sudo snap install app | Universal apps, sandboxed | Microsoft Store |
| Flatpak | flatpak install app | Desktop apps, sandboxed | Microsoft Store |
| AppImage | Download, chmod +x, run | Portable apps | .exe portable |
| Wine | wine program.exe | Running Windows .exe files | Compatibility 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 update first — otherwise you'll install yesterday's version.&& 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.
"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.
"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.
"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.
"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
autoremove sweeps them out. Often frees a few hundred MB..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).autoclean, but if you reinstall something it'll have to download again.| 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 |
|---|---|---|
| main | Officially supported open-source software. The company behind Ubuntu (Canonical) keeps it patched and secure. | Highest — safe by default |
| universe | Community-maintained open-source software. Most apps you'll install end up coming from here. | High — the community looks after it |
| restricted | Closed-source drivers (NVIDIA and so on). You need these for some hardware to work properly. | Closed-source but checked over |
| multiverse | Software 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 catalogue | sudo apt update | sudo dnf check-update |
| Install a program | sudo apt install firefox | sudo dnf install firefox |
| Update everything | sudo apt upgrade | sudo dnf upgrade |
| Uninstall a program | sudo apt remove firefox | sudo dnf remove firefox |
| Search for a program | apt search keyword | dnf search keyword |
| See what's installed | apt list --installed | dnf list installed |
| Clear out leftover bits | sudo apt autoremove | sudo 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" licences | Use 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:
- Free Software (the Free Software Foundation, started in 1985 by Richard Stallman): the word "free" here means freedom, not "no money". The four freedoms are: use it, study it, change it, share it.
- Open Source (the Open Source Initiative, started in 1998): same software, sold differently — talks about the practical wins (peer review, faster bug fixes) rather than the philosophy.
- FOSS / FLOSS: umbrella words for both at once. FOSS = Free and Open Source Software. FLOSS = Free / Libre / Open Source Software (the extra "L" leans more toward the Free Software side).
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.