Why would you need to know how to install RPM on Ubuntu? There are quite a few reasons, for example, if you need to install a software package solely developed for CentOS (RPM) but you would like to run it on your Ubuntu (Debian) server. You must convert the package from a .rpm to a .deb file type or there is a less reliable way of installing .rpm packages directly on Ubuntu. The guide below will walk you step-by-step and teach you how to install RPM packages on Ubuntu systems.
We’ll first review some terminology being used here and define what RPM and what Debian is. Then we’ll go through a few simple steps that will convert and allow you to install .rpm packages on any Debian machine. Then we’ll discuss some nuances you might run into, depending on dependencies and how packages are programmed and deployed.
RPM was originally Red Hat’s default package manager. It’s a recursive acronym now which stands for “RPM Package Manager”. RPM is a popular free and open source (FOSS) package manager used in an array of Linux-based operating systems including CentOS, Fedora, and Oracle Linux.
RPM packages are stored in binary format, which are simply compiled versions of the software they intend to install on a system. You can also install source RPM’s as well, which include the source code of the software. RPM’s are typically stored in a central repository which can easily install various software from their RPM package. There are frontends which make installing RPM packages easier. The most popular RPM package installer is ‘yum‘ which is used in CentOS and Fedora, among others. An example using yum to install the fail2ban RPM from a software repository is:
yum install fail2ban
Deb files are installation packages similar to RPM above but for use on Debian-based operating systems like Ubuntu, Linux Mint, and ElementaryOS. The .deb files are archives which contain two tarball archives, one contains package information and the other contains the installable data files.
Like RPM, .deb packages get stored in a repository and have frontends which pull the packages from that repository. One of the more popular frontends is the Advanced Package Tool, or apt. Apt is free to use and simplifies the process of adding and removing software packages on UNIX-based operating systems. A similar command to install the fail2ban software on a Debian-based machine is below:
apt-get install fail2ban
Alien is a Debian package that aids in the conversion of various package formats to Debian. This is the primary tool we will use to allow us to run RPM packages on Ubuntu and other Debian-based distros. Alien works to convert Slackware, Linux Standard Base, RPM, and Stampede packages to run on Debian. Let’s jump into the guide below to see how to install an RPM package on Ubuntu.
The first thing you’ll want to do in Ubuntu is add the ‘universe’ repository. We mentioned repositories above. This will add another source of software packages to your system for you to install software from. The universe repository is the one that holds the alien software we need to install to convert our .rpm file to .deb. Run the command below to add the universe repository:
sudo add-apt-repository universe
It will likely ask for your account password.
Now you need to update the frontend manager mentioned above so it will recognize the newly added repository. Run the command below:
sudo apt-get update
You can install the alien package with the below command. This just pulls the bundled .deb software file from the ‘universe’ repository and installs it on your system for you, all on one simple command. apt and yum are fantastic tools that sys admins probably couldn’t live without!
sudo apt-get install alien
This is where the magic happens. You will use your newly installed alien software to convert an RPM package to .deb. It’s fairly straightforward. You will need to have the .rpm file downloaded and know where it exists on your Ubuntu machine. Run the following command on your command line:
alien --to-deb /path/to/file.rpm
Depending on the size of the package, this could take some time to convert the file to a format Ubuntu can install. The end result is a Debian package waiting to be installed!
Alien can also convert a file from .deb to .rpm with a similarly simple command:
alien --to-rpm /path/to/file.deb
Now you’re ready to install your freshly converted package. Run the command below:
sudo dpkg -i /path/to/file.deb
Now you know how to convert RPM packages to run on Ubuntu. It is nice to know alternative methods. There is a one-liner that will convert and install your file all in one, but I’ve personally had more success using the method above of converting and installing the software separately. Here is the one-liner:
sudo alien -i /path/to/file.rpm
Converting software developed for one operating system to another comes with its fair share of issues. Some RPM software has dependencies that don’t exist on Ubuntu and you will run into issue when trying to install or use the software.
We have experts who look into these dependencies and other issues and determine if specific software can be properly converted for you. All of our fully managed hosting plans include these services. Get in touch with us if you run into any issues using the methods in the guide above for installing RPM packages on Ubuntu or Debian-based hosts.