Packages, repositories, and dependencies
On this page
You want one command, but the installer proposes another package too. Before agreeing, you need to know where both packages come from and why they belong in the same installation.
By the end, you can explain a package manager’s plan, separate its records from the files it installs, and recognize the trust decision behind a repository.
Before you start
Section titled “Before you start”Finish Practice: Users and Basic Permissions. Keep the B04 lab directory for the following lesson. This page changes nothing and needs no reset. The examples use Ubuntu’s APT package manager; other distributions use different tools.
Follow the request beyond one executable
Section titled “Follow the request beyond one executable”Suppose you choose sl, a small terminal animation program. You are asking for a package, an archive that carries software files and information about how to install them. A package can include an executable, documentation, libraries, configuration, and installation scripts. Some packages provide data or shared code rather than a command you launch directly.
APT works out what must be present for the requested package to work. A dependency is another package or capability that the package requires. In the Ubuntu lab, sl depends on the terminal library package libncurses6, among other requirements. A library supplies code that another program uses. APT checks which requirements are already satisfied before proposing additional installations.
That distinction explains why the number of dependencies is not the number of packages about to be added. An existing library can satisfy a requirement. A missing library needs an installation. A version requirement can instead require an update to an existing package. Read the proposed changes rather than assuming every installation adds exactly one thing.
Dependencies also explain why deleting an executable yourself is not a package removal. The manager still has its installation record, and the rest of the package may remain. Use the package manager to change managed software so its records and files stay consistent.
Find the configured source
Section titled “Find the configured source”A repository is a software source that publishes package archives and indexes describing them. Ubuntu configures repositories for its release and enabled components. APT searches those configured sources; it does not search every website for a program with a matching name.
The indexes contain metadata: information about packages, including names, versions, descriptions, dependencies, and archive checksums. APT keeps a local copy of this information. Refreshing that copy allows APT to discover available versions without installing all the software described there.
The local index and the installed package database answer different questions. The index describes what a source offers. The installed database records what this system has installed and its package state. APT plans dependency changes; the lower-level Debian tool dpkg unpacks and configures packages and maintains installation records.
In words, the request names sl. Metadata from a configured repository describes sl and its dependencies. Installation obtains the needed archives, updates package records, and places files on the system. Records are information about the installation; they are not the executable itself. The model omits already-satisfied dependencies, version selection, and installation scripts.
Separate a description from an installation
Section titled “Separate a description from an installation”A search result can describe a package that has never been installed. Reading that result does not put its executable in your command search path. Likewise, refreshing indexes can change which version APT offers while leaving the installed executable untouched.
Predict first: after refreshing repository indexes, should every listed application become runnable?
Compare with your prediction
No. The indexes are descriptions of available packages. An installation is a separate operation that changes package records and files. The next lesson verifies this distinction with an initially absent package.
Package records can include a list of paths supplied by an installed package. That makes it possible to ask which package owns a file or which files a package installed. It does not mean the manager owns every file you create while using the application. Your documents and preferences in your home directory generally remain your own data.
Removal has a similar boundary. Removing a system package normally removes its managed program files, while some package configuration may remain. Purging also removes package-managed configuration. Neither operation promises to erase the application’s files in your home directory. Later in this module, you will inspect the actual removal plan and verify the lab reset.
Decide whose packages you accept
Section titled “Decide whose packages you accept”Repository trust matters because installing a package can run installation scripts with administrative privileges. Choosing a source is therefore more than choosing a convenient download location. It authorizes software supplied through that source to change your system.
APT verifies signed repository release information, which authenticates indexes and their package checksums. This connects downloaded package data to a trusted repository signing key. It helps detect unauthorized changes between the publisher and your system. It does not prove that the publisher’s software has no bugs or that every action in its installation scripts is desirable.
Use the distribution’s configured repositories for this exercise. Adding a third-party source and its signing key expands the set of publishers you trust. Before doing that elsewhere, establish who controls the source, which release it supports, and how its updates are maintained. A recognizable package name alone establishes none of those facts.
Mistakes to recognize
Section titled “Mistakes to recognize”Treating a search result as proof of installation. It is evidence that an index describes a package. Check installed state separately before trying to use it.
Assuming an extra package is unrelated. Inspect the dependency summary. A library can be required even though you never launch it yourself. Conversely, a suggestion is not the same as a required dependency.
Bypassing a signature failure to complete a tutorial. Stop and investigate the source configuration and authentication problem. Disabling verification discards evidence about where the package data came from.
Try it yourself
Section titled “Try it yourself”Goal: Explain an installation plan to another learner. The plan requests a text tool, adds a required library, and obtains both from an enabled distribution repository. Identify the request, the dependency, the source, the metadata, and the installed files.
Hint
Separate information used to decide the plan from files that appear only after the installation.
Solution
The requested text tool is one package. The required library is a dependency package. The enabled repository publishes their archives and metadata. Names, versions, and dependency requirements are metadata; the tool’s executable and library files are installed files. Local package records describe their installation state. Repository authentication establishes a publisher relationship, not a guarantee of harmless code.
- A package carries files and installation information; a dependency supplies something it requires.
- APT plans changes using configured repositories and local package state.
- Repository indexes describe available software; installed records and installed files are separate.
- Trusting a repository permits its software to make privileged installation changes.
Next, APT everyday operations follows one package from search to verified removal.
Further reading
Section titled “Further reading”- On Ubuntu:
man apt,man dpkg, andman apt-secure. - Ubuntu manuals: APT, dpkg, and repository authentication.