How to Install RPM Package With Dependencies? [3 Methods]

An RPM package is a software distribution format that is handled by RPM(RedHat Package Manager) primarily in RedHat-based Linux distributions. Various Linux distributions beyond RHEL (RedHat Enterprise Linux) such as CentOS, Fedora, and others use it. However, installing rpm or any other package in your system may prerequisite some other packages called dependencies. This tutorial will guide you to successfully install an RPM package with all its dependencies.

Key Takeaways

  • Installing RPM package in Ubuntu, RHEL, and Fedora.
  • Inspecting dependency issues regarding Photocollage installation.
  • Resolving dependency automatically using apt and yum.

Requirements

Process Flow Chart

[Distros Used Throughout the Tutorial: Ubuntu 22.04.1 LTS and RHEL 9.2]Flowchart showing 3 methods of installing RPM with dependencies.

Free Downloads

Process to Install RPM With Dependencies in Various Distributions of Linux

Dependencies specify what other packages need to be installed on the system for a particular package to work as intended. “.rpm” is a package extension used to install software on Linux distributions that follow the RedHat ecosystem. I’ll show you one way for RedHat-based distribution and two ways for Debian-based distributions that you can use to install any .rpm package in your running system.

A. Install RPM With Dependencies in RedHat-Based Distros Using YUM

Actually, rpm packages are built to run in RedHat-based Linux distributions such as CentOS, Fedora, and RHEL. These distributions have two widely used package managers called “yum” and “rpm”. YUM (Yellowdog Updater, Modified) is a command-line package management tool used primarily in Red Hat-based Linux distributions. It is a high-level package management tool that provides an efficient way to install and update software, and automatically handle dependencies on these distributions. I’ll show the installation of gnome-photos using yum which is a photo-sharing application for Linux.

Steps to Follow >

➊ Open the RHEL/Fedora terminal.

➋ Run the below command:

sudo yum install gnome-photos

EXPLANATION

  • sudo: Enables administrative permission.
  • yum: Calls yum package management tool.
  • install: Command to install a package.
  • gnome-photos: Name of the package.

➌ Enter the user password.

➍ Type Y when the confirmation prompt appears.

➎ Press ENTER.Using YUM to install gnome-photos in RHEL terminal. The above command will show a list of dependencies and yum will automatically install all those dependencies. In case you want to install a locally downloaded .rpm file using yum, run the below command:

sudo yum install <filename.rpm>
Note: Navigate to the directory where the .rpm file is located by the cd command. Then run the above command replacing <filename.rpm> with the actual name of the rpm file.

B. Install RPM With Dependencies in Debian-Based Distros

Although rpm is a package type built for RedHat-based distribution, you can install an rpm package in the Debian-based system by converting the file type from rpm to deb. To illustrate, I’ll install the rpm file of Photocollage in Ubuntu by two methods. In the first method, I’ll show the installation of the rpm file of Photocollage by alien tool. Secondly, I’ll use alien to convert the rpm file to deb package and then install the deb with dpkg.

You can read our Comparative Analysis of Methods to distinguish between these two methods and best pick one for your need.

Method 01: Using Alien to Directly Install RPM Package in Ubuntu

alien” is a command-line tool used to convert and install packages between different package formats on Debian-based Linux distributions. You can use it to convert rpm packages into Debian packages (.deb files) or vice versa. Follow these steps to install a Photocollage.

Steps to Follow >

➊ Download the RPM file from a trusted source. You can download and extract the Photocollage-1.4.5 rpm file from the Free Downloads section in this article.

➋ Open the Ubuntu terminal.

➌ Run the below command to verify the download:

ls Downloads/

LS command shows content of download folder in Ubuntu.➍ Go to Downloads/ directory:

cd Downloads/

➎ Use the following command to convert the rpm file into a deb file.

sudo alien -i photocollage-1.4.5-2.fc39.norarch.rpm

EXPLANATION

  • lsList all files and folders in the current directory.
  • cd: Command for changing directory.
  • alien: Using alien package converter tool.
  • -i: Flag for installing a package using alien.
  • photocollage-1.4.5-2.fc39.noarch.rpm: Full name of the package.

➏ Type the user password.

➐ Press ENTER.Alien installing rpm file in Ubuntu. Now, alien will install the rpm file in Ubuntu.

Method 02: Using DPKG to Install RPM Package in Ubuntu

DPKG (Debian Package Manager) is a low-level package manager used in Debian-based Linux distributions such as Ubuntu. dpkg is the package management tool provided by DPKG that can install any .deb file without resolving dependencies. So, a rpm file can’t be directly installed by dpkg. But you can convert the rpm file to a deb package using alien.

Step 01: Converting “.rpm” to “.deb” File in Ubuntu

After downloading the RPM file, just follow the steps to convert the .rpm file to .deb file:

Steps to Follow >

➊ Open the Ubuntu terminal.

➋ Run the following command from the home directory:

cd Downloads/
sudo alien -d photocollage-1.4.5-2.fc39.norarch.rpm

EXPLANATION

  • sudo: Grants administrative privileges.
  • alien: Using Alien package converter tool.
  • -d: Flag for converting an rpm package into a Debian (.deb) file.
  • photocollage-1.4.5-2.fc39.noarch.rpm: Full name of the package.

Converting RPM to DEB.The above command will convert the photocollage-1.4.5-2.fc39.norarch.rpm file into photocollage-1.4.5-2.fc39.norarch.deb file. You can find it in the same Downloads/ directory.Download folder has a rpm file and converted deb file of photocollage.

Step 02: Install the Converted “.deb” File in Ubuntu

After converting the rpm into deb, you can use dpkg to install the deb file. Go back to your terminal and follow the steps:

Steps to Follow >

➌ Run the following command:

sudo dpkg -i photocollage-1.4.5-2.fc39.norarch.deb

EXPLANATION

  • sudo: Grants administrative privileges.
  • dpkg: Calls dpkg package management tools.
  • -i: Flag for installing a package using dpkg.
  • photocollage-1.4.5-2.fc39.norarch.deb: Full name of the .deb file.

Installing photocollage with dpkg.The above command will install the .deb file of Photocollage using dpkg.

Note: If you face any dependency error here, have a look into the Common Challenge section in this article.

Comparative Analysis of Methods

I’ve shown two ways to install an rpm package with dependencies in Ubuntu. You might be confused to decide which one suits you the best. Here’s a comparison between the methods provided to give you an overview of the pros and cons.

Methods Pros Cons

Method 1: Using alien

  • Let the user use RedHat software in the Debian distribution.
  • Can’t install dependency.

Method 2: Using dpkg

  • Step 1 of this method can be used to build the deb file from the rpm package.
  • dpkg installs dependency automatically. It takes the help of apt for this purpose.

If you want to use RedHat software in Ubuntu, then Method 1 is the best choice for you. In addition, if you are a developer or willing to test an rpm package in a Debian-based system for inspection purposes, then Method 2 can be helpful for you.

Common Challenge: Dependency Error in Ubuntu

In Method 2, I’ve shown a way to install the converted deb file by dpkg. To illustrate the process by example I’ve installed Photocollage which showed no dependency error but, other packages may show. For example, dependency errors like the below image may occur if you use the TeamViewer package instead of Photocollage.Dependency error when installing teamviewer. To resolve this kind of dependency error, follow these steps:

Steps to Follow >

➊ Open the Ubuntu terminal.

➋ Run the following command:

sudo apt install -f

EXPLANATION

  • sudo: Enables administrative permission.
  • apt: Calls apt package management tools.
  • install: Command for installing a package using apt.
  • -f: Flag that indicates to fix the dependencies.

➌ Type when the confirmation prompt appears.

➍ Press ENTER.Fixing dependencies by apt. After fixing the dependency error by the above command, you can run the “sudo dpkg -i <filename.deb>” command to install the package, and this time no dependency error will occur.

Install the Alien Tool in Ubuntu

“Alien” is a command-line tool that helps in converting and installing packages between different package formats. It primarily deals with converting packages from the .deb format used by Debian-based systems like Ubuntu to other formats such as .rpm used by Red Hat-based systems and vice versa. To install alien, follow these steps:

Follow the Steps >

➊ Open the Ubuntu terminal.

➋ Run the following command:

sudo apt-get update

Updating apt-get.It will update the apt-get tool.

➌ Run the following command to add the “universe” component to all repositories:

sudo add-apt-repository universe

➍ Type the user password.

➎ Press ENTER.

Adding universe component to all the repositories.➏ Run the below command to install alien:

sudo apt install alien -y

Installing alien by apt-get.Thus, you can install alien on your system.

Conclusion

RPM is a package type generally used in RedHat-based Linux distributions. RedHat provides yum which is a high-level package management tool that can handle dependencies automatically when installing any rpm package. Moreover, you can install an rpm package in your Debian-based system also by converting it into a deb package by alien. However, it’s generally recommended to use packages that are specifically built for your distribution to ensure system stability and proper functionality.

People Also Ask

How to download RPM with all dependencies?
To download any rpm file with all dependencies, you have to use yum with the syntax: sudo yum install <package-name>. It will automatically resolve all dependencies.

Does RPM contain dependencies?
Yes, RPM contains dependencies like almost every other package in Linux. This is because Linux software is built like a collection of modules to ensure reusability. So, installing an RPM package may depend on some other packages called dependencies.
How to install RPM ignoring dependencies?
You can ignore dependencies by using the  –nodeps option. The complete syntax is sudo yum install –nodeps <package-name>. Yum will install the package without considering the dependencies by this command.
How to install RPM with dependencies in Ubuntu?
As RPM packages are not written for Ubuntu, first you have to convert the .rpm file to .deb file by alien. Then install the deb file with the command sudo dpkg -i <filename.deb> replacing <filename.deb> by replacing the full name of the converted .deb file. If any dependency error shows, then install those dependencies and then try again to run the above command.

Related Articles


<< Go Back to Dependencies in Linux | Package Management in Linux | Learn Linux Basics

Rate this post
LINUX
FUNDAMENTALS
A Complete Guide for Beginners Enroll Course Now
Ashikur Rahman

Hello, I’m Ashikur Rahman, currently working as a Linux Content Developer Executive at SOFTEKO. I have completed my graduation in Computer Science and Engineering from Khulna University of Engineering & Technology (KUET). Also, I’m pursuing my master’s in the same department at Bangladesh University of Engineering & Technology (BUET). I like to learn new technologies, contribute, and share those with others. Here my goal is to provide beneficial and user-friendly articles on Linux distribution for everyone. Read Full Bio

Leave a Comment