Knowledge

Linux package concepts

Install and update a program

Suppose you want to install a tool that fetches information from websites. A package manager can download the program and the other software it needs, keep a record of what it installed, and check for updates later. The exact tool and file format depend on the Linux distribution, so first learn which distribution the computer uses.

On Debian-based systems, sudo apt install curl requests installation of the curl package. sudo apt upgrade updates installed packages that have newer versions in configured repositories. Read the proposed changes before confirming them.

A software package is a bundle of program files and information that helps an operating system install, update, and remove them. It may include libraries, configuration templates, documentation, version details, dependency declarations, and setup or removal scripts. The .deb and .rpm names are different archive formats; they are not interchangeable even when they contain similar software.

Package tools keep a local database of what they installed. That record can tell you which version is present, which package owns a file, and what other software it needs. If a file is copied into the system by hand, the database may not know about it. Later queries and updates can only report on software the package tools track.

A repository is a source of package files and information about available versions. The information describes how packages depend on one another. A dependency means a package needs another package, or a compatible version of it, to provide some function. A package manager reads that information to choose what to install and plan the supporting changes.

The names of the tools refer to different jobs. On Debian-based systems, dpkg handles local Debian packages and the installed-package database. APT reads configured repositories and dependency information to plan larger operations. Fedora uses the RPM format; DNF manages repositories and dependencies around RPM packages. These tools are not used on every distribution, so check which system family you have before following installation directions.

On a Debian-based system, apt show curl reports package information from configured sources. dpkg -s curl reports the local installed-package record when one exists. dnf info curl asks DNF for information from its configured sources and metadata. Repository information and installed state can differ: a source may offer a newer version than the one on the computer, or the package may not be installed.

Installing a local archive with a lower-level tool may not download and resolve all required dependencies. A higher-level manager can often plan those steps using its configured metadata. Package relationships can include optional recommendations, conflicts, and version constraints along with required dependencies. Review the proposed transaction before confirming a removal or a change involving many packages.

Keep four things separate in your mind: the archive format, installed-state database, repository, and manager that works with them. Use the distribution's manager for updates and queries, and check that repository sources and signing keys are ones you intend to trust. A signature helps verify where a package came from only if the key and repository configuration are trustworthy.

Interactive exercises

Materials

Skillsets
Skillset Devops preview
image descriptionDevops
by Ajay Kumar
2004 users
Skillset Linux administrator preview
image descriptionLinux administrator
by Infinite Education
3080 users
Skillset Devops preview
image descriptionDevops
by Dio
3 users
Do you know that ...?
Any useful or interesting facts about the skill. Any peace of information would be useful