Cyberithub

How to Install rpm on Ubuntu/Debian

Advertisements

In this article, we will see how to install rpm on Ubuntu/Debian. rpm is a free and open source package management utility in Linux. It is mostly used for installing and managing rpm packages on Fedora, CentOS, RHEL based systems and very rarely or uncommonly used on debian or ubuntu based systems. Except in few cases, it is best recommended not to use rpm utility to install rpm packages on Ubuntu or Debian based systems. However there might be specific scenarios where using RPM could be considered. We will see all those scenarios in a moment. Nevertheless, it is quite easy to install and use rpm on Ubuntu or debian systems, just like on RHEL, CentOS, Fedora based systems.

 

Why use rpm on Ubuntu/Debian Systems

  • Availability of Software: Sometimes, a software package might only be available in the RPM format and not as a DEB package. This is rare, as most popular software is available in both formats or through universal package managers like Snap or Flatpak.
  • Testing or Development Purposes: Developers or system administrators might need to test RPM packages in a Debian-based environment. This could be for compatibility testing, software development, or migration planning.
  • Specific Version Requirements: In some cases, a specific version of a software might only be available as an RPM package. Users who need that particular version might resort to using the RPM format.
  • Cross-Distribution Packaging: Developers who are packaging software for multiple distributions might use RPM tools for building or analyzing RPM packages, even on a Debian-based system.
  • Learning and Experimentation: Users or administrators who are familiar with Red Hat-based systems and moving to a Debian-based system might use RPM out of familiarity or for educational purposes.

 

Risks & Caution

Although there might be a need to install rpm package but at the same time it is important to understand all the risks involved in following this approach and the caution you need to take:-

  • Compatibility Issues: Be aware that converting and installing RPM packages on Ubuntu/Debian might not always work as expected due to differences in system libraries and dependencies.
  • Repository Packages: Prefer using the official Ubuntu/Debian repositories or adding a dedicated PPA (Personal Package Archive) when available, as these packages are optimized for your system.
  • Last Resort: Use RPM packages or Alien conversion only when there are no DEB packages available and no alternative software.

 

How to Install rpm on Ubuntu/Debian

How to Install rpm on Ubuntu/Debian

Also Read: How to Install aptitude on Ubuntu 22.04

Step 1: Prerequisites

a) You should have a running Ubuntu/Debian Server. In our case, we are using Ubuntu 22.04 LTS (Jammy Jellyfish) Server.

b) You should have sudo or root access to run privileged commands.

c) You should have apt or apt-get utility available in your Server.

 

Step 2: Update Your Server

Like everytime before installing any new packages, we first check for all the available updates and install them, this time also we have to do the same. Always look for all the latest security fixes and updates available and install them by using sudo apt update && sudo apt upgrade command before installing rpm utility in your system.

cyberithub@ubuntu:~$ sudo apt update && sudo apt upgrade
Hit:1 http://in.archive.ubuntu.com/ubuntu jammy InRelease
Get:2 http://in.archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB]
Hit:3 https://artifacts.elastic.co/packages/8.x/apt stable InRelease
Hit:4 https://dl.google.com/linux/chrome/deb stable InRelease
Get:5 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
Hit:6 https://ngrok-agent.s3.amazonaws.com buster InRelease
Hit:7 https://ppa.launchpadcontent.net/libreoffice/ppa/ubuntu jammy InRelease
Hit:8 http://in.archive.ubuntu.com/ubuntu jammy-backports InRelease
Hit:9 https://ppa.launchpadcontent.net/unit193/encryption/ubuntu jammy InRelease
Fetched 229 kB in 5s (45.8 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

 

 

Step 3: Install rpm

You can then install rpm from default Ubuntu repo by using sudo apt install rpm command as shown below. This will download and install rpm package along with all its dependencies.

cyberithub@ubuntu:~$ sudo apt install rpm
[sudo] password for cyberithub:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
debugedit libfsverity0 librpm9 librpmbuild9 librpmio9 librpmsign9 rpm-common rpm2cpio
Suggested packages:
alien elfutils rpmlint rpm-i18n
The following NEW packages will be installed:
debugedit libfsverity0 librpm9 librpmbuild9 librpmio9 librpmsign9 rpm rpm-common rpm2cpio
0 upgraded, 9 newly installed, 0 to remove and 0 not upgraded.
Need to get 626 kB of archives.
After this operation, 2,398 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://in.archive.ubuntu.com/ubuntu jammy/main amd64 debugedit amd64 1:5.0-4build1 [47.2 kB]
Get:2 http://in.archive.ubuntu.com/ubuntu jammy/universe amd64 libfsverity0 amd64 1.4-1~exp1build1 [10.4 kB]
Get:3 http://in.archive.ubuntu.com/ubuntu jammy/universe amd64 librpmio9 amd64 4.17.0+dfsg1-4build1 [93.2 kB]
Get:4 http://in.archive.ubuntu.com/ubuntu jammy/universe amd64 librpm9 amd64 4.17.0+dfsg1-4build1 [189 kB]
Get:5 http://in.archive.ubuntu.com/ubuntu jammy/universe amd64 librpmbuild9 amd64 4.17.0+dfsg1-4build1 [80.3 kB]
Get:6 http://in.archive.ubuntu.com/ubuntu jammy/universe amd64 librpmsign9 amd64 4.17.0+dfsg1-4build1 [11.7 kB]
Get:7 http://in.archive.ubuntu.com/ubuntu jammy/universe amd64 rpm-common amd64 4.17.0+dfsg1-4build1 [33.7 kB]
Get:8 http://in.archive.ubuntu.com/ubuntu jammy/universe amd64 rpm2cpio amd64 4.17.0+dfsg1-4build1 [9,882 B]
Get:9 http://in.archive.ubuntu.com/ubuntu jammy/universe amd64 rpm amd64 4.17.0+dfsg1-4build1 [151 kB]
...............................................................

 

 

Step 4: Check Version

After successful installation, you can check the current installed version by using rpm --version command as shown below.

cyberithub@ubuntu:~$ rpm --version
RPM version 4.17.0

 

 

Step 5: Verify Installation

You can also check the installation status by running dpkg -s rpm command as shown below. Check more about dpkg on 21+ Practical dpkg Command Examples for Linux Beginners.

cyberithub@ubuntu:~$ dpkg -s rpm
Package: rpm
Status: install ok installed
Priority: optional
Section: admin
Installed-Size: 494
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: amd64
Version: 4.17.0+dfsg1-4build1
Depends: libc6 (>= 2.34), libelf1 (>= 0.131), libpopt0 (>= 1.14), librpm9 (>= 4.16), librpmbuild9 (>= 4.17.0+dfsg1), librpmio9 (>= 4.14.0+dfsg1), librpmsign9 (>= 4.17.0+dfsg1), perl:any, rpm2cpio, debugedit (>= 1:5), rpm-common (= 4.17.0+dfsg1-4build1)
Suggests: alien, python3, elfutils, rpmlint, rpm-i18n
Description: package manager for RPM
The RPM Package Manager (RPM) is a command-line driven package
management system capable of installing, uninstalling, verifying,
querying, and updating computer software packages.
.
On Debian and derived systems it is recommended to use "alien" to
convert RPM packages into .deb format instead of bypassing the Debian
package management system by installing them directly with rpm.
Original-Maintainer: RPM packaging team <team+pkg-rpm@tracker.debian.org>
Homepage: https://rpm.org/

 

 

Step 6: Check all the options available

To explore all the other options available with rpm utility, use rpm --help command as shown below.

cyberithub@ubuntu:~$ rpm --help
Usage: rpm [OPTION...]

Query/Verify package selection options:
  -a, --all query/verify all packages
  -f, --file query/verify package(s) owning file
  -g, --group query/verify package(s) in group
  -p, --package query/verify a package file
      --pkgid query/verify package(s) with package identifier
      --hdrid query/verify package(s) with header identifier
      --triggeredby query the package(s) triggered by the package
      --whatconflicts query/verify the package(s) which require a dependency
      --whatrequires query/verify the package(s) which require a dependency
      --whatobsoletes query/verify the package(s) which obsolete a dependency
..................................................

 

Step 7: Uninstall rpm

After using rpm package management tool, you can choose to remove it from your system by using sudo apt remove rpm command as shown below. To remove all dependencies all with the package, use --auto-remove option with below command.

cyberithub@ubuntu:~$ sudo apt remove rpm
[sudo] password for cyberithub:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
debugedit libfsverity0 librpmbuild9 librpmsign9
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
rpm
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 506 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 238206 files and directories currently installed.)
Removing rpm (4.17.0+dfsg1-4build1) ...
Processing triggers for man-db (2.10.2-1) ...

Leave a Comment