Package Manager Basics
Last modified: September 16, 2024
Overview
Package managers allow you to easily update, install, and remove software packages on your system. Package managers use repositories to manage the packages that you install or uninstall. They also handle any dependencies for packages that you wish to use. If you set your package manager to automatically update your system’s packages, you will not need to run the updates manually.
You can configure your system’s update schedule in WHM’s Update Preferences interface (WHM » Home » Server Configuration » Update Preferences).
cPanel & WHM ensures that installed packages do not conflict with one another.
How package managers use their directories
Usually, each package manager’s directory owns a file that contains one or more configuration blocks. These blocks define the package manager’s available repositories and ensure that they allow third-party software. You do not need to edit this file.
Package manager by operating system
Different operating systems use different package managers to manage their repositories.
Operating System | Package Manager |
---|---|
CentOS | yum |
AlmaLinux OS | dnf |
Rocky Linux™ | dnf |
Ubuntu® | apt |
CentOS repositories
CentOS uses yum
to manage the packages in its repositories.
The following preconfigured repositories exist on CentOS systems:
base
updates
extras
The system stores yum
repositories in the /etc/yum.repos.d/
directory.
To access a new repository, download the .repo
file from the desired third-party to the /etc/yum.repos.d/
directory and then run the yum update
command.
AlmaLinux OS and Rocky Linux repositories
AlmaLinux OS and Rocky Linux™ use dnf
to manage the packages in their repositories.
The following preconfigured repositories exist on AlmaLinux systems:
baseos
appstream
extras
The following preconfigured repositories exist on Rocky Linux systems:
baseos
appstream
extras
The system stores dnf
repositories in the /etc/yum.repos.d/
directory.
To access a new repository, download the .repo
file from the desired third-party repository to the /etc/yum.repos.d/
directory and then run the dnf upgrade
command.
Ubuntu repositories
Ubuntu® uses apt
to manage the packages in its repositories.
The following preconfigured repositories exist on Ubuntu systems:
main
universe
multiverse
restricted
partner
To access any other repositories, download the .list
file to the /etc/apt/sources.list.d/
directory and then run the apt update
command.
Package management in EasyApache 4
EasyApache 4 packages conform to the following rules:
- In the EasyApache 4 repositories, cPanel & WHM-provided packages use the
ea-
prefix or namespace. - EasyApache 4 provides packages in both RPM and
.deb
format.
Manage packages on CentOS systems
To manage packages on a CentOS system, use the yum
command.
In the following table, example
represents the name of the package that you wish to install.
Command | Description |
---|---|
yum install example |
Install the example package from a repository to your system. |
yum erase example or yum remove example |
Uninstall the example package and any dependencies. |
yum update |
Update all of the packages on your system. |
yum update example |
Update the example package on your system. |
yum upgrade |
Upgrade the packages on your system.
Note:
This command also removes any obsolete packages on your system.
|
For more information about the yum
command, read the yum
documentation.
Manage packages on AlmaLinux and Rocky Linux systems
To manage packages on an AlmaLinux or Rocky Linux system, use the dnf
command.
In the following table, example
represents the name of the package that you wish to install.
Command | Description |
---|---|
dnf install example |
Install the example package from a repository to your system. |
dnf remove example |
Uninstall the example package and any dependencies. |
dnf upgrade |
Update all of the packages on your system.
Note:
This command replaces
dnf update and also removes any obsolete packages from your system.
|
dnf upgrade example |
Update the example package on your system. |
For more information about the dnf
command, read the dnf
documentation.
Manage packages on Ubuntu systems
To manage packages on an Ubuntu system, use the apt
command.
In the following table, example
represents the name of the package that you wish to install.
Command | Description |
---|---|
apt install --purge example |
Install the example package from a repository to your system. |
apt purge example |
Uninstall the example package, all configuration files, and any dependencies. |
apt update |
Download the package information from all configured repositories. |
apt upgrade --purge |
Install any available upgrades for packages on your system. |
The --purge
option ensures that the system removes any unneeded package dependencies and any non-binary files that the package owns. If you run the install
or upgrade
commands without the --purge
option, then apt
will not remove these files, and errors may occur.
Do not hold
any EasyApache 4 packages on Ubuntu systems. When you hold
a package, it prevents the system from updating it. If you hold
an EasyApache 4 package, you must manually resolve any error messages.
For more information about the apt
command, read the apt
documentation.
Software collections
We use the Software Collections Library (SCL) on non-Ubuntu systems to maintain packages that support multiple versions of software, which are primarily PHP packages.
Each Software Collection area uses its own package namespace. Because of this, two package namespaces will exist for each version of PHP. For example, to install the -soap
extension for PHP 7.4, you must install the ea-php74-php-soap
package. You cannot install only the php-soap
package.
For more information, read Princeton University’s Software Collections documentation and our The scl Utility documentation.