Chapter 4 · Repositories and Package Management·v1.0.0·Updated 7/6/2026·~11 min
What's changed: Initial version (topic 1.04, subtopics 1.04.1–1.04.4)
4.1Package Management with apt
Key points
Learn repository-based package management on Debian/Ubuntu: installing, updating, and removing with apt (apt-get, apt-cache, apt-file), finding which package contains a given file, and repository configuration in /etc/apt/sources.list.
Installing software on Linux is not "download and run"—you fetch packages from repositories and manage them with their dependencies. On Debian/Ubuntu the front door is apt, whose biggest value is automatic dependency resolution.
4.1.1Core apt operations
- Install with
apt install nginx; remove withapt remove nginx(apt purgealso deletes config); refresh the index withapt update(fetch latest repo metadata); upgrade packages withapt upgrade. - apt-get and apt-cache are the traditional lower-level tools (apt consolidates their common features for interactive use). Search/info:
apt-cache search keyword,apt-cache show pkg(orapt search,apt show). - Find which package provides a file with apt-file (
apt-file search /usr/bin/convert—covers packages not yet installed; needsapt-file update). - Repositories are defined in /etc/apt/sources.list (plus /etc/apt/sources.list.d/); indexes and packages come from the URLs listed there.
Continue reading — free sign-up
You're reading the free preview. Sign up free to read this section in full, plus every chapter (including 4+) and all questions.

