How to Install RPM Packages in CentOS, RHEL & Fedora

RPM (Formerly short for Red Hat Package Manager, now a recursive acronym for RPM Package Manager) is the name of both the package manager for installing software in Red Hat and RedHat based Linux distribution, and of the file format of these packages.

RPM package files with extension '.rpm' are similar to deb files in Debian and its derived distributions. They contain the application files and the metadata for the software.

Two package managers have popularly used in Red Hat-based distributions: First is the aforementioned RPM package manager, and another one is YUM.

YUM package manager can install software directly from the official repositories, or directly from a downloaded RPM package file. The package file contains a list of required software in its metadata file.

RPM will not install dependencies for a package, whereas YUM will install the package along with all its dependencies if they are already not present.

Let’s see how to install a downloaded RPM package file using the yum package manager in CentOS, RHEL, and Fedora.

Installing an RPM Package

Before calling the yum command to install the package, run the following command to update the index files for the package list of YUM, so that the latest versions can be installed.

$ sudo yum update

Following is the syntax for installing an RPM file using YUM:

$ sudo yum install rpm_filename.rpm

For example, to install the RPM package for the tool called ‘abc-devel‘ (Digital logic design tool), we can run:

$ sudo yum install abc-devel-1.01-9.hg20160905.el7.x86_64.rpm
Install RPM Package
Install RPM Package

Some packages could also be installed with the rpm file. However, then it would not install the dependencies (shown in the screenshots above) automatically, and the user would need to download and install them manually.

Note that, in the newer CentOS version, an updated version of YUM is available, called DNF (short for Dandified YUM). This package manager works exactly the same as YUM, and you can simply replace YUM with DNF in the commands explained previously to install a package.

Conclusion

In this article, we learned how to install an RPM package in CentOS, RHEL, and Fedora. The usual way to install packages is to install them directly from the repository. However, there might be scenarios when the RPM package for a certain software might not be officially available in the repository, in which case we can use YUM or DNF to install it as explained above.

Thanks for reading and let us know your thoughts in the comments below!

Got something to say? Join the discussion.