In this article, we’ll learn to install RPM packages on Ubuntu. RPM is a package manager that runs on RHEL(Red Hat Enterprise Limited) and operating systems based on RHEL such as OpenSUSE, Fedora, etc.
Ubuntu uses APT Package manager and .deb as the package installation format. There are lots of packages in Apt package manager but some packages are only available in RPM.
So, to install those packages in Ubuntu, you need to install a tool named alien which converts packages from one format to another. In this article, we will see how to install “alien” and install RPM packages in Ubuntu. Alien can also convert packages to tgz, pkg and slp.
Install RPM packages by converting .rpm to .deb
Let’s get into the first method to install RPM packages on Ubuntu. In this method, we’ll be converting RPM to the native DEB package for easy installation.
Step 1: Install “Alien”
To install the Alien package on Ubuntu, you need to add the Universe repository. Open a terminal using Ctrl+Alt+T. Run the following command to add the Universe repository:
sudo add-apt-repository universe
Update the package repository by executing the following command:
sudo apt update
Now, install the alien package by executing the following command:
sudo apt install alien
The alien package along with the essential build tools will be installed successfully.
Step 2: Convert .rpm file to .deb
So, to convert a .rpm file to .deb using the alien tool. Run the following Alien command followed by the rpm package name,
sudo alien --to-deb package_name.rpm
Here, we have used –to-deb to specify the package to be converted to deb format. To convert a package to rpm we will use –to-rpm. If you don’t specify an output type, by default it is converted to deb format.
Executing the following command will give the same result as the above command,
sudo alien package_name.rpm
Step 3: Install the .deb package
Now, to install the .deb package that was converted above, run the following command:
sudo dpkg -i package_name.deb
sudo apt install ./package_name.deb
The package will be installed. All packages may not be compatible with Ubuntu so it depends whether dependencies are met or not. So, some rpm packages may not be installed.
Installing .rpm packages directly
RPM packages can also be installed using this method. Using the following command, RPM packages are installed directly without manually converting them into a .deb installation format.
The package file will also be removed automatically after the installation. But this method may not be compatible in some cases due to unmet dependencies.
sudo alien -i package_name.rpm
So, we discussed how to install RPM packages in Ubuntu. RPM packages are meant to be installed on RHEL based Operating systems so installing them on ubuntu which uses apt package manager may cause error or crash your system.