How To Install Rpm Package In Ubuntu

How To Install Rpm Package In Ubuntu

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

Installing RPM Packages on Ubuntu: Engineer’s Field Manual

Some enterprise tooling and proprietary drivers for Linux ship solely in RPM format—think Oracle DB clients, Mellanox OFED, or niche monitoring agents. When your entire environment is Ubuntu, this sharpens the challenge: Ubuntu’s package management (APT with .deb) isn’t immediately compatible with RPM repositories or payloads.


The RPM vs. DEB Problem

APT expects .deb packages with dependency metadata tracked in /var/lib/dpkg/. RPMs manage their own database (/var/lib/rpm/). Installing an RPM on Ubuntu directly is risky: you’re bypassing the default dependency graph, and may silently break future upgrades. Is it still worth doing? Sometimes the options are: install, hack, or forgo the tool entirely.


1. Inspect and Extract RPMs (Safest)

When you just need a binary or a library tucked into an RPM, direct extraction preserves stability. Install the required utilities:

sudo apt-get update
sudo apt-get install rpm2cpio cpio

Unpack the payload:

rpm2cpio foo-client-5.2.0-1.x86_64.rpm | cpio -idmv

This unpacks files into your current working directory. Typical locations (/usr/bin/, /usr/lib64/) are preserved—move files as needed.

Note: This bypasses post-install scripts. If you require user/group creation or symlink setup, inspect the RPM’s postinstall section:

rpm -qp --scripts foo-client-5.2.0-1.x86_64.rpm

2. Converting RPMs to DEB: alien

Conversion works for basic RPMs—those without deep dependency trees or complex triggers. For system daemons, kernel modules, or packages wiring into PAM, tread carefully.

sudo apt-get install alien
sudo alien -k foo-client-5.2.0-1.x86_64.rpm
sudo dpkg -i foo-client_5.2.0-1_amd64.deb
  • The -k flag preserves the package version.

Known issue: Alien sometimes mangles scripts or misses dependencies. You may see:

dpkg: dependency problems prevent configuration of foo-client:
 foo-client depends on libssl1.1 (>= 1.1.0); however:
  Package libssl1.1 is not installed.

Resolve with:

sudo apt-get install libssl1.1

Provided the library exists—otherwise, manual extraction may be your only option.


3. Direct RPM Installation (Rarely Recommended)

rpm can install RPMs on Ubuntu, but APT will be unaware. Dependency tracking is absent, and removal is manual.

sudo apt-get install rpm
sudo rpm -ivh --nodeps --force foo-client-5.2.0-1.x86_64.rpm

Why? Only for statically-linked binaries, ephemeral test environments, or Docker containers bound for disposal.

Trade-off: Expect to perform manual cleanup; post-removal, APT may not know files have changed.


4. Clean Isolation: Containers

In production or on build systems, avoid polluting your APT environment. Use Docker:

FROM centos:8
COPY foo-client-5.2.0-1.x86_64.rpm /tmp
RUN dnf install -y /tmp/foo-client-5.2.0-1.x86_64.rpm && dnf clean all

Build on Ubuntu:

docker build -t foo-client-centos .

This guarantees all package scripts execute in a known-good RPM-native context.


5. Dependency Mapping & Library Mismatch

Critical for drivers and utilities: does the extracted binary require an exact glibc or a specific shared object version? ldd shows link targets:

ldd ./usr/bin/foo-client | grep not

Result:

libfoo.so.2 => not found

Map missing libraries:

  • Prefer Ubuntu-native packages (apt-get install libfoo2)
  • If absent, extract them from sibling RPMs. Place in /usr/local/lib64 and run ldconfig.

Gotcha: Sometimes, alien-converted scripts look for RPM tools like chkconfig or service; in Ubuntu context, substitute with systemctl or native alternatives.


Summary Table

MethodSafe?Handles Dependencies?Leaves Ubuntu Clean?Notes
rpm2cpio + extractYesNoYesFor binaries/libraries only
alien conversionMaybePartiallyYesMay fail on complex RPMs
rpm installNoNoNoUse in containers only
Docker VMYesYesYesRecommended for enterprise

Non-Obvious Tip

RPMs often contain valuable documentation in /usr/share/doc/package or as %doc entries. Extract with:

rpm2cpio foo-client-5.2.0-1.x86_64.rpm | cpio -idmv | grep doc

Sometimes this reveals manual steps omitted from official HOWTOs.


Takeaway

Installing RPMs on Ubuntu is a workaround, not a best practice. When the business need trumps purity—prefer extraction or containerization. For integration, audit scripts and dependencies closely, and document any deviations from system packaging norms.

Further complications? Record package origins, versions, and manual fixups in /etc/foo-client-install.log—future you will thank you.