A package manager is a tool in Linux whose primary role is to automate the installing, updating, configuring and removal of software packages. The package manager greatly simplifies the complexities related to the package installation, dependencies resolution, and updates.
Primary Functions
Software Installation: Let users easily install software packages along with their dependencies. users can easily search for various available versions and select the version they want to install.
Dependency Resolution: When installing software packages the package manager resolves all the dependencies for the user to simplify software installation.
Software Updates: Package Manager enables users to easily update packages to newer versions. they can automatically check for updates and install the latest available software versions.
Repository Management: Package Managers maintain software repositories and allow users to install software from local or remote repositories.
Configuration and Software Removal: Package Managers include tools that allow software configuration and their removal. users can easily remove software packages.
Popular Package Managers in Linux
Some popular package managers commonly used in various Linux flavours are:
APT | APT (Advanced Package Tool) is used in Debian and Ubuntu based distributions |
DPKG | This is used for lower-level package management in Debian based distributions |
YUM | YUM (Yellowdog Updater, Modified) is mainly used in RedHat, Centos, and Fedora. |
DNF | DNF (Dandified Yum) is an improved version of YUM package manager and is available in newer versions of RHEL, Fedora, and Centos |
RPM | RedHat Package Manager is lower-level package management used in RedHat based distributions. |
Pacman | Used in Arch Linux and its various derivatives. |
Zyper | Used in openSUSE and SUSE Enterprise Linux distributions. |
Portage | Used in Gentoo and its various derivatives. |
Few examples of Package Manager usage
APT
Refresh local package index | apt-get update |
List installed packages | apt list –installed |
Search Package | apt-cache search <package name> |
Install Package | apt-get install <package name> |
Update/Upgrade Packages | Use apt update to refresh package list from remote repositories. Use apt upgrade to install newer package versions. |
Remove Package | apt-get remove <package name> |
DNF
Refresh local package index | dnf makecache |
List installed packages | dnf list –installed |
Search Package | dnf search <package name> |
Install Package | dnf install <package name> |
Update/Upgrade Packages | Use dnf upgrade to install newer package versions. |
Remove Package | dnf remove <package name> |
Pacman
Refresh local package index | pacman -Sy |
List installed packages | pacman -Q |
Search Package | pacman -Ss <package name> |
Install Package | pacman -Sy <package name> |
Update/Upgrade Packages | Use pacman -Su to install newer package versions. |
Remove Package | pacman -R <package name> |
Yum
Refresh local package index | yum update [root@48a72f5f0234 /]# yum update Updating Subscription Management repositories. Unable to read consumer identity Subscription Manager is operating in container mode. This system is not registered with an entitlement server. You can use subscription-manager to register. Red Hat Universal Base Image 8 (RPMs) – BaseOS 2.1 MB/s | 716 kB 00:00 Red Hat Universal Base Image 8 (RPMs) – AppStream 8.5 MB/s | 2.9 MB 00:00 Red Hat Universal Base Image 8 (RPMs) – CodeReady Builder 500 kB/s | 99 kB 00:00 Dependencies resolved. Nothing to do. Complete! |
List installed packages | yum list –installed [root@48a72f5f0234 /]# yum list –installed Updating Subscription Management repositories. Unable to read consumer identity Subscription Manager is operating in container mode. This system is not registered with an entitlement server. You can use subscription-manager to register. Installed Packages acl.x86_64 2.2.53-1.el8 @System audit-libs.x86_64 3.0.7-4.el8 @System basesystem.noarch 11-5.el8 @System bash.x86_64 4.4.20-4.el8_6 @System brotli.x86_64 1.0.6-3.el8 @System bzip2-libs.x86_64 1.0.6-26.el8 @System ca-certificates.noarch 2023.2.60_v7.0.306-80.0.el8_8 @System chkconfig.x86_64 1.19.1-1.el8 @System coreutils-single.x86_64 8.30-15.el8 @System cracklib.x86_64 2.9.6-15.el8 @System cracklib-dicts.x86_64 2.9.6-15.el8 @System crypto-policies.noarch 20221215-1.gitece0092.el8 @System crypto-policies-scripts.noarch 20221215-1.gitece0092.el8 @System cryptsetup-libs.x86_64 2.3.7-5.el8 @System curl.x86_64 7.61.1-30.el8_8.3 @System |
Search Package | yum search <package name> [root@48a72f5f0234 /]# yum search podman Updating Subscription Management repositories. Unable to read consumer identity Subscription Manager is operating in container mode. This system is not registered with an entitlement server. You can use subscription-manager to register. Last metadata expiration check: 0:01:34 ago on Sat Nov 11 07:00:38 2023. ================================================================ Name Exactly Matched: podman ================================================================ podman.x86_64 : Manage Pods, Containers and Container Images =============================================================== Name & Summary Matched: podman =============================================================== cockpit-podman.noarch : Cockpit component for Podman containers podman-docker.noarch : Emulate Docker CLI using podman podman-plugins.x86_64 : Plugins for podman podman-remote.x86_64 : A remote CLI for Podman: A Simple management tool for pods, containers and images podman-tests.x86_64 : Tests for podman python3-podman.noarch : RESTful API for Podman ==================================================================== Name Matched: podman ==================================================================== podman-catatonit.x86_64 : A signal-forwarding process manager for containers podman-gvproxy.x86_64 : Go replacement for libslirp and VPNKit |
Install Package | yum install <package name> [root@48a72f5f0234 /]# yum install podman-remote Updating Subscription Management repositories. Unable to read consumer identity Subscription Manager is operating in container mode. This system is not registered with an entitlement server. You can use subscription-manager to register. Last metadata expiration check: 0:03:19 ago on Sat Nov 11 07:00:38 2023. Dependencies resolved. Package Architecture Version Repository Size Installing: podman-remote x86_64 3:4.4.1-16.module+el8.8.0+19993+47c8ef84 ubi-8-appstream-rpms 9.6 M Installing dependencies: shadow-utils-subid x86_64 2:4.6-17.el8 ubi-8-baseos-rpms 113 k Enabling module streams: container-tools rhel8 Transaction Summary Install 2 Packages Total download size: 9.7 M Installed size: 34 M Is this ok [y/N]: y Downloading Packages: (1/2): shadow-utils-subid-4.6-17.el8.x86_64.rpm 661 kB/s | 113 kB 00:00 (2/2): podman-remote-4.4.1-16.module+el8.8.0+19993+47c8ef84.x86_64.rpm 9.5 MB/s | 9.6 MB 00:01 Total 9.6 MB/s | 9.7 MB 00:01 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : shadow-utils-subid-2:4.6-17.el8.x86_64 1/2 Installing : podman-remote-3:4.4.1-16.module+el8.8.0+19993+47c8ef84.x86_64 2/2 Running scriptlet: podman-remote-3:4.4.1-16.module+el8.8.0+19993+47c8ef84.x86_64 2/2 Verifying : shadow-utils-subid-2:4.6-17.el8.x86_64 1/2 Verifying : podman-remote-3:4.4.1-16.module+el8.8.0+19993+47c8ef84.x86_64 2/2 Installed products updated. Installed: podman-remote-3:4.4.1-16.module+el8.8.0+19993+47c8ef84.x86_64 shadow-utils-subid-2:4.6-17.el8.x86_64 Complete! |
Update/Upgrade Packages | Use yum upgrade to install newer package versions. [root@48a72f5f0234 /]# yum upgrade Updating Subscription Management repositories. Unable to read consumer identity Subscription Manager is operating in container mode. This system is not registered with an entitlement server. You can use subscription-manager to register. Last metadata expiration check: 0:05:23 ago on Sat Nov 11 07:00:38 2023. Dependencies resolved. Nothing to do. Complete! |
Remove Package | yum remove <package name> [root@48a72f5f0234 /]# yum remove podman-remote Updating Subscription Management repositories. Unable to read consumer identity Subscription Manager is operating in container mode. This system is not registered with an entitlement server. You can use subscription-manager to register. Dependencies resolved. Package Architecture Version Repository Size Removing: podman-remote x86_64 3:4.4.1-16.module+el8.8.0+19993+47c8ef84 @ubi-8-appstream-rpms 34 M Removing unused dependencies: shadow-utils-subid x86_64 2:4.6-17.el8 @ubi-8-baseos-rpms 205 k Transaction Summary Remove 2 Packages Freed space: 34 M Is this ok [y/N]: y Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Erasing : podman-remote-3:4.4.1-16.module+el8.8.0+19993+47c8ef84.x86_64 1/2 Erasing : shadow-utils-subid-2:4.6-17.el8.x86_64 2/2 Verifying : podman-remote-3:4.4.1-16.module+el8.8.0+19993+47c8ef84.x86_64 1/2 Verifying : shadow-utils-subid-2:4.6-17.el8.x86_64 2/2 Installed products updated. Removed: podman-remote-3:4.4.1-16.module+el8.8.0+19993+47c8ef84.x86_64 shadow-utils-subid-2:4.6-17.el8.x86_64 Complete! |
Conclusion
No doubt, package managers are the unsung heroes in the Linux world, streamlining the way we access, manage, and update software. Whether it’s the familiarity of APT, the versatility of YUM, or the simplicity of SNAP, each manager contributes to the seamless functioning of our operating systems. Appreciating the power of package managers not only simplifies our software endeavours but also reflects the collaborative essence of the open-source community, where innovation and accessibility converge.