Understanding Linux Package Management and Repositories

One of the biggest advantages of Linux - and Ubuntu in particular - is its powerful package management system. Instead of manually hunting for installers online, you can install, update, and secure software with just a few commands. At first, I found the terms confusing: apt, dpkg, sources.list, repositories, GPG keys… it felt like a lot to take in. But as I dug deeper, the picture became much clearer. This post documents my learning journey, and I hope it helps others who are just starting to explore the Linux ecosystem.
Packages vs Applications
A package in Linux is not the same thing as a single file or program. Instead, it’s a bundle of everything needed to install and run an application: binaries, libraries, configuration files, metadata, and sometimes even scripts.
For example, installing a text editor like nano isn’t just about copying one binary into your system. The package may contain dependencies or additional resources that ensure it runs smoothly in your environment.
dpkg vs apt
Early on, I discovered there are two major tools involved:
dpkg → the low-level tool. It installs a
.deb
file that you already have on your system. Something like dealing with a single box of software. That.deb
file could come from a vendor’s website, or it could be the same file APT downloads for you automatically from a repository. It won’t automatically fetch dependencies for you.apt → the higher-level package manager. Apt not only installs packages but also resolves dependencies, downloads updates, and communicates with repositories. Think of it as having a package catalog and a delivery service built in.
So while dpkg
works with one file at a time, apt
works with entire repositories.
What are Repositories?
A repository (repo) is essentially a server hosting lots of .deb
packages. Apt knows where to look for packages because of configuration files stored in /etc/apt/sources.list
and /etc/apt/sources.list.d/
.
Each line in these files tells apt:
The type (
deb
for binary packages,deb-src
for source code).The URL where packages live.
The Ubuntu release name (e.g.,
jammy
,bionic
).The section (e.g.,
main
,universe
,restricted
,multiverse
).
Canonical (Ubuntu’s parent company) maintains the official repos:
main → officially supported, open source.
universe → community maintained, open source.
restricted → proprietary drivers.
multiverse → software that’s not open source or has licensing restrictions.
Vendor and Third-Party Repos
Not all software is packaged directly by Canonical. Developers or companies (the vendors) often host their own repositories, especially when:
They want to release updates faster than Ubuntu’s cycle.
Their software is proprietary (e.g., Sublime Text, Google Chrome).
Adding these is a two-step process:
Trust the repository by importing its GPG key. This cryptographic signature ensures packages really come from the vendor and haven’t been tampered with.
Tell apt where to find it by creating a new
.list
file in/etc/apt/sources.list.d/
.
For example, adding Sublime Text’s repo might look like:
wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -
echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
sudo apt update
sudo apt install sublime-text
Here, stable
refers to the channel inside their repository, similar to how Ubuntu uses main
or universe
.
PPAs: Community Repos on Launchpad
Ubuntu also has PPAs (Personal Package Archives) hosted on Launchpad. These are community-maintained repos. Unlike Canonical’s repos, PPAs are not heavily moderated — meaning they could contain anything from safe open-source builds to potentially unsafe binaries.
That’s why it’s important to:
Only add PPAs linked from a project’s official site.
Verify their GPG key fingerprint.
Remember that while most PPAs are open source, some could distribute closed binaries.
Removing Packages and Repositories
To remove a package:
sudo apt remove <package-name>
To remove a repository:
Delete its
.list
file from/etc/apt/sources.list.d/
, orUse:
sudo add-apt-repository --remove ppa:<name>
Even if you remove the repo, the package you installed remains. You just won’t get updates for it anymore.
Key Takeaways
dpkg = installs a
.deb
you already downloaded.apt = fetches from repos, resolves dependencies, keeps your system updated.
Repositories = servers hosting packages. Canonical provides main repos, but vendors and the community provide others.
GPG keys = trust mechanism. They prove packages really come from the repo you added.
PPAs = convenient, but less moderated — use with caution.
Removing a repo ≠ uninstalling the program; it just loses updates.
Reflection
When I started, I thought Linux software management was just about typing apt install
. Now I understand it’s backed by a sophisticated system of trust, cryptography, and distributed repositories. This gives Linux both flexibility (vendors can provide their own repos) and security (packages must be signed).
The biggest lesson: always know where your packages come from. Adding a repo is giving it permission to feed software into your system. It’s as much about trust as it is about convenience.
Subscribe to my newsletter
Read articles from Andrii R directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
