A repository in Debian is simply a server (or set of servers) that hosts packages your system can download and install.
A Debian repository contains .deb packages and metadata indexes: lists of available packages, versions, dependencies and signatures: cryptographic verification to ensure authenticity.
On Debian-based systems apt and dpkg are both package management tools, but they operate at different levels:
apt modifies system-wide software, so it requires administrative privileges.
dpkg (Debian Package Manager)
low-level tool that directly installs .deb files on your system.
Example usage:
Install a local package:
sudo dpkg -i package.deb
Remove a package:
sudo dpkg -r package_name
List installed packages:
dpkg -l
Show files installed by a package:
dpkg -L package_name
apt (Advanced Package Tool)
high-level tool. It is a frontend (wrapper) around dpkg + repository system.
apt is the modern, user-friendly interface designed for humans to use interactively in the terminal. apt-get is a low-level, stable interface primarily recommended for scripts and automation because its behavior and output remain consistent across versions.
Example usage:
Install software:
sudo apt install firefox
Remove software:
sudo apt remove firefox
apt update
This does NOT install or upgrade anything. It only refreshes your package list from repositories.
- Updates your local database (in
/var/lib/apt/lists/)
sudo apt update
Now your system now knows newer versions exist. Nothing is installed yet.
apt upgrade
This actually installs newer versions of installed packages. It compares installed packages vs repository versions
- Does NOT remove packages
- Does NOT install new required dependencies if that would require removals
sudo apt upgrade
apt full-upgrade
Updates all packages like upgrade BUT also installs new dependencies if needed, removes conflicting or obsolete packages
Upgrade everything even if system structure must change. Neither command upgrades your Linux distribution version. They only upgrade packages within the same release.
sudo apt full-upgrade
or older name:
sudo apt dist-upgrade
Where repositories are configured
Main file:
/etc/apt/sources.list
Optional additional files:
/etc/apt/sources.list.d/*.list
Example:
deb http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
debfor binary packages (deb-srcfor source)- URL for repository server
bookwormDebian release (Debian 12)
Sections:
main
- Fully free and open-source software
- Meets Debian Free Software Guidelines
- Officially supported
contrib
- Free software, but depends on non-free components
- Example: an open-source tool that needs proprietary firmware
non-free
- Proprietary software or firmware
- Not fully open-source
non-free-firmware
- Introduced in newer Debian versions
- proprietary, low-level software required by hardware components, which does not provide its source code or allow modification
By default, Debian may only enable
maindue to philosophical and legal reasons