install rpm in redhat centos

How to Install RPM Package in Redhat, CentOS

RPM files are the most common file formats for packages & software in Redhat, CentOS & Fedora Linux. RPM Package managers are repositories of these RPM files from where you can easily download & install RPM packages for your Linux. In this article, we will look at how to install RPM package in Redhat, CentOS Linux.

How to Install RPM Package in Redhat, CentOS

You will need to be logged into Linux with a user who has sudo/root privileges. You will also need RPM package manager like Yum, Dnf, or Rpm, all of which are installed by default.

Here are the steps to install RPM package.

1. Download RPM file

In order to install RPM package, we need to download it using wget or another file downloader. Open terminal and run the following command to install wget utility.

sudo yum install wget

In Fedora, you may use the following command instead.

sudo dnf install wget

Now that wget is installed, we use it to download our RPM file. Replace the link after wget command with the download link to your rpm file.

wget http://package_website/sample_file.rpm

The above command will download the specified RPM file to current working directory.

2. Install RPM File

Once you have downloaded the RPM package to your system, you can use yum, dnf or rpm command to install it. Here are the commands to install RPM file.

Using Yum command

We use localinstall option with yum command so that it will look for the file in your current working directory.

sudo yum localinstall sample_file.rpm

Using Dnf command

Here is the command to install RPM file using dnf command.

sudo dnf localinstall sample_file.rpm

Using Rpm command

You can also use rpm command to install RPM package.

sudo rpm -i sample_file.rpm

3. Remove RPM package

You can also remove RPM package with -e option.

sudo rpm -e sample_file.rpm

If you want to check the dependencies of an RPM package, use the following command.

sudo rpm -qpR sample_file.rpm
  • -q – query the file
  • -p – specify the target package to query
  • -R – list requirements for the package

In this article, we have learnt how to install RPM package in Redhat, CentOS and Fedora Linux.

Also read:

How to Configure Firewalld in Redhat, CentOS Linux
How to Restart Linux Server from Command Line
How to Flush DNS Cache in Windows, Linux & Mac
How to Change Host Name in Debian/Ubuntu
How to Send GET & POST requests in Python

Leave a Reply

Your email address will not be published. Required fields are marked *