The core parts of a Linux Distribution and most of it's add on software are installed via the Package Management System. Each package contains the files and other instructions needed to make one software component work well and cooperate with the other components that comprise the entire system packages can depend on each other for example- a package for a web based application written in php can depend on the php packages.
There are two broad families of package managers, those based on Debian and those which use RPM as their low level package manager. The two systems are incompatible but broadly speaking provide the same features and satisfy the same needs.
In this section we will learn how to search for packages from the CLI using the package management system.
Package Managers : Two Levels
Both package management systems operate on two distinct levels a low level tool such as dpkg or RPM takes care of details of unpacking individual packages, running scripts, getting the software installed correctly, while a high level tool such as apt, get, dnf, yum or zipper works with group of packages downloads from the vendors and figure out dependencies.
Most of the time users need to only work with the high level tool which will take care of calling the low level tool as needed.
Dependency Resolution
Dependency Resolution is a particularly important feature of the high level tool as it handles the details of finding and installing each dependency for you. Be careful however installing a single package could result in many dozens or even hundreds of dependent packages being installed.
Working with Different Package Management Systems
The advanced package management tool apt is the underlying package management system that manages software on debian based systems, while it forms the backend for graphical package manager such as the ubuntu software center and synaptic, it’s native user Interface is at the command line with programs that includes apt or apt-get and apt-cache.
DNF
DNF is the open source command line package management utility for the RPM compatible linux systems that belongs to the red hat family.dnf has both command line and graphical user interface. DNF makes it easy to maintain packages by automatically checking for dependencies and determines the actions required to install packages. This method eliminates the need to manually install or update the package, and its dependencies, using the rpm
command. DNF is now the default software package management tool in Fedora.
Zypper
Zypper is a command line package manager for installing, updating and removing packages a well as for managing repositories. It is especially useful for accomplishing remote software management tasks or managing software from shell scripts.
To learn the basic package commands take a look at these packaging commands:
Operations | rpm | deb |
Install packages | rpm -i foo.rpm | dpkg --install foo.deb |
Install package, dependencies | dnf install foo | apt-get install foo |
Remove package | rpm -e foo.rpm | dpkg --remove foo.deb |
Remove package, dependencies | dnf remove foo | apt-get autoremove foo |
Update package | rpm -U foo.rpm | dpkg --install foo.deb |
Update package, dependencies | dnf update foo | apt-get install foo |
Update entire system | dnf update | apt-get dist-upgrade |
Show all installed packages | rpm -qa or dnf list installed | dpkg --list |
Get information on package | rpm -qil foo | dpkg --listfiles foo |
Show packages named foo | dnf list "foo" | apt-cache search foo |
Show all available packages | dnf list | apt-cache dumpavail foo |
What package is file a part of ? | rpm -qf file | dpkg --search file |