Knowledgebase

How to Install RPM files on Different Linux Distributions?

Installing software is routine but critical for Linux admins. RPM files are a common package format, especially meant for Linux distributions like Red Hat Enterprise Linux, CentOS, and Fedora, as well as their derivatives.

Installing RPM files is crucial for system stability and compatibility. This knowledge base encapsulates essential steps for downloading, installing, and removing RPM packages. Whether you manage servers or set up a development environment for your teams, you’ll find the content useful for installing .rpm files in a Linux environment. 

So, let’s dive into it!

What are RPM files?

RPM files, also known as Red Hat Package Manager, store installation packages on Linux operating systems. They are precompiled software packages used primarily in Red Hat-based Linux distributions like RHEL, CentOS, and Fedora. 

The RPM files comprise application binaries, metadata, and dependencies, which help in the efficient installation and management of software.


Also Read: Create Zip File With Command in Linux With Examples


Outstanding Features of RPM Files

RPM files are neatly wrapped packages that make software installation a breeze. Here’s what makes them stand out:

  • They create a bundle of everything an application needs in one place—executables, libraries, config files, and documentation.
  • Installing them is straightforward. Linux system admins don’t need to depend on complicated tools or expertise.
  • With cryptographic signatures, you can trust their authenticity and integrity.
  • They’re widely used in popular Linux distributions, such as Red Hat, Fedora, CentOS, Rocky Linux, and SUSE.

RPM files are great at keeping things simple, secure, and efficient!


Also Read: A Guide to Echo Command in Linux With Examples


Why are RPM files Used?

RPM files are used to simplify software distribution, installation, and management on Linux systems, especially in Red Hat-based distributions. 

Let’s look at an example:

Imagine you want to install Apache HTTP Server on a CentOS server. Without an RPM, you would have to follow a time-consuming and error-prone process:

  • Manually download the source code, 
  • Compile it, 
  • Resolve all dependencies and
  • Configure the software.

With an RPM file, you can skip all these complexities. The Apache RPM package comes precompiled with all the necessary binaries, libraries, and configuration files. 

You simply run the following command:

bash

sudo rpm -ivh httpd-2.4.57.rpm

This command will install the server in seconds, automatically handling dependencies and placing files in the right directories.

Additionally, RPM comes with built-in cryptographic signatures to ensure the package is authentic and hasn’t been tampered with. This makes RPM files not just convenient but highly secure and reliable for software management on Linux systems.


Also Read: What is Telnet Command in Windows & How to Use it?


Benefits and Challenges of RPM Files

Let us discuss the benefits of installing RPM files and the challenges faced during the process.

★ Benefits of RPM Files

1. Ease of Installation and Management

RPM files simplify the software installation process by bundling all necessary components—binaries, libraries, configuration files, and documentation—into a single package. Administrators can efficiently install, upgrade, or remove software using simple commands like rpm -ivh OR yum/dnf.

2. Easy Dependency Handling

Modern RPM-based package managers, such as dnf or yum, resolve and install dependencies automatically. They save administrators time and effort by eliminating the need to track and download additional packages manually.

3. Widely Adopted & Compatible

RPM files are the preferred package format for Red Hat-based distributions, including RHEL, Fedora, CentOS, AlmaLinux, and Rocky Linux. They are also compatible with SUSE and various other Linux distributions and offer a wide range of support options.

4. Security

RPM files support cryptographic signatures, enabling administrators to verify the authenticity and integrity of packages. This ensures that the software comes from trusted sources and has not been tampered with.

5. Version Control and Rollback

RPM packages come with helpful metadata about versioning, making it easy for administrators to check which versions are installed. If an update causes a problem, administrators can smoothly roll back to a previous version.

6. Consistency

RPM ensures that files are installed in predefined locations. This maintains consistency across systems and simplifies maintenance.


Also Read: How To Remove Directory in Linux With Command?


★ Challenges of RPM Files

1. Dependency can make conditions worse.

While modern tools reduce this issue, standalone RPM files can sometimes fail to install due to missing dependencies. Resolving these can be time-consuming and frustrating for administrators.

2. Limited to Precompiled Packages

RPM files are precompiled. Hence, customization has a limited scope. If a user needs specific configurations not included in the package, they might need to compile the software from the source.

3. Distribution-Specific Compatibility

RPM files are often tailored to specific distributions or versions (e.g., RHEL 8 vs. RHEL 9). Using an incompatible RPM can lead to installation failures or system instability.

4. Lack of Cross-Platform Use

RPM files are not directly compatible with non-RPM-based distributions like Ubuntu or Debian, which use .deb files. Conversion tools like Alien can help, but they may introduce complications.

5. Learning Curve for New Administrators

While RPM commands are straightforward, new administrators may initially struggle with advanced features like creating custom RPMs, verifying signatures, or troubleshooting installation errors. Mastering RPM commands takes time and experience.


Also Read: How to Change Server Time in Linux?


What are Prerequisites?

Let us understand the prerequisites for installing RPM files on Linux distributions.

1.Access to a Terminal with Administrative Privileges

  • Make sure you have terminal access and the necessary permissions to run commands with sudo or as the root user.

2. RPM Package Manager is Installed

  • The rpm command-line tool must be available on your system. Most RPM-based distributions, such as RHEL, CentOS, Fedora, and Rocky Linux, include this by default.

3. Supported Linux Distribution

  • Ensure your Linux distribution supports RPM files. Examples include Red Hat Enterprise Linux (RHEL), CentOS, Fedora, Rocky Linux, AlmaLinux, and SUSE Linux.

4. Compatible RPM File

  • Verify that the RPM file is compatible with your Linux distribution and version to avoid compatibility issues.

5. Dependencies

  • Check and install any dependencies that the RPM package requires. It is important to note that tools like yum, dnf, or zypper (for SUSE) can automatically resolve and install dependencies.

6. Internet Connectivity (Optional but Recommended)

  • Internet access is not mandatory for standalone RPMs, but having one will help download dependencies or updated versions of the package.

7. GPG Key Verification

Obtain and import the GPG key to verify the RPM package’s authenticity. 

Use commands like:

bash

rpm –import <GPG-key-file>

8. SELinux Settings (If Enabled)

  • If SELinux is enforced, ensure the RPM package complies with your SELinux policies. You may need to adjust policies using tools like semanage.

9. Disk Space

  • Confirm that you have sufficient disk space to install the software and its dependencies.

10. Basic Understanding of RPM Commands

  • Familiarize yourself with basic RPM commands for installing, upgrading, and removing packages:
bash

rpm -ivh <package.rpm>   # Install

rpm -Uvh <package.rpm>   # Upgrade
rpm -e <package-name>    # Remove

Having these prerequisites in place ensures a smooth installation process for RPM files on your Linux system.


Also Read: How To Access Linux Server Using PuTTY SSH Terminal?


How to Download the RPM Installation File?

There are two ways to download the RPM installation file. 

1. From the Internet.

2. From a repository that your package manager uses

Download the RPM Installation File From the Internet

Following these steps will enable you to securely download RPM files from the internet and prepare them for installation on your Linux system.

To download an RPM file from the internet, use a web browser or the wget tool via the command line. Below are examples for installing wget on various operating systems:

➔ For installing wget in CentOS and other distributions by using yum, you have to run the given command below:

sudo yum install wget

➔ For installing wget in Fedora and other distros, In that case, you have to use the syntax that dnf, run:

sudo dnf install wget

➔ Once you installed the wget command, use the syntax below to download an RPM file from the internet:

wget http://some_website/sample_file.rpm

➔ You have to replace http://some_website/sample_file.rpm with the link to the RPM file, and the command downloads it to your current directory.

➢ Download the RPM installation file from the repository that your package manager uses.

Following these steps will enable you to securely download RPM files from your package manager’s repository to install on your Linux system.

To download RPM files directly from the repository, The yum and dnf package managers enable you to download RPM files directly. It is very useful when your bandwidth is limited, or you need to transfer files between systems.

For downloading an RPM file from the repository by using yum, you have to use the given syntax below:

sudo yumdownloader [package_name]

You have to replace [package_name] that you want to download.

If you want to download an RPM file with dnf, you have to use the following syntax:

dnf download [package_name]

Also Read: How to Create a User in Linux & Add it to the sudoer File?


How to Install RPM File on Linux?

Installing an RPM file on Linux is straightforward. Here’s a step-by-step explanation in simple terms:

1. Open the Terminal

On your Linux system, open the terminal where you’ll enter the necessary commands.

2. Navigate to the Folder with the RPM File

Use the cd command to go to the directory where the RPM file is saved. 

For example:

bash

cd /path/to/your/rpm/file

3. Use the rpm Command to Install the File

To install the RPM file, run:

bash

sudo rpm -ivh package-name.rpm
  • Replace package-name.rpm with the name of your RPM file.
  • The -i option stands for “install.”
  • The -v adds more details during installation. 
  • The -h shows a progress bar.

4. Use yum or dnf for Automatic Dependency Resolution (Preferred)

If the package needs additional files (dependencies), you can use yum (older systems) or dnf (modern systems) to install the RPM and its dependencies:

bash

sudo dnf install ./package-name.rpm

OR

bash

sudo yum install ./package-name.rpm

5. Verify the Installation

After installation, you must verify if the package is installed properly using:

bash

rpm -q package-name

Replace the package-name with the name of the software (without the .rpm).

6. Start Using the Installed Software

If the software is a service or application, start or configure it as needed.

For example:

bash

sudo systemctl start service-name

Also Read: How to Log into SSH using Password Authentication?


How to Remove RPM Packages?

Proper removal of RPM packages is crucial, just like installation. To remove an RPM package, you can employ one of the following methods.

  1. Removal using the RPM installer.
  2. Removal using the yum package manager.
  3. Removal using the dnf package manager.

1. Using the RPM Installer

The rpm command can directly remove installed packages. Use the following steps:

Find the Exact Package Name:

bash

rpm -q package-name

Replace the package-name with the name of the software.

Uninstall the Package:

bash

sudo rpm -e package-name

Replace the package-name with the full name of the installed package.

Example:

To remove Apache HTTP Server, you should run:

bash

sudo rpm -e httpd

2. Using the yum Package Manager

yum is commonly used on older RHEL, CentOS, and Fedora systems. It automatically handles dependencies during uninstallation.

➔ Find the Installed Package:

bash

yum list installed | grep package-name

➔ Remove the Package:

bash

sudo yum remove package-name

➔ Replace the package-name with the name of the software.

Example:

To remove the Apache HTTP Server:

bash

sudo yum remove httpd

3. Using the dnf Package Manager

dnf is the modern replacement for yum on newer RHEL, Fedora, and CentOS versions. It’s faster and more efficient.

➔ Find the Installed Package:

bash

dnf list installed | grep package-name

➔ Remove the Package:

bash

sudo dnf remove package-name

➔ Replace the package-name with the name of the software.

Example:

To remove the Apache HTTP Server:

bash

sudo dnf remove httpd

*Important: Which Method Should You Use?

➔ Use dnf on newer systems (RHEL 8+, CentOS 8+, Fedora).

➔ Use yum on older systems (RHEL 7 or earlier).

➔ Use rpm if you prefer manual control or are working with minimal systems without yum or dnf.

Each method safely removes the RPM package successfully, but yum and dnf are better for handling dependencies automatically.


Also Read: What is PM2 and How Can You Use it?


Conclusion

Mastering the installation of RPM files is crucial for Linux system administrators, particularly when utilizing distributions such as Red Hat, CentOS, Fedora, or SUSE. 

Familiarizing yourself with the relevant tools and processes—whether employing the rpm command for manual operations or utilizing package managers like dnf or yum for efficient dependency management—will enable you to carry out software installations smoothly across diverse environments.

This guide equips you with the knowledge to confidently manage RPM-based packages, from downloading RPM files to verifying their authenticity and handling dependencies. With practice, managing RPM files will become an effortless part of your system administration workflow.

Keep exploring, stay updated with your distribution’s package management tools, and you’ll always be ready to install or troubleshoot RPM files with ease!

Lack-of-Customer-Support
You Don’t Deserve a Provider That Not Supports You!

You need a hosting provider that stands with you!