CentOS

How to install an RPM package on CentOS 8

The red Hat package manager, commonly known as RPM, is a package management system used to manage, install, uninstall, upgrade, list, and check .rpm-based packages in Redhat-based Linux distributions.

The files with the extension .rpm in Linux are like the alternative of .exe files in Windows. The .rpm files are used to install applications in any RedHat-based Linux Operating system. It is a packaging format that is helpful when installing third-party software on an operating system. In this post, we will discuss the process of installing an RPM package on CentOS 8.

There are three methods we can use to install an RPM package on CentOS 8:

  1. By using DNF
  2. By using Yum
  3. By using RPM

Let’s begin with the first method and learn to install an RPM package using the DNF package manager.

Installing RPM packages by using DNF

DNF has replaced Yum as the latest version of it in CentOS 8.

Handling dependencies is an important task when installing a package on a Linux-based operating system. Therefore, DNF should always be preferred over other package managers when installing an RPM package as it is really good at handling dependencies.

To install an RPM package with DNF, just provide the RPM package to the “dnf install” command:

$ sudo dnf install ./package.rpm

For example, we want to install the latest version of team viewer on the CentOS 8 Operating system. To install the latest version of TeamViewer, visit the download page of TeamViewer:

https://www.teamviewer.com/en/download/linux/

Once you are on the download page of the Teamviewer application, Click on the Highlighted link in the above screenshot.

A pop-up box will appear to download the RPM file for installing TeamViewer on CentOS 8:

Click on the save file option and click “OK” to start the downloading process of the TeamViewer RPM file.

Once the RPM package of TeamViewer is downloaded, switch back to the terminal and navigate to the “Downloads” directory where the RPM package is downloaded using the “cd” command:

$ cd Downloads

Once you are in the Downloads directory, execute the “ls” command to confirm the presence of the TeamViewer RPM file:

$ ls

Now to install the latest version of TeamViewer on CentOS 8, simply provide the download RPM file of TeamViewer to the “dnf install” command as shown below:

$ sudo dnf install ./teamviewer_15.18.5.x86_64.rpm

It will ask to install some additional dependencies and take additional disk space, so type “y” and hit “Enter” to continue; the installation will start and complete in a matter of seconds.

As you can see in the screenshot above, the latest version of TeamViewer is successfully installed using an RPM package on CentOS 8 Operating system.

Install an RPM package from the web

You can also download and install an RPM package located on the web using DNF. To install the RPM package, just give the direct web address of the RPM package to the DNF.

For example, if we want to install epel-release directly from the fedoraproject.org, the command would go like this:

$ sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

DNF will automatically look for dependencies, and it will ask you for confirmation before installing the package and its dependencies.

Input “y” and press Enter to initiate the installation process of epel-release along with its dependencies.

DNF also lets you know whether the package is compatible with your operating system. If a package is not compatible with your CentOS Operating system, then either update the Operating system or try another package that is compatible with the Operating system.

Installing RPM packages using YUM

As mentioned above, the YUM package management system has been replaced with DNF in the latest version of CentOS, but you can continue using it.

The syntax in this method is the same as the DNF method. Simply replace DNF with YUM.

For example, to install a package using the YUM package manager, the syntax of the yum command would look like this:

$ sudo yum install ./path/package.rpm

After executing the above command, the package, as well as its dependencies, will be installed.

Installing RPM packages using RPM

This is a conventional and standard method to install RPM packages on CentOS 8 Operating system, but you should always prefer using DNF over it if you don’t want things to get messy.

Using this method to install RPM packages has its limitations as RPM does not handle dependencies, and you have to look for them manually.

To install a package with rpm command, use the “-i” flag and provide it an RPM package installer file:

$ sudo rpm -i ./path/package.rpm

As you can witness in the screenshot above, the dependencies are not installed, so the RPM package can’t be installed. So instead, you have to install dependencies manually first; then, you can install TeamViewer using the “rpm” command.

Conclusion

External RPM installs should be limited as much as possible as they can make your system unstable. However, if you want to install the latest version of any application, you must use the latest RPM file.

In this article, we have learned the installation process of RPM-based packages using three different methods. We also discussed why DNF should always be preferred over other methods as it handles dependency issues. It might become necessary to use the RPM utility in rare cases, but DNF will always be the best bet.

About the author

Shehroz Azam

A Javascript Developer & Linux enthusiast with 4 years of industrial experience and proven know-how to combine creative and usability viewpoints resulting in world-class web applications. I have experience working with Vue, React & Node.js & currently working on article writing and video creation.