How To Install Rpm File In Ubuntu

How To Install Rpm File In Ubuntu

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

Installing RPM Files on Ubuntu: Reliable Methods for Cross-Distro Package Management

Most Ubuntu users hit a wall eventually: software is distributed as an RPM, not a DEB. Enterprise database clients, commercial backup tools, and specialized drivers are prime offenders. If vendor support means “RPM or nothing,” don’t reach for a second VM or switch distributions. There are well-tested solutions—some robust, some hacky.


Problem Statement: Ubuntu’s DEB Ecosystem vs RPM

Ubuntu’s package management stack (apt, dpkg) expects .deb files and leverages an entirely different dependency model than Red Hat-based systems. Native tools will not ingest RPMs:

sudo dpkg -i example-software.rpm
dpkg-deb: error: 'example-software.rpm' is not a Debian format archive

This isn’t just a file extension issue; the metadata, pre/post scripts, library assumptions, and even compression methods differ.


Method 1: Convert with alien (Works, with Caveats)

alien is the standard utility to convert RPMs to DEBs. Function is straightforward, but behavior isn’t always perfect—dependency mapping between RPM and DEB can be lossy.

Install alien (Ubuntu 20.04+)

sudo apt update
sudo apt install alien

Convert and Install

Suppose you’re handed a legacy utility, acme-agent-4.1.rpm:

sudo alien acme-agent-4.1.rpm
# Output: acme-agent_4.1-2_all.deb
sudo dpkg -i acme-agent_4.1-2_all.deb

If dpkg reports missing dependencies:

sudo apt-get install -f

Known issue

  • RPM maintainer scripts can fail or cause partial configuration.
  • Not all RPMs use default filesystem locations.

Practical tip

Before conversion, inspect the RPM’s requirements (if possible):

sudo apt install rpm
rpm -qpR acme-agent-4.1.rpm

Map any required libraries to Ubuntu equivalents.


Method 2: Extract RPM Contents Directly

Sometimes the target package is self-contained or you only need a binary or script. Direct extraction works without introducing broken packages.

sudo apt install rpm2cpio cpio
rpm2cpio vendor-utils-7.9.rpm | cpio -idmv
# Binaries will appear in local dirs—inspect them manually

Deploy binaries to /usr/local/bin or run from extracted location. No system-level registration; pure manual.

Example path:
RPM contains /opt/vendor/bin/monitor; copy to /usr/local/bin/monitor if no dynamic linking conflicts arise.


Method 3: Use Containers for Complete Isolation

For software with broad RHEL-only dependencies (system libraries, SELinux tooling), wrappers like Docker or Podman orchestrate an isolated CentOS/Fedora environment.

Minimal example Dockerfile:

FROM fedora:38
COPY toolkit-1.2.3.rpm /tmp/
RUN dnf install -y /tmp/toolkit-1.2.3.rpm

This keeps foreign libraries out of your Ubuntu install but increases operational complexity—networking, data sharing, and updates now live within the container boundary.


Dealing with Dependencies and Overlaps

  • Not all library names are consistent across distros.
  • Some RPMs embed post-install scripts that expect systemd or SELinux to behave as in RHEL; these can error out or silently fail.
  • Avoid converting kernel modules or low-level drivers (e.g., kernel-ml-devel, kmod-srdrv, etc.).

Proven workaround:
When possible, install only userland tools via RPM conversion; for system components, source or snap packages are safer.


Reference Table: Quick Steps

StepCommand / Action
Install aliensudo apt install alien
Convert RPM → DEBsudo alien software.rpm
Install DEBsudo dpkg -i software_x.y-z_arch.deb
Fix dependenciessudo apt-get install -f
Extract contents`rpm2cpio package.rpm

Final Notes and Non-Obvious Considerations

  • Some RPMs bundle legacy libraries missing on Ubuntu; static binaries work better than shared ones in this scenario.
  • Always check for Snap or Flatpak variants of commercial software—these are increasingly common and avoid all the above friction.
  • alien conversion writes a new package version in the filename (e.g., -2), which occasionally confuses scripted installations.
  • For anything beyond simple CLI utilities, deploy in a container unless the vendor officially supports Ubuntu.

Summary: RPM on Ubuntu is possible when handled carefully. Audit dependencies, extract binaries if feasible, and only use converted packages when you know what scripts and files they bring along. If you encounter SELinux or systemd-related install errors, stop: another method is warranted.


Note: Any attempt to force RPM-native daemons onto Ubuntu’s init system usually fails. Stick to userland apps, and maintain a rollback plan.