Trying to install an application but it offers only either DEB or RPM package for Linux? Well, it’s possible to convert between the two package formats and then install the one for your Linux distribution.
RPM is a file format created for use in Red Hat Linux, which now is used in many Linux distributions such as Fedora, CentOS, OpenSUSE, OpenMandriva and Oracle Linux.
DEB is the file format for Debian, which is also used in Ubuntu, Linux Mint, Pop!_up OS, Elementary OS, and more.
First install alien in Linux:
Besides using the universal Linux package formats: Snap, Flatpak, and/or Appimage. You can convert between DEB and RPM via a command line tool called alien.
alien is a program that converts between Red Hat rpm, Debian deb, Stampede slp, Slackware tgz, and Solaris pkg file formats. If you want to use a package from another linux distribution than the one you have installed on your system, you can use alien to convert it to your preferred package format and install it. It also supports LSB packages.
To install alien in Debian / Ubuntu based systems, open terminal and run command:
sudo apt install alien
To install alien in Fedora based systems, open terminal and run command:
sudo dnf install alien
How to use alien to convert DEB / RPM
Let’s say you’re going to install XMind mind mapping software in Ubuntu. The website offers only RPM package for Linux when clicking download button. So you have to convert the package before you’re able to install it.
IT IS IMPORTANT TO NOTE that alien should not be used to replace important system packages, like init, libc, or other things that are essential for the functioning of your system.
1. Convert RPM to DEB:
Simply run alien command follow with the file name with
--to-deb file will convert it to DEB (sudo is required for root permission):
sudo alien --to-deb /PATH/TO/RPM
Right-click on blank area of the Downloads folder and select “Open in Terminal”, then the command in my case will be:
sudo alien -d XMind-2020-for-Linux-x86-64bit-10.3.1-202101132117.rpm
[epcl_box type=”information”]NOTE that the converting process may take quite a few seconds depends on your machine. Be patient before the process done.[/epcl_box]
--to-deb is the default option, you may skip it so the command is:
sudo alien XMind-2020-for-Linux-x86-64bit-10.3.1-202101132117.rpm
The DEB or RPM may contains a few scripts that are meant to be run when the package is installed and removed. You can convert these scripts by adding
--scripts flag in the command.
Use this with caution, because these scripts might be designed to work on a system unlike your own, and could cause problems. It's recommended to examine the scripts by hand before using the flag.
sudo alien --scripts XMind-2020-for-Linux-x86-64bit-10.3.1-202101132117.rpm
And alien by default will count up the minor version number of the package, adding
--keep-version will not do this:
sudo alien --scripts --keep-version XMind-2020-for-Linux-x86-64bit-10.3.1-202101132117.rpm
2. Convert DEB to RPM
To convert DEB or other supported package to RPM, use
--to-rpm flag instead:
sudo alien --to-rpm /PATH/TO/DEB
Also you can convert the scripts with
-c, keep package version with
-k flag in the command:
sudo alien --to-rpm -c -k /PATH/TO/DEB
3. Other alien command usage:
The command offers other flags, e.g,
--to-pkg, allows to convert between other package formats.
--install option that automatically install each generated package, and remove the package file after it has been installed.
For more about alien command, run man alien command in terminal.