How to install a rpm package on CentOS 9

Endrit Qerreti

Endrit Qerreti

In this tutorial, you will learn how to install a rpm package on CentOS.

rpm is a package manager that allows you to manage rpm packages on your system. In this tutorial, we are going to use two methods to install rpm packages on rhel based distros, by using yum and rpm package manager.

Step 1 - Download rpm package

To download a rpm package or any other file on Linux, you can use wget. wget is tool that allows you to download packages directly from your terminal. In the command below, we are using the -P option to download the rpm package to the Downloads folder

wget -P /Downloads https://site-example.com/package.rpm

Replace the url specified above with your own

Note: If you don't have wget installed on your system, the command above will not work. You can install wget with by following our tutorial here How to install and use wget on CentOS 6, 7, 8 and 9

Step 2 - Install the rpm package

Install rpm package via rpm -i command

Once you have downloaded the rpm package on your system, follow the steps below to install it.

Browse to the directory where you downloaded the rpm file

cd Downloads

Assuming you downloaded the file on the Downloads folder, once you are in the downloads folder, run the command below to install the rpm package

rpm -i package-name.rpm

Install rpm package via yum

You can also use yum to install a rpm package locally. Browse into the directory where the rpm file is located

cd Downloads

Next, run the command below to install the rpm file using yum package manager

yum install package-name.rpm

Step 3 - Run the package

After installing the rpm package, you need to check if the installation was done correctly. To do a quick check if the rpm package got installed on your system, you can run the version command

package-name -v

And it should output the current version of the rpm package.

Alternatively, you can run the package that you installed to see if there's an issue with it.

Conclusion

In this tutorial, you learned how to install a rpm package on Rhel linux distros. We covered two methods to install rpm packages offline, by using rpm and yum package manager.