How to Install RPM File on Different Linux Distributions


Linux supports various file types that contribute to its versatility and widespread use in various computing environments. While working in Linux, you may have encountered files with the .rpm extension. RPM files can be downloaded and installed independently outside of a software repository.

This guide will show you how to install an .rpm file on your Linux system.

How to install an RPM file on different Linux distributions - a tutorial.


What Is an RPM File?

An RPM file is a Red Hat package manager file that stores installation packages on Linux operating systems. These files facilitate software distribution, installation, upgrades, and removal as they are bundled in a single package.

The key features of RPM files are:

  • They contain all the necessary files for an application, including executables, libraries, configuration files, and documentation.
  • No special tools or knowledge are required to install them.
  • Cryptographic signatures help ensure their authenticity and integrity.
  • They are used in various Linux distributions, including Red Hat, Fedora, CentOS, Rocky Linux, and SUSE.

Follow the steps below to download and install an RPM file on your Linux system.

Download RPM Installation File  

An RPM installation file can be downloaded from the internet or from a repository that your package manager uses. Refer to the sections below to learn how to use each method.

Download RPM Files from the Internet

You can download an RPM file from the internet using a web browser or, if you prefer the command line, use the wget tool. The following examples show how to install wget in different OSes:

To install wget in CentOS and other distributions using yum, run the following command:

sudo yum install wget

To install wget in Fedora and other distros that use dnf, run:

sudo dnf install wget

After installing the wget command, use the syntax below to download an RPM file from the internet:

wget http://some_website/sample_file.rpm

Replace http://some_website/sample_file.rpm with the link to the RPM file, and the command downloads it to your current directory. You can look up the address of a particular RPM file in a web browser on another system. It is a handy way to install more recent software versions or special non-standard software.

For example:

Downloading the Apache web server RPM file and saving it to the current working directory.

The command in the example above downloads the Apache web server RPM file and saves it to the current working directory.

Important: Be cautious when installing software packages. Make sure you trust the source before you install it. Usually, a developer will include a verification method to ensure you get authentic software.

Download RPM Files from the Repository

The yum and dnf package managers allow you to download RPM files directly from the repository. Local installations are helpful if you have limited bandwidth or want to copy files between systems.

To download an RPM file from the repository with yum, use the syntax below:

sudo yumdownloader [package_name]

Replace [package_name] with the name of the package you want to download.

To download an RPM file with dnf, use the following syntax:

dnf download [package_name]

For example, to download the files for Apache, replace [package_name] with httpd:

Downloading the files for Apache, by replacing [package_name] with httpd

You can then install the file by following the instructions in the sections below.

Note: In Linux, administrators use package managers to manage and install software, keep track of software requirements, and track updates and patches. Package managers also work with repositories, secure and standardized libraries of commonly used and well-supported applications.

How to Install RPM File on Linux

Follow the instructions in the sections below to install a downloaded RPM file on different Linux distributions.

Using rpm Command (CentOS, Fedora, and RHEL)

The rpm command is the default package manager for Red Hat-based systems and only works with the .rpm format. To install an RPM package using rpm, use the following syntax:

sudo rpm -i [path_to_rpm_file]

Replace [path_to_rpm_file] with the path to the downloaded RPM file.

The -i flag tells the package manager you want to install the file. To check the RPM file for dependencies, use the following syntax:

sudo rpm -qpR [path_to_rpm_file]
  • -q tells rpm to query the file.
  • -p lets you specify the target package to query.
  • -R lists the requirements for the package.

The system should list all the dependencies. For example:

Check RPM file dependencies using the rpm command.

If there are any missing dependencies, install them from the standard repositories using yum or dnf. If your software requires other non-standard dependencies, this will be noted in the installation instructions.

Using yum Command (CentOS and RHEL)

The yum package manager is an alternative method to install RPM files. yum is still used in Linux distributions before RHEL 8, but for newer versions and most current distributions, dnf has taken its place.

Use the syntax below to install an RPM file with yum:

sudo yum localinstall [path_to_rpm_file]

Replace [path_to_rpm_file] with the path to the RPM file on your system. The localinstall option instructs yum to search for the installation file locally.

In the following example, we install the Apache web server we previously downloaded:

Install a local RPM file using yum.

Note: Learn the difference between yum and apt and yum and rpm.

Using dnf Command (Fedora, RHEL, Rocky Linux)

Another method to install RPM files on Fedora and RHEL is to use the dnf (Dandified YUM) utility. This tool is used primarily in RPM-based Linux distributions (Fedora, RHEL, CentOS, and other derivatives). dnf is the successor to yum, offering improved performance, dependency resolution, and a more modern command-line interface.

The syntax for installing RPM files with dnf is:

sudo dnf localinstall [path_to_rpm_file]

Replace [path_to_rpm_file] with the RPM file path on your system. For example:

Installing a local RPM file using the dnf package manager.

The package manager automatically resolves dependencies and installs the specified package.

Note: Learn the difference between dnf and yum.

Using GUI

Another way to install an RPM file is by using the GUI (graphical user interface). Using the GUI simplifies installation as there is no need to memorize commands.

Two commonly used Linux desktop environments are KDE and GNOME.

Install RPM Files using GNOME

GNOME is a popular Linux desktop environment that offers a GUI solution for installing RPM files. Follow the steps below:

1. Using a browser or the command line, download the RPM package of the app you want to install. For this tutorial, we will download the MySQL server RPM package.

2. Open the file management app on your system and navigate to the Downloads directory or another directory where you saved the RPM file.

Downloading an RPM file in Linux.

3. Double-click the RPM file to start the installation.

4. The system opens the Software application and provides information about the RPM package. When ready, click the Install button to start the installation.

Installing an RPM file using the GUI in GNOME.

5. When prompted, provide the root password and press Enter to confirm.

Wait for the installation to complete to start using the app.

Install RPM File using KDE

KDE Desktop Environment is another Linux desktop environment known for its customizable nature and rich feature set.

Follow the steps below to install an RPM file using KDE:

1. Download the RPM file of the application you want to install.

2. Open the file management app from the applications menu. The default app in KDE is Dolphin.

3. Navigate to the Downloads directory and find the downloaded RPM file.

RPM file ready for installation.

4. Double-click the file to open it and start the installation.

5. The Discover application displays information about the RPM package. Review it and click the Install button when ready to start the installation.

Installing an RPM file in Fedora KDE.

Wait for the installation to finish to start using the app.

How to Remove RPM Packages?

There are a couple of ways to remove RPM packages:

  • Using the RPM installer.
  • Via the yum package manager.
  • Via the dnf package manager.

Choose the method that suits your needs best from the sections below.

Remove a Package with rpm

Use the following syntax to remove an RPM package with the rpm command:

sudo rpm -e [package_name]

The -e option instructs RPM to erase the software package.  

Remove a Package with yum

The syntax for removing an RPM package with yum is:

sudo yum remove [package_name]

The command removes the software package from the system. If you want to remove the package and any dependencies installed only as the dependencies for that package, add the --remove-leaves option to the command above.

Remove a Package with dnf

To remove an RPM package with dnf, use the syntax below:

sudo dnf remove [package_name]

The command removes the package from the system. Like with yum, use the --remove-leaves option to remove dependencies that were installed solely as dependencies of the package being removed.


After reading this article, you should know how to install RPM files on Linux using the graphical user interface and command-line tools such as rpm, yum, and dnf. As with most Linux software, your default package manager simplifies software management and installation, making it the best choice for installing RPM files.

Next, learn about file permissions in Linux or get started with Linux config files.

Was this article helpful?
Goran Jevtic
Goran combines his leadership skills and passion for research, writing, and technology as a Technical Writing Team Lead at phoenixNAP. Working with multiple departments and on various projects, he has developed an extraordinary understanding of cloud and virtualization technology trends and best practices.
Next you should read
How to Install RPM Packages on Ubuntu
March 28, 2024

RPM is a package format used by Red Hat based derivatives like CentOS, RHEL or Fedora. It gets its name from...
Read more
How to Install Node.js and NPM on CentOS 7
June 29, 2019

Node Package Manager (npm) is Node's official package manager, used for installing and managing packages...
Read more
How to List Installed Packages on CentOS with Yum or RPM
April 29, 2019

Managing a CentOS operating system often means knowing the software packages that are installed. This list...
Read more
How to Install Pip on CentOS 7
January 17, 2019

Pip Installs Packages (Pip) is a package management system that simplifies the process of installing and...
Read more