How To Install An Rpm

How To Install An Rpm

Reading time1 min
#Linux#OpenSource#Software#RPM#PackageManagement#RedHat

Mastering RPM Installation: A Step-by-Step Guide for Precision Package Management

Forget one-click installs: Dive deep into the nuances of RPM installation to unlock greater control over system dependencies, package versions, and conflict resolution that GUI tools often obscure.

If you’re a system administrator or developer working with Red Hat-based Linux distributions—such as RHEL, CentOS, or Fedora—knowing how to efficiently install RPM (Red Hat Package Manager) packages isn’t just a bonus skill; it’s essential for maintaining system stability, ensuring security, and optimizing software deployment.

In this post, I’ll walk you through the fundamentals of installing RPM packages using command-line tools, best practices for handling dependencies and conflicts, and practical tips to make your package management smoother and more precise.


What Is an RPM Package?

Before we jump into installation steps, let’s clarify what an RPM package actually is. An RPM file (.rpm) is a precompiled software package tailored for Red Hat-based Linux distributions. It contains the application’s binaries, configuration files, and metadata including version information and dependency requirements.

Using RPM files directly allows:

  • Granular control over which package version gets installed
  • Ability to troubleshoot dependency problems explicitly
  • Offline or isolated installs without relying on a network repository

Step 1: Prepare Your System

Before attempting RPM installations, update your system repository cache:

sudo yum makecache

or on newer systems using dnf:

sudo dnf makecache

This ensures your package manager metadata is up-to-date when resolving dependencies.

Also, verify that your package management tools are installed:

which rpm
which yum   # or dnf depending on OS/version

Step 2: Understanding the rpm Command

The core utility to manage RPM packages is rpm. It offers powerful options but does not resolve dependencies automatically, so it’s often paired with higher-level tools like yum or dnf.

Basic installation command:

sudo rpm -ivh package-name.rpm

Where:

  • -i: install
  • -v: verbose output
  • -h: progress hash marks

Keep in mind: If dependencies aren’t met, this will fail with errors indicating missing packages.


Step 3: Installing an RPM Package From File – The Basics

Suppose you have downloaded a package file called example-app-1.2.3.rpm. To install it directly:

sudo rpm -ivh example-app-1.2.3.rpm

Output Example:

Preparing...                ################################# [100%]
   1:example-app            ################################# [100%]

If successful, the app is installed. Use:

rpm -q example-app

to verify installation (it queries installed packages).


Step 4: Handling Dependencies Manually

Say the above fails with messages like:

error: Failed dependencies:
    libexample.so.1()(64bit) is needed by example-app-1.2.3.x86_64

This means example-app requires a library not currently installed.

To address this manually:

  1. Check if dependency packages are available via your repos using yum/dnf:
yum provides '*libexample.so.1'

or

dnf provides '*libexample.so.1'
  1. Install the required dependency first:
sudo yum install libexample-package-name
  1. Retry the initial RPM installation.

Tip: To avoid this manual juggling, consider using yum or dnf localinstall.


Step 5: Using yum or dnf to Simplify Installation with Dependency Resolution

Instead of using plain rpm, you can use higher-level managers that automatically download dependencies:

sudo yum localinstall example-app-1.2.3.rpm

or

sudo dnf install ./example-app-1.2.3.rpm

These commands wrap around rpm but resolve and fetch dependencies from configured repositories, resulting in smoother installs.


Step 6: Upgrading vs Fresh Install

To upgrade an existing package (if installed older version exists), use:

sudo rpm -Uvh example-app-1.2.4.rpm

where -U stands for “upgrade” (will perform fresh install if old version missing).

Note: Avoid mixing versions carelessly as older downgrades require special handling (--oldpackage flag).


Step 7: Uninstalling Packages

Removing a package cleanly is as simple as:

sudo rpm -e example-app

Replace example-app with actual package name — do not include .rpm.

You can check installed packages with:

rpm -qa | grep example-app

before removal if needed.


Additional Tips for Precision Management

Viewing Package Info before Installation

Check details inside an rpm file without installing it:

rpm -qpi example-app-1.2.3.rpm   # Info about the package  
rpm -qpl example-app-1.2.3.rpm   # Lists files contained  
rpm -qpR example-app-1.2.3.rpm   # Lists required dependencies  

Verifying Packages Post-installation

Make sure files are intact:

rpm -V example-app 
# Outputs nothing if everything matches perfectly.

Forcing Installation (Use With Caution!)

Sometimes you might want to ignore certain checks:

sudo rpm --force -ivh example-app.rpm 

But forcing can break your system stability—use only if you know what you’re doing.


Summary Checklist for Mastering RPM Installation

TaskCommand ExampleNotes
Install RPM directlysudo rpm -ivh package.rpmDoes not resolve dependencies automatically
Install with depssudo yum localinstall package.rpmAutomatically resolves & downloads deps
Upgrade a packagesudo rpm -Uvh updated-package.rpmUpgrades or fresh installs
Remove/uninstallsudo rpm -e packagenameRemove by package name
View info about pkgrpm -qpi package.rpmView metadata
List files in pkgrpm -qpl package.rpmPre-check contents
Verify installed pkgrpm -V packagenameConfirm no file changes

Wrapping Up

Mastering RPM installation from the command line empowers you with precision control over your Linux environment — going beyond GUI installers’ simplicity to tackle complex real-world requirements like dependency conflicts or offline installs.

While tools like yum and dnf have made life easier by resolving dependencies automatically during installations, knowing how to work directly with rpm commands can save time and prevent headaches when things don’t go according to plan.

Next time you download an .rpm, don’t just double-click – take charge of your system’s health by mastering the command line approach! Your servers and software will thank you.


If you found this guide helpful or have any questions about tricky RPM scenarios you've faced—drop a comment below! I’m happy to help untangle those pesky dependency issues together.

Happy packaging! 🚀