How To Install Rpm Package In Ubuntu

How To Install Rpm Package In Ubuntu

Reading time1 min
#Linux#OpenSource#Software#Ubuntu#RPM#PackageManagement

Mastering RPM Installation on Ubuntu: A Pragmatic Guide for Seamless Package Management

Forget the usual advice to convert RPMs to DEB or endlessly hunt for alternative packages. If you’re running Ubuntu and need to install software distributed only as RPM packages—common in many enterprise and legacy environments—you’re probably aware this isn't straightforward. But don’t worry. This practical guide cuts through the noise and shows you exactly how to install RPM packages on Ubuntu reliably, while preserving dependencies and system stability. Read on and empower yourself as a versatile Linux administrator.


Why Installing RPMs on Ubuntu is Tricky (and Worth It)

Ubuntu’s default package format is .deb, managed through APT (apt-get or apt). Red Hat-based distributions like CentOS, Fedora, and RHEL use .rpm files with YUM or DNF package managers.

Often, software vendors distribute only RPMs, leaving Debian/Ubuntu users stuck. While tools exist to “convert” RPMs to DEBs (like alien), these conversions frequently cause dependency hell, broken installs, or unstable systems.

That’s why directly installing RPMs on Ubuntu smartly—and managing dependencies—is a game-changer that saves both time and headaches.


Step 1: Ensure You Have rpm Utility Installed

First things first: Ubuntu can work with RPM packages using the rpm command-line tool, a native utility from Red Hat ecosystems ported for Debian-based systems.

Install it if not already present:

sudo apt update
sudo apt install rpm

Verify installation:

rpm --version

You should see something like RPM version 4.x.x.


Step 2: Extracting and Installing RPM Packages Without Conversion

Contrary to popular belief, you don’t have to convert RPMs if your goal is just to extract files or manually install certain components.

Here’s how to inspect an RPM package without disturbing system integrity:

rpm2cpio package.rpm | cpio -idmv
  • rpm2cpio converts the .rpm file into a cpio archive.
  • cpio -idmv extracts files in the current directory, preserving structure.

This method lets you extract binaries/configuration files for manual use or compilation without full installation.


Step 3: Use alien for Controlled Conversion When Needed

If you must integrate an RPM package into your Ubuntu system—say for seamless dependency management—you can use alien.

Install alien:

sudo apt install alien

Convert an RPM package into a DEB:

sudo alien -k package.rpm
  • The -k flag keeps the original version number (recommended).

After conversion:

sudo dpkg -i package.deb

Important: Alien works well with simple packages but may struggle with complex dependency trees.


Step 4: Direct Installation of Some RPM Packages Using rpm Command (Carefully!)

Because Ubuntu doesn’t natively resolve dependencies for .rpm, blindly running

sudo rpm -i package.rpm

may result in broken installs or missing dependencies.

Still, if you want to install an rpm directly (for example, when dealing with standalone binaries), do this within a clean environment such as a Docker container based on your Ubuntu image but equipped with required libraries, or a chroot environment. This prevents system-wide damage.


Step 5: Best Practice—Leverage Docker or Virtual Machines

For enterprise-grade usage where RPM packages are common but your base OS is Ubuntu, consider containerizing applications inside an RPM-based container like Fedora or CentOS while running Ubuntu natively.

Example Dockerfile snippet:

FROM fedora:latest
COPY your-package.rpm /tmp/
RUN dnf install -y /tmp/your-package.rpm && dnf clean all

Build and run this container on your Ubuntu machine hassle-free—no risk of corrupting your base system’s package manager.


Bonus Tips: Managing Dependencies When They’re Not Present

If your target RPM depends on packages not available in your Ubuntu repo:

  • Check if equivalent DEB packages exist and install them via APT.
  • For libraries missing that are only available in RPM format, extract them manually (rpm2cpio) and place them appropriately under /usr/local/lib/ or similar—informed by your application’s documentation.
  • Use tools like ldd on binaries to identify missing linked libraries.

Example:

ldd /usr/local/bin/application-binary | grep "not found"

Resolve each missing library carefully by finding equivalent Debian packages or extracting from compatible RPMs as above.


Final Thoughts

Installing .rpm packages directly on Ubuntu isn’t always straightforward—but with the right approach, it’s definitely doable without compromising system stability.

Key takeaways:

  • Install the rpm tool to inspect/extract packages safely.
  • Use alien for converting simple RPMs into DEBs when necessary.
  • Avoid direct installation of complex rpm packages unless inside containers/chroots.
  • Consider Docker solutions when mixing ecosystems professionally.

Master these methods and expand your Linux admin toolkit beyond distro boundaries—unlocking access to broader software repositories that keep you nimble in diverse IT landscapes.


If you found this guide helpful or have questions about specific rpm installations on Ubuntu, leave a comment below! Happy packaging!