Two Elegant Methods to Install RPM Files on CentOS, Fedora, and RHEL

Published December 29, 2023

Lets travel through the insights of,

Two Elegant Methods to Install RPM Files on CentOS, Fedora, and RHEL.

RPM Files on CentOs

Explore More ; Exploring the Dynamic World of LVM in Linux

One of the file formats that is more noticeable when interacting with and managing files in the Red Hat family of Linux distributions is files with the .rpm extension. An RPM (Red Hat Package Manager) file is a specific software package in a file format used by Red Hat-based distributions such as Fedora, CentOS, and Red Hat Enterprise Linux (RHEL). Like DEB packages in Debian-based systems, RPM files are used to install, distribute, upgrade, remove, and generally manage software packages across a wide range of Linux systems, especially in organizational environments.

Additionally, RPM files handle the installation’s correctness, required components, and dependency resolution. The rpm files are designed in such a way that they can be installed outside of the software repository.

Essential Requirements for RPM File Installation

To leverage RPM features on your system or Linux VPS, running RedHat-based distributions like CentOS, Fedora, and RHEL is essential. Ensure the presence of crucial package management tools such as yum, rpm, and dnf, which streamline the installation, removal, and updating of RPM packages by default in RHEL-based distributions.

For installing an RPM file in Linux CentOS, Fedora, and RHEL, you must have a user account with sudo privileges.

Downloading an RPM File in Linux Terminal

To install an RPM file, begin by downloading the .rpm file from a trustworthy and official source using a browser or the wget command.

If the wget command is not supported by your Linux system by default, you can install it on your CentOS or Fedora system by opening the terminal (using keyboard shortcuts like Ctrl+Alt+T) and executing the following commands in Linux RHEL derivatives:

  • Installing wget on CentOS:

sudo yum install wget

  • Installing wget on Fedora:

sudo dnf install wget

Now that you have equipped CentOS and Fedora systems with the wget command-line tool, you can download an RPM file using the wget command:

wget <URL_of_RPM_file>

Replace <URL_of_RPM_file> with the URL of the RPM file you want to download.

For example:

wget https://example.com/path/to/your/package.rpm

“As a result, wget will showcase the download process in the terminal. Upon completion, you’ll receive a message confirming a successful download.

To verify the successful download of the file, execute the following command to list the contents of the current directory:

ls

As a result, by observing the downloaded RPM file in your current directory, you will be assured of a successful download of the RPM file.

Method 1: Installing an RPM File Using rpm Command

To install an RPM package on CentOS, Fedora, and RHEL derivatives, one commonly used method involves the rpm command. While the rpm command serves as a lower-level package manager for installing RPM files, it lacks automatic dependency handling. Consequently, if you use the rpm command for installing RPM files, you may need to install dependencies separately.

To begin, employ the cd command to access the directory housing the downloaded RPM file. Alternatively, you can find the recently downloaded RPM file in the directory using the Files app. Open the terminal by right-clicking anywhere in the folder and choosing the ‘Open in Terminal‘ option to proceed.

Then run the following command to install the RPM file:

sudo rpm -i /path/to/package.rpm

Or

sudo rpm -i “package_name.rpm”

Substitute /path/to/package.rpm and package_name.rpm with the real path or name of the RPM file you wish to install.

Copying the package name might pose a challenge. You can simplify this by dragging and dropping the RPM file into the terminal or typing the initial letters of the package name and pressing “Tab” for automatic completion. Then, press the “Enter” button.

Method 2: Installing RPM File Using yum Command (CentOS and RHEL)

To install an RPM file on RHEL-based distributions like CentOS, utilize the yum package manager with the “localinstall” option. The “localinstall” option directs the yum package manager to search for the downloaded RPM file in the current directory and employ it for the installation of the RPM package. Execute the following command on CentOS and RHEL systems to accomplish this:

sudo yum localinstall /path/to/package.rpm

Or

sudo yum localinstall “package_name.rpm”

Substitute /path/to/package.rpm and package_name.rpm with the real path or name of the RPM file you wish to install.

One of the valuable advantages of the yum package manager is its capability to directly download and install an RPM file from the repository. If you haven’t downloaded the RPM file previously using the wget command and want to save bandwidth and time, you can directly download the RPM file from the repository using the yum package manager:

sudo yumdownloader packagename

Explore more; Rocky Linux vs CentOS
Stay Connected on Meta, X, Instagram .