Methods to Install RPM File in Linux CentOS, Fedora, RHEL

4 Ways to Install RPM File in Linux CentOS, Fedora, RHEL

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.

As we previously covered how to install local packages (.DEB) on Debian for Debian and Ubuntu users, now, aiming to assist RHEL-based users, we have decided to provide a guide on installing local packages (.rpm) on RHEL-based systems. If you are using Linux distributions from the RedHat family and your system lacks the RPM Installation File, in this article, you will learn the common methods to install RPM files in Linux CentOS, Fedora, and RHEL. Isn’t it interesting that you will improve your Linux handling by spending 5 minutes of your time? Let’s start.

Prerequisites for Installing RPM file

Since RedHat-based distributions use RPM files for managing and installing software packages, you need a system or Linux VPS running RedHat-based distributions such as CentOS, Fedora, and RHEL to utilize RPM features.

Furthermore, the RPM system includes tools like yum, rpm, and dnf, which assist users in simplifying the installation, removal, and updating of RPM packages. Therefore, ensure the availability of these package managers (by default, all these package managers are available in RHEL-based distributions).

To install an RPM file in Linux CentOS, Fedora, and RHEL, you need a user account with sudo privileges.

Downloading an RPM File in Linux Terminal

To install an RPM file, you must first download the .rpm file from a reliable and official source using a browser or the wget command. Using the wget command in the Linux terminal is a suitable method for downloading the RPM file of your desired program. Your Linux system may not support the wget command by default, so after opening the terminal in your CentOS or Fedora system (using keyboard shortcuts like Ctrl+Alt+T), you can install wget in Linux RHEL derivatives using the following commands:

  • 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 displays the download process in the terminal, and after completing the download, you will receive a message indicating a successful download.

To confirm that the file has been successfully downloaded, you can list the contents of the current directory by executing the following command:

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.

Note: Exercise caution when using a source to download an RPM file and ensure its validity before installation.

Once you have successfully downloaded the RPM file on CentOS or Fedora and RHEL systems, you can proceed to install the RPM package using your package manager, such as “dnf” for Fedora or “yum” for CentOS.

Method 1: Installing an RPM File Using rpm Command

For installing an RPM package on CentOS, Fedora, and RHEL derivatives, the rpm command is one of the common methods. The rpm command is a lower-level package manager used for installing RPM files, but it lacks automatic dependency handling. Therefore, if you install RPM files using the rpm command, you may need to install dependencies separately.

To start, use the cd command to enter the directory containing the downloaded RPM file. Alternatively, you can locate the recently downloaded RPM file in the directory using the Files app and open the downloaded RPM file in the terminal by right-clicking anywhere in the folder and selecting the ‘Open in Terminal‘ option.

Then run the following command to install the RPM file:

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

Or

sudo rpm -i "package_name.rpm"

Replace /path/to/package.rpm and package_name.rpm with the actual path or name of the RPM file you want to install.

Copying the package name might be challenging for you. You can drag and drop the RPM file into the terminal or type the package name’s first few letters and press “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, you can use the yum package manager with the “localinstall” option in RHEL-based distributions like CentOS. The “localinstall” option instructs the yum package manager to look for the downloaded RPM file in the current directory and use it for installing the RPM package. To achieve this, run the following command on CentOS and RHEL systems:

sudo yum localinstall /path/to/package.rpm

Or

sudo yum localinstall "package_name.rpm"

Replace /path/to/package.rpm and package_name.rpm with the actual path or name of the RPM file you want to install.

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

sudo yumdownloader packagename

Method 3: Installing RPM File Using dnf Command (Fedora and RHEL)

dnf is the RHEL-based and Fedora systems package manager that allows users to install RPM files. Similar to yum, dnf also supports the “localinstall” option for installing RPM files and automatically managing dependencies. To install an RPM file on Fedora and RHEL systems using dnf , use the following syntax:

sudo dnf localinstall /path/to/package.rpm

Or

sudo dnf localinstall "package_name.rpm"

Replace /path/to/package.rpm and package_name.rpm with the actual path or name of the RPM file you want to install.

Now, you should see the program in the list of programs on your Linux system.

Yum is used in CentOS and older RHEL versions, while recent RHEL versions like Fedora use dnf, which is a newer package manager. Both of these package managers automatically handle dependencies. Therefore, based on your distribution, you should choose the appropriate method for installing an RPM file. However, using dnf and yum commands is recommended compared to the rpm command.

Method 4: Installing RPM File Using GUI

Up to this point in the article, you’ve installed the RPM file on your system using the Linux terminal. In this article section, you will learn how to install an RPM file using the GUI. GUI is a popular and simpler method for installing RPM files on your Linux system. Let’s learn how to install an RPM file in Fedora and choose the most suitable method based on your preferences. It’s important to note that the RPM file installation method in Fedora is the same as with other RHEL derivatives.

To install the RPM package of the app, you need to use the package management tools provided by the respective desktop environments. KDE and GNOME are two common desktop environments in RHEL-based distributions, such as CentOS and Fedora, where the method of installing RPM files in each of these environments will be explained.

GNOME Desktop Environment:

1. First, download the RPM package of the app.

2. Usually, recently downloaded files are stored in the “Download” folder, so find the downloaded RPM file in the “Download” folder. Alternatively, open the “Software” application from the application menu, click on the “Files” menu, and click “Open…” to enter the location where the RPM file is saved.

3. After finding the downloaded RPM file, double-click on it.

4. The “Software” application will open and provide information about the RPM package. In this guide, we intend to install “Google Chrome.rpm” (the popular browser Google Chrome). Therefore, to achieve this goal, click the “Install” button to install the package.

RPM File installation Using GUI

5. If prompted, enter your password and press the “Enter” button.

After completing the installation, you should see the program (e.g., Google Chrome) in your list of applications.

KDE Desktop Environment:

1. Open the “Discover” application from the applications menu.

2. By selecting “Files” > “Open…“, open the directory where the RPM file is located.

3. Double-click on the downloaded RPM file to open it.

4. The Discover application will display information about the RPM package. Click the “Install” button to install the package.

How to remove an RPM package?

When you no longer need an RPM package, you can easily remove it from your system using the rpm command or package management tools such as yum and dnf. Here are three common methods for removing an RPM package:

sudo rpm -e package_name

Or

sudo yum remove package_name

Or

sudo dnf remove package_name

Replace package_name with the actual name of the RPM package you want to remove.

Exercise caution when removing packages to prevent accidental deletion of critical system components. Always review the list of packages to be removed before proceeding with the deletion.

Conclusion

RPM packages play a significant role in facilitating software management, installation, and removal on RHEL-based systems. You have now learned how to equip CentOS, Fedora, and RHEL systems with RPM packages and streamline software management effectively.

This article provides four common and valuable methods for installing RPM files on CentOS, Fedora, and RHEL. You can install RPM packages on Linux using any method that you find most convenient. If you have any questions or suggestions, feel free to share them with us in the comments section.

Thank you for your choice.

Leave a Reply

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