When you install a program on Linux, you usually do not download an installer from a website. Your distribution has already collected the software, built it, and published it in a form your system knows how to handle. This lesson explains that path.
Upstream and distributions
The people who write a program are called upstream. They publish source code, often as a Git repository or a compressed archive.
A distribution such as Debian, Ubuntu, Fedora or openSUSE takes that source code, compiles it, applies any changes it needs, and tests that it fits with everything else. The person or team doing this work is the package maintainer.
What a package contains
A package is a single archive file that holds:
- the files to install, such as programs, libraries and documentation
- metadata: name, version, architecture, description and a list of dependencies
- optional scripts that run before or after installation or removal
The two most common formats are .deb, used by Debian, Ubuntu and their relatives, and .rpm, used by Fedora, Red Hat Enterprise Linux, openSUSE and others. Some distributions use other formats. Arch Linux, for example, has its own.
A file name tells you a lot:
nano_7.2-1_amd64.deb
nano-7.2-3.fc39.x86_64.rpmBoth show the package name, the upstream version (7.2), the packager's release number and the CPU architecture. amd64 and x86_64 are two names for the same 64-bit PC architecture.
Why use packages
Your system keeps a database of installed packages. Because of it, you can ask which package a file came from, upgrade everything in one go, and remove a program cleanly. Copying files around by hand gives you none of that.
$ dpkg -S /usr/bin/ls
coreutils: /usr/bin/lsOn an RPM system, rpm -qf /usr/bin/ls answers the same question. The path to ask about can differ between releases: some older Debian and Ubuntu systems record this file as /bin/ls.
Other ways to ship software
Distribution packages are not the only option. Flatpak and Snap bundle an application with much of what it needs, so one build can run on many distributions. Language tools such as pip and npm install libraries for one programming language. You can also compile source code yourself.
These are useful, but each is updated by its own tool. Prefer your distribution's package when it is recent enough for your needs.
Try it
Find out which family your system belongs to, then see what owns your shell:
$ cat /etc/os-release
$ command -v bash
/usr/bin/bashPass that path to dpkg -S or rpm -qf. If dpkg -S reports no match for /usr/bin/bash, try /bin/bash. You can practise more in the packages, disk and FHS lab.
Check your understanding
Software Distribution
All 4 sections ยท no timer
Unlimited retries
Questions from every section are combined into one assessment. Answer them all correctly to complete the article.
Your completion saves in this browser. Sign in to sync it to your account.