RPM-Based Package Management
CentOS, Red Hat Enterprise Linux, and Fedora use an RPM-based system. RPM stands for Red Hat Package Manager, and it distributes software in bundles with the .rpm extension. The basic usage of the RPM command includes:- Installing a package:
Use the-ioption along with the package name to install software from a specified location. - Uninstalling a package:
Use the-eoption to remove a package. - Querying package details:
Use the-qoption to retrieve information about an installed package.
RPM does not automatically resolve dependencies. For example, if you install Ansible—which requires Python and additional libraries—using RPM alone will not install missing dependencies.
Dependency Management with Yum
To overcome RPM limitations regarding dependencies, Linux distributions use higher-level package managers like yum. Yum integrates with RPM while automating dependency resolution. When you run a simple command like:Understanding Repositories
Yum retrieves packages from software repositories—collections of RPM packages stored locally or on remote servers. Repository configuration files are located in the/etc/yum.repos.d/ directory. Most operating systems include a default set of repositories offering a wide range of software. In cases where the default repositories do not cover your requirements or if you need the latest versions, additional repositories can be configured by following the software’s documentation.
To list available repositories, use:
Upgrading to Newer Versions
Sometimes, default repositories may offer older package versions. For example, CentOS might provide Ansible version 2.4 by default, even though a later version like 2.9 is available. To install the latest version, refer to the Ansible documentation and configure an updated repository. You can add an updated repository using commands such as:Managing Packages with Yum
Yum offers several commands to manage installed and available packages:-
Listing installed or available packages:
For instance, to check for Ansible:The output might appear as follows: -
Removing an installed package:
-
Listing all available package versions:
Use the--showduplicatesoption to list all available versions.This might return:This output indicates that different versions of Ansible are available, possibly from the extras and EPEL repositories. To install a specific version, include the version number in the install command:
Summary
Linux package managers, such as RPM and yum, streamline software installation and dependency management. Understanding how to leverage these tools is essential for efficiently managing packages in DevOps and Cloud environments.Experiment with these commands in a controlled environment to deepen your understanding of Linux package management.