Packages
Software components should be small,
and focused on doing one specific thing well.
A package is a logical unit of software.
The obvious example is a program, but libraries are packages, too.
Packages are distributed in either source-code or precompiled form;
to configure and compile source code into usable form
is to build it.
The purpose of this article is to orient the user to the package-centric
landscape of pragmatic open-source.
Open Source
The traditional UNIX package format is a compressed tarball, a file
ending in .tar.xz
, or .tar.gzip
.
One extracts such an archive with:
$ tar xf kernel-5.10.tar.xz
yielding a directory reflective of its original packager's.
The GNU GPL stipulates that licensed software be available in source-code
form; thus, one can always obtain the source code and build the software
for oneself. The GNU-way of building and installing their stuff is:
Note:
The ordinary user is not expected to build software from source.
$ cd package
$ ./configure
$ make
$ sudo make install
Each project uses its own language and build system;
the above commands assume C/C++ source built via
GNU's Autoconf.
Most packages include documentation
to build, install, and tinker.
See Also:
Building an OS from Source
Aside:
A new version of the documentation is released about every six months.
Linux From Scratch is
documentation describing how to build a working
GNU/Linux system entirely from source.
One obtains 88 different packages, and goes about configuring,
compiling and installing them by hand.
Open-source is all about choice, and for some,
Linux from Scratch is the only way to go.
However, building anything from source is time-consuming and labor-intensive.
In addition, security updates are left entirely to the user.
As a step towards speeding up this process,
we might note that both building and
installing are per-package specific. Hence,
we could maintain scripts describing
how to do these things, and let the computer do them for us.
Gentoo Linux
is an operating system built around this idea.
The mechanized instructions to build software are kept in
ebuild
's— Bash scripts— which
obtain source code, configure it, compile it and, ultimately, install it.
These are interpreted by the user's machine,
and executing them
results in a new package being installed.
The scheme is minimal, transparent and flexible, and Gentoo is all about
openness and choice.[1]
Compilation remains time-consuming: It can take over a day
to build a working system, but nonetheless begins to be
approachable by ordinary users.
See Also:
Binary Packages
Usually, packages are distributed in preconfigured and precompiled
form.
This yields a smaller archive, saves users the
time-consuming step of compilation, and allows the
complete automation of installation.
And software installation is fast!
The implication, however, is that each package is configured
for a particular operating system, and compiled for a
particular CPU architecture.
Among major distributions, the Slackware Project entertains the
oldest, and possibly simplest, binary packaging scheme.
By modern standards, it may be considered crude,
because it leaves dependency resolution to the user.[2]
It is easily dissected, though, and so represents a nice example
for us.
A Slackware package arrives to the user as a compressed tarball.
In this file there is a directory tree reflective of the
Slackware operating system, such as:
$ tree slackware-less-fake
.
├── install
│ ├── doinst.sh
│ └── slack-desc
└── usr
├── bin
│ └── less
├── doc
│ └── less
│ ├── COPYING
│ └── README
└── man
└── man1
└── less.1.gz
Note:
The install
directory is otherwise ignored.
To install the package, the archive is extracted and each file
is copied into its respective directory of the host operating system;
if a directory does not exist, it is created.
After these files are copied, the script
./install/doist.sh
is executed, if it exists.
...And that's it!
The installation utility is, in this case, either
installpkg
or pkgtools
.
It must be granted root privileges.
All major distributions deal in binary packages, and use similar
compressed-archives of "reflective directory trees,"
though each to their own taste.
By and large, however, the package is intended to be
an opaque data format, and we will not dissect it further.
See Also:
Package Managers
A package manager is a utility that obtains and installs
packages.
Package managers are distribution-specific, and serve
as users' interface to their respective repositories.
Whereas Slackware leaves dependency resolution to the user,
most modern package managers keep a dependency list in each package,
and resolve the list automatically.
To name a few:
Package managers are among the most powerful pieces of software
on GNU/Linux operating systems.
To update a machine utilizing Debian's packaging facilities,
for example, we simply,
$ sudo apt update
$ sudp apt upgrade
Searching for packages does not require superuser privileges:
$ apt search less
Each package contains a description of itself:
$ apt show less
And can be installed with:
$ sudo apt install less
See Also:
Distributions
and Distribution Models
A distribution is a project and community that
obtains open-source software, configures, compiles and assembles
it into useable packages, and makes the results
publicly available.
Along the way, they define overarching system practices, within
which packages will fit.
Aside:
Here we are adopting the view that distributions focus
primarily on package propagation, rather than operating systems.
This view is implemented very directly in Arch Linux.
For example, the package filesystem
creates the system's root directory tree,
and initializes its core configuration files.
Thus, the operating system is expressed as a collection of packages.
There are many successful methods of package distribution,
but they can be meaningfully divided into a few kinds.
The regular release model deals in discrete package sets:
Packages are first composed into a working whole,
then undergo some testing period. After the set is verfied to work
correctly, the collection is released to the public; at that point,
updates to packages are restricted to bug fixes and security updates.
Distributions following this model are known for their stability,
which comes at a cost: Do not expect new features to become available
within a particular release.
The release is then supported for some length of time—
"Long-Term Support" releases are often maintained for
five years.
Some distributions following the regular release model:
- Linux Mint
- openSUSE Leap
- Debian
- Slackware
- Fedora
- Ubuntu
The rolling release model dispenses with any
versioning scheme.
Instead, software is distributed in its latest form,
so that features and fixes become available
to users as they are released by developers.
The result is access to cutting-edge software—
and a constant stream of updates.
This strategy is growing in popularity,
especially among desktop users.
Examples:
- Arch
- openSUSE Tumbleweed
- Garuda Linux
Between the two is the "semi-rolling release" model,
best explained through example:
Solus Linux is an
up-and-coming distribution focusing on the home computing.
They publish package updates every Friday, which
forms their latest release.
See Also:
References
- About the Gentoo Linux Installation. About the Gentoo Linux Installation - Gentoo Wiki. (2015, January 1). https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/About.
- Hicks, A., Lumens, C., Cantrell, D., & Johnson, L. (2005). Chapter 18 Slackware Package Management. Slackware Package Management. https://www.slackbook.org/html/package-management.html.