How to Install an RPM File On Linux OS (CentOS, RHEL, & Fedora)?

If you are a Linux user, you are likely to encounter RPM files at some point. An RPM file, or Red Hat Package Manager, is a package management system for installing, updating, and removing software on Linux operating systems such as CentOS, RHEL, and Fedora. RPM files are similar to .deb files in Debian-based operating systems.

In this article, we will guide you through the steps required to install an RPM file on Linux operating systems such as CentOS, RHEL, and Fedora.

Step 1: Download RPM File

Before you can install an RPM file, you must first download it from a reliable source. You can obtain RPM files from various sources, such as official software repositories, software vendors, or third-party websites.

Once you have downloaded the RPM file, you should check the file's integrity to ensure that it has not been tampered with or corrupted during the download process. You can use MD5 or SHA1 checksums to verify the integrity of the file.

# Verify file integrity using MD5 checksum
md5sum filename.rpm

# Verify file integrity using SHA1 checksum
sha1sum filename.rpm

Step 2: Install RPM File Using YUM/DNF

After downloading the RPM file, you can proceed with the installation process. The simplest way to install an RPM file on Linux is to use the YUM package manager (CentOS/RHEL 7 and earlier) or DNF (Fedora and newer versions).

Using YUM (CentOS/RHEL 7)

sudo yum install /path/to/rpm/file.rpm

Using DNF (Fedora, CentOS/RHEL 8+)

sudo dnf install /path/to/rpm/file.rpm

Replace /path/to/rpm/file.rpm with the actual path to your downloaded RPM file. These commands will install the RPM file and any dependencies required for the package to function correctly.

Step 3: Install RPM File Using RPM Command

You can also install an RPM file directly using the rpm command. This method gives you more control but requires manual dependency management.

# Install RPM package
sudo rpm -ivh /path/to/rpm/file.rpm

# Upgrade existing package
sudo rpm -Uvh /path/to/rpm/file.rpm

The -i option indicates installation, -v enables verbose output, and -h displays hash marks for progress indication.

Step 4: Verify Installation

After installing the RPM file, verify that the package is installed correctly:

# Check if package is installed
rpm -qa | grep package_name

# Get detailed package information
rpm -qi package_name

Replace package_name with the name of the installed package. This will display the package name and version, confirming successful installation.

Common RPM Commands

Command Purpose
rpm -ivh file.rpm Install package with verbose output
rpm -Uvh file.rpm Upgrade existing package
rpm -e package_name Remove/uninstall package
rpm -qa List all installed packages
rpm -qpR file.rpm Check package dependencies
rpm -K file.rpm Verify package signature

Troubleshooting Common Issues

Dependency Problems

If you encounter dependency issues, check what dependencies are required:

# Check package dependencies
rpm -qpR /path/to/rpm/file.rpm

# Test installation without actually installing
rpm -i --test /path/to/rpm/file.rpm

Package Conflicts

If there are conflicts with existing packages:

# Force removal without dependency checking (use cautiously)
sudo rpm -e --nodeps conflicting_package_name

# Install with force (use cautiously)
sudo rpm -ivh --force /path/to/rpm/file.rpm

Security Considerations

When installing RPM files, always consider security:

  • Download from trusted sources Only download RPM files from official repositories or verified vendors.

  • Verify signatures Use rpm -K filename.rpm to check digital signatures.

  • Check file integrity Verify checksums before installation.

  • Review package contents Use rpm -qpl filename.rpm to list files in the package.

Managing Configuration Files

Some RPM packages include configuration files that may need customization:

# List configuration files for a package
rpm -qc package_name

# View package scripts
rpm -q --scripts package_name

After modifying configuration files, restart the associated service:

# Restart service using systemctl
sudo systemctl restart service_name

# Check service status
sudo systemctl status service_name

Conclusion

Installing RPM files on CentOS, RHEL, and Fedora is straightforward using either YUM/DNF or the direct rpm command. Always verify file integrity, check dependencies, and download from trusted sources to maintain system security and stability.

Updated on: 2026-03-17T09:01:38+05:30

6K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements