How to Install RPM File in Linux (Complete Beginner’s Guide)

What Is an RPM File?

An RPM file stands for Red Hat Package Manager — it’s a package format used by Red Hat-based Linux distributions like:

  • RHEL (Red Hat Enterprise Linux)
  • Fedora
  • CentOS
  • openSUSE (partially)
  • Rocky Linux
  • AlmaLinux

It’s similar to .deb files on Ubuntu or .exe files on Windows.

Each .rpm file contains:

  • The software program
  • Configuration files
  • Dependency information (other packages it needs to run)

So when you install an RPM, Linux automatically extracts and configures it on your system.


1. Check If Your System Supports RPM

Most Red Hat–based distros already include RPM support by default.
To confirm, run:

rpm --version

If you see something like:

RPM version 4.18.1

you’re good to go.

If the command isn’t found, install it using:

sudo dnf install rpm

or on older systems:

sudo yum install rpm

2. Install an RPM File Using rpm Command

The basic command to install an RPM file manually is:

sudo rpm -ivh package-name.rpm

Explanation:

  • -i → Install
  • -v → Verbose output (shows details)
  • -h → Displays a progress bar with hash marks

Example:

sudo rpm -ivh google-chrome-stable_current_x86_64.rpm

Output:

Preparing...                ################################# [100%]
Updating / installing...
1:google-chrome-stable-128.0.6535.0######################### [100%]

When to use:
Use this method when installing from a standalone .rpm file downloaded manually.


3. Installing RPM Files with dnf (Recommended)

If you’re using Fedora, RHEL 8+, Rocky Linux, or AlmaLinux, dnf is the default and safest tool to install RPMs.

Command:

sudo dnf install package-name.rpm

Example:

sudo dnf install google-chrome-stable_current_x86_64.rpm

Why it’s better than rpm:

  • Automatically resolves dependencies
  • Installs missing libraries if required
  • Safer and more user-friendly

If you try installing an RPM that depends on other packages, dnf automatically downloads them from official repositories.


4. Installing RPM Files with yum (Older Systems)

If you’re using CentOS 7 or older Red Hat versions, use yum instead of dnf.

Command:

sudo yum install package-name.rpm

Example:

sudo yum install teamviewer.x86_64.rpm

yum is the predecessor of dnf, and the syntax is almost identical.


5. Installing RPM from a Remote URL

You can directly install a package hosted online without downloading it manually.

Command:

sudo dnf install https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm

This automatically downloads and installs the package.

Note:
You can use yum instead of dnf on older systems:

sudo yum install https://example.com/package.rpm

6. Check Installed RPM Packages

To confirm whether a package has been installed successfully:

rpm -qa | grep package-name

Example:

rpm -qa | grep chrome

This will return something like:

google-chrome-stable-128.0.6535.0.x86_64

Tip:
-qa stands for “query all,” meaning it lists all installed RPM packages.


7. Check Package Details Before Installation

Before installing an RPM, it’s always a good idea to see what’s inside.

Command:

rpm -qpi package-name.rpm

Example:

rpm -qpi google-chrome-stable_current_x86_64.rpm

Output:

Name        : google-chrome-stable
Version     : 128.0.6535.0
Release     : 1
Architecture: x86_64
Group       : Applications/Internet
License     : Proprietary

You can also check which files it will install:

rpm -qpl package-name.rpm

8. Update an Installed RPM Package

If a new version of your RPM is released, update it using:

sudo rpm -Uvh package-name.rpm

Explanation:

  • -U → Upgrade (installs new or updates old)
  • -v → Verbose
  • -h → Progress bar

Example:

sudo rpm -Uvh vscode-latest.x86_64.rpm

If you prefer dnf:

sudo dnf upgrade package-name.rpm

9. Uninstall (Remove) an RPM Package

To remove an installed RPM:

sudo rpm -e package-name

Example:

sudo rpm -e google-chrome-stable

If dependencies are involved, use:

sudo dnf remove package-name

Why prefer dnf or yum:
They handle dependency cleanup better than raw rpm.


10. Verify Installed Packages

If you want to check if a specific RPM package is intact and not corrupted:

rpm -V package-name

It verifies that all files match the original installation.

If everything’s fine, you’ll get no output. If not, it shows mismatched files.


11. Convert a .deb Package to .rpm (Optional Tip)

If you only have a .deb (Debian) package, you can convert it using the alien tool.

Install Alien:

sudo dnf install alien

Convert and Install:

sudo alien -r package-name.deb
sudo rpm -ivh package-name.rpm

Note:
This isn’t always perfect — use it only if the software doesn’t provide an official RPM package.


12. Common Errors While Installing RPMs

ErrorMeaningFix
failed dependenciesSome required packages are missingUse dnf install instead of rpm to auto-resolve
file conflictsAnother version or similar package existsRemove old package before installing
package already installedThe same version is already presentUse rpm -Uvh to upgrade

Pro Tip: Always prefer dnf or yum for safe dependency management.


13. GUI Method (Optional)

If you’re using a Linux desktop environment, you can also install RPMs through the Software Center.

Steps:

  1. Right-click the .rpm file.
  2. Choose “Open With → Software Install”.
  3. Click Install and enter your password.

Behind the scenes, this uses dnf or PackageKit.


Summary of Commands

PurposeCommand
Install RPMsudo rpm -ivh package.rpm
Install with dependenciessudo dnf install package.rpm
Update RPMsudo rpm -Uvh package.rpm
Remove RPMsudo rpm -e package-name
Check installed`rpm -qa
View detailsrpm -qpi package.rpm
Verify packagerpm -V package-name

Example: Installing Visual Studio Code RPM on Fedora

Let’s do a practical example:

Step 1: Download the RPM file

wget https://code.visualstudio.com/sha/download?build=stable&os=linux-rpm-x64 -O vscode.rpm

Step 2: Install the package

sudo dnf install ./vscode.rpm

Step 3: Verify installation

code --version

Output:

1.94.2

You’ve successfully installed VS Code via RPM!


Ending Words

Installing RPM files in Linux is straightforward once you know the right commands.

The best practice for most systems is:

sudo dnf install package-name.rpm

because it automatically manages dependencies and ensures stability.

Use the rpm command only for manual installs or troubleshooting.

With this guide, you can confidently install, verify, update, and remove RPM packages like a pro — whether on Fedora, CentOS, or RHEL-based systems.

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

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