The Ubuntu repository contains thousands of deb packages which can be installed from the Ubuntu Software Center or by using the apt command line utility. Deb is the installation package format used by all Debian-based distributions including Ubuntu. Some packages are not available in the standard Ubuntu repositories but can be easily installed by enabling the appropriate sources.
In most cases, when the software vendor does not provide a repository, they will have a download page to download and install deb packages, or download and compile software from source.
Although not so often, some software may be distributed only as RPM packages. RPM is the package format used by Red Hat and its derivatives such as CentOS. Fortunately, there is a tool called alien that allows us to install RPM files on Ubuntu or convert RPM package files into Debian package files.
Ubuntu 20.04 Installation Guide :
This is not the recommended way to install software packages on Ubuntu. Whenever possible, you should choose to install software from the Ubuntu repositories.
Not all RPM packages can be installed on Ubuntu. Installing packaged RPMs on Ubuntu can cause package dependency conflicts.
You should not use this method to replace or update critical system packages, such as
systemd, or other services and libraries that are essential for the proper functioning of your system. Doing this may cause system instability.
We also recommend that you test any tutorials or guides available on the Internet on a virtual machine ( vmware or virtualbox ) before deploying to a production server, so as not to mess up the running system when something goes wrong.
Alien is a tool that supports conversion between Red Hat rpm, Debian deb, Stampede slp, Slackware tgz, and Solaris pkg file formats.
Before installing the alien package, make sure the Universe repository is enabled on your system:
sudo add-apt-repository universe
Once the repository is enabled update the package index and install the alien package with:
sudo apt update sudo apt install alien
The above command will also install the necessary build tools.
Converting and Installing RPM packages
To convert a package from RPM to DEB format use the alien command followed by the RPM package name:
sudo alien package_name.rpm
Depending on the package size, conversion may take some time. In most cases, you will see a warning message printed on your screen. If the package is converted successfully, the output will show that a DEB package has been generated:
To install the deb package , you can use the utility
sudo dpkg -i package_name.deb
You can also use the following command (the result is the same)
sudo apt ./package_name.deb
Assuming the package is compatible with your system and all dependencies are met, then the package has been successfully installed on your Ubuntu system.
You must be logged in as a user with sudo privileges to be able to install packages on your Ubuntu system.
Install the RPM package directly
Instead of formatting the package to deb and then installing the package, you can use the -i option which will tell alien to install the RPM package directly.
sudo alien -i package_name.rpm
The above command will automatically generate and install packages and remove package files once installed.
In this tutorial, you have learned how to install RPM packages on Ubuntu. It should be noted that not all existing RPM packages are compatible with Ubuntu systems. You should consider alternative options for software running on your production system if possible.