One of the most important feature while choosing Linux distribution is its packaging system. Packages and Linux distribution keeps releasing frequently and to keep up with this blizzard of software we need good tools for package management.
Package Management is a way of installing and maintaining software on the system. In the early days, one had to compile source code to install the software. Although, nothing wrong with compiling sources, these days we can install packages from their Linux distributor.
Different distribution of Linux use a different packaging system and package intended for one distribution is not compatible with another distribution. Broadly, distribution falls into one of the two camps of packaging.
- Debian .deb
- Red Hat .rpm
Unlike distribution found in proprietary software industry usually entails buying a pieces of installation media such as “install disk” or visiting vendor’s website and downloading the product and installing, mostly Linux application will be provided by the distribution vendor in the form of package files and rest will be available in source code form that can be installed manually.
In Linux, the package file is the basic unit of software. A packages file is a compressed collection of files that comprise the software packages. Additionally, it includes metadata about the packages. These packages are created by the developer know as package maintainer. The package maintainer gets the software in source code form from the upstream provider (the author of the program), compiles it, and creates the package metadata and any necessary installation scripts. Often, the package maintainer will apply modifications to the original source code to improve the program’s integration with the other parts of the Linux distribution.
Those packages are made available to the user of distribution in central repository. Such repositories include many thousands of packages, each specially built and maintained for the distribution.
Programs are seldom “stand-alone”; rather, they rely on the presence of other software components to get their work done. Common activities, such as input/output, for example, are handled by routines shared by many programs. These routines are stored in shared libraries, which provide essential services to more than one program. If a package requires a shared resource such as a shared library, it is said to have a dependency. Modern package management systems all provide some method of dependency resolution to ensure that when a package is installed, all of its dependencies are installed, too.
Package management systems usually consist of two types of tools. • Low-level tools that handle tasks such as installing and removing package files • High-level tools that perform metadata searching and dependency resolution
Here is the package search command for two main distribution.
|apt-cache search search_string|
|Red hat||yum search search_string|
High-level tools permit a package to be downloaded from a repository and installed with full dependency resolution
|apt-get install package_name|
|Red hat||yum install package_name|
If a package file has been downloaded from a source other than a repository, it can be installed directly (though without dependency resolution) using a low-level tool.
|Debian||dpkg -i package_file|
|Red hat||rpm -i package_file|
Because this technique uses the low-level rpm program to perform the installation, no
dependency resolution is performed. If rpm discovers a missing dependency, rpm will exit with an error. Also, it is similar for dpkg.
Packages can be uninstalled using either the high-level or low-level tools.
|Debian||apt-get remove package_name|
|Red hat||yum erase package_name|
The most common package management task is keeping the system up-to-date with the latest versions of packages. The high-level tools can perform this vital task in a single step
|Debian||apt-get update; apt-get upgrade|
|Red hat||yum update|
|Debian||dpkg -i package_file|
|Red hat||rpm -U package_file|
dpkg does not have a specific option for upgrading a package versus installing one as
|Red hat||rpm -rq|
|Debian||dpkg -s package_name|
|Red hat||rpm -q package_name|
|Debian||apt-cache show package_name|
|Red hat||yum info package_name|
To determine what package is responsible for the installation of a particular file.
|Debian||dpkg -S file_name|
|Red hat||rpm -qf file_name|
This series of posts document a high-level process to use when planning a modern web application, from project organization, collaboration considerations and tooling choices during development, all the way through deployment and performance strategies.