A brief comparison of Linux Package Managers
In this article we take a brief look at the commands needed to manage software installations on various Linux OS's, covered by the following package managers
Package Managers
- APT — Is the default front-end for the dpkg package manager used by Debian-based systems
- DNF — Is a rewrite of yum that's major distinguishing feature, from its predecessor, is the fact it uses ZYpp's libsolv library for dependency resolution and hence has performance advantages over yum.
- pacman — Is the default package manager of Arch Linux and its various derivatives as well as at lpacman is the default package manager of Arch Linux and its various derivatives as well as at least two supposedly “independent” distributions, Frugalware Linux and KaOS.east two supposedly “independent” distributions, Frugalware Linux and KaOS.
- yum — Is a front-end for the RPM package manager that is written in Python. Prior to the release of Fedora 22 in May 2015 it was the default package manager of Fedora, and it is still the default package manager of CentOS, Oracle Linux, Red Hat Enterprise Linux (RHEL) and Scientific Linux
- ZYpp — Is the default package manager of openSUSE, SUSE Linux Enterprise (SLE) and their derivatives.
Package Management
The below table outlines the commands needed to perform common package manager tasks:
Action | APT | DNF | pacman | yum | ZYpp |
---|---|---|---|---|---|
Add a repository | add-apt-repository repo | dnf config-manager --add-repo url | n/a | yum config-manager --add-repo url | zypper ar -f url |
Build package from source | apt-get source --compile pkg | n/a | makepkg | n/a | n/a |
Install build dependencies | apt-get build-dep pkg | dnf builddep pkg | makepkg -s | yum-builddep pkg | zypper source-install -d pkg |
Install package | apt-get install pkg | dnf install pkg | pacman -S pkg | yum install pkg | zypper install pkg |
Remove package | apt-get remove pkg | dnf remove pkg | pacman -Rs pkg | yum remove pkg | zypper remove pkg |
Search for keyword | apt-cache search pkg | dnf search pkg | pacman -Ss pkg | yum search pkg | zypper search pkg |
Upgrade all packages | apt-get update && apt-get upgrade | dnf update | pacman -Syu | yum update | zypper update |
Note: The references to pkg, url and repo in the above table refer to the target package, url or repository needed to perform the required task.