Summary: This module provides an overview of packages and application packaging for Linux. It covers RPM and Dpkg format, as well as the Apt tool. It also discusses compiling a package from source.
Packages are groups of files which are used by the same program or subsystem. They are generally distributed in some archive format (such as zip or tar). A package management system is a system which allows such packages to be installed, removed, and configured as a unit.
There are several mechanisms for managing packages installed in a Linux system. By far the most common is RPM. This is a package format originally created by Redhat. Dpkg, the format used by Debian, is a distant second. Apt is a toolset for managing packages, including dependency resolution; while originally designed for Debian, it works with RPMs as well. Finally, it is possible to install packages by compiling them from source.
RPM is the Redhat Package Manager. While originally developed by Redhat, it is now also used by Suse, Mandrake, and several other distributions, and is by far the most prevalent. In addition to supporting package install and removal, it provides support for resolving dependencies on and conflicts with other packages.
Dpkg is the Debian package manager. Like RPM, it has support for dependency and conflict resolution. It also supports weaker dependencies (that is, a package can "suggest" or "recommend" another). Dpkg comes with a frontend, dselect, which automatically downloads packages on request, including dependencies. Dselect has been, to a degree, obsoleted by Apt.
An additional feature of Dpkg is support for debconf. Debconf is the Debian configuration manager. Debconf provides a centralized database of configuration settings for a given system. This database can be used to allow for a non-interactive install. It also provides a unified interface for changing configuration settings.
Apt is a frontend for package management systems.
Originally developed to run with Dpkg, it has been
ported to work with RPM as well. Apt can be used to
query or search the package database (using the
apt-cache tool) or to install or
remove a package (using the
apt-get tool). One of the
biggest draws of Apt is the command apt-get
install package, which downloads, installs,
and configures the package and all dependencies.
However, Apt has another powerful feature as well,
upgrading. Running the command apt-get
upgrade will automatically download and
install the latest version of all out-of-date
packages. apt-get dist-upgrade
goes one further, allowing one to upgrade entire
releases (for instance, upgrade from Debian 2.2 to
Debian 3.0).
For complete control over what is installed on your machine, the only option is to compile applications by hand. This may also be necessary if the application you want to install is not yet being distributed in your distribution. There are some packages which are illegal to distribute in binary form, but legal in source code form.
Source packages tend to be released as
.tar.gz files. These are
compressed tar archives. They can be expanded with
the command tar xzvf file.tar.gz.
Most such packages have a README or INSTALL file at
the top level which describes how to compile and
install the package.
It is not possible to cover every possible method for
compiling a program; we are covering the most
straightforward, increasing common method, called
autoconf. The package likely uses this method if
there is a configure script at
the top level. To compile the package, first run this
script. Then run make. Then as
root, run make install. In the
absence of errors, this will result in the application
being installed as desired in the package's default
location (generally under
/usr/local). This and other
compile settings can generally be adjusted by passing
options to the configure script (the
--help option will list all
available options).