Today, let's take a step in a different direction and understand Package management in Linux System.
Package management is a method of installing and maintaining(update, remove, manage dependency, etc) software in the system.
Softwares are usually distributed in packages and stored in repositories.
Earlier, one had to download and compile source code to install the software.
Now, most of the modern Unix-like operating systems offer a centralized mechanism for finding and installing software.
But before we jump into how the package management system works, let's look into what are the advantages of using it
- Ease of installation and removal of software
- To keep track of updates and upgrades
- To provide consistent usage throughout the devices.
- To manage dependencies while installing a new software
Okay, there are different Linux distributions. Do all of them use the same packaging management system?
No, different distributions use different packaging management systems.
So, a package intended for one distribution is generally not compatible with another distribution.
Most package management systems are built around collections of package files.
A package file is a collection of files that comprise the software package.
A package may consist of numerous package files and pre- and post-installation scripts that perform configuration tasks before and after the package installation.
Package management systems usually consist of two types of tools.
Low-level tools which handle tasks such as installing and removing package files
High-level tools that perform metadata searching and dependency resolution
The functionality may be similar in all the distributions but their tools are different
|Distribution||Format||Low Level Tool||High Level Tool|
dpkg is a low-level tool to install, build, remove and manage Debian packages.
apt provides a high-level command-line interface for the package management system.
It is intended as an end-user interface and enables some options better suited for interactive usage.
aptitude is a text-based interface package management system.
It allows the user to view the list of packages and to perform package management tasks such as installing, upgrading, and removing packages.
RPM is a package management system used to build, install, verify, update, and uninstall software.
yum is the high level tool for getting, installing, deleting, querying, and managing Red Hat Enterprise Linux RPM software packages.
DNF or Dandified YUM is the next-generation version of the Yellowdog Updater, Modified. It is used for getting, installing, deleting, querying, and managing Red Hat Enterprise Linux RPM software packages.
Let's have a look at how do we use these tools:
|Install a .deb file||dpkg -i package-file-name.deb|
|Remove a .deb file||dpkg -r package-file-name.deb|
|List installed Packages||dpkg --list search-pattern|
|Check if a package is installed||dpkg -s package-name|
|location of installed file||dpkg -L package-name|
|Installs the package(s) with dependency||apt-get install package-name(s)|
|Remove the package(s) but not dependency||apt-get remove package-name(s)|
|Remove unused dependency||apt-get autoremove|
|Update Package List||apt-get update|
|search Packages||apt search search_string|
|get info about a package||apt show package|
|Install a .rpm file||rpm -i package-file-name.rpm|
|Remove a .npm file||rpm --erase package-name(s)|
|Listing Installed Files||rpm -qa|
|Check if a given package is installed||rpm --query package-name(s)|
|Installs the package(s) with dependency||yum install package-name(s)|
|Remove the package(s) but not dependency||yum erase package-name(s)|
|Update Package List||yum update|
|search Packages||yum search search-pattern|
|get info about a package||yum info package-name(s)|
|Installs the package(s) with dependency||dnf install package-name(s)|
|Remove the package(s) but not dependency||dnf remove package-name(s)|
|Update Package List||dnf upgrade|
|search Packages||dnf search search-pattern|
|get info about a package||dnf info package-name(s)|
These are the most common functionalities that these Package Managers Provide.
Hope this will help you better understand the Package management in Linux.
See you in funny papers 🚀