How to Convert .rpm Package to .deb Using Alien

In the world of Linux distributions, different package formats are often a barrier when we want to install software across systems. For instance, Red Hat-based systems like CentOS and Fedora use .rpm packages, while Debian-based systems like Ubuntu and Debian use .deb packages. If you find yourself needing to install an .rpm package on a Debian-based system, there’s a simple solution: the alien package converter.

In this guide, I’ll walk you through how to install Alien and use it to convert .rpm files into .deb files.

Prerequisites

Before starting, ensure you have:

  1. A Debian-based Linux system (e.g., Ubuntu or Debian).
  2. Root or sudo access, as we’ll be installing packages and converting files.

Step 1: Install Alien on Your System

First, we need to install Alien, which is available in the official repositories. Open a terminal and enter the following command:

sudo apt update
sudo apt install alien

Alien also requires rpm and debhelper utilities to work correctly, but these are usually installed by default with Alien.

Step 2: Download the .rpm Package

If you haven’t already downloaded the .rpm package, you can do so with wget or by visiting the software’s official website. For example:

wget http://example.com/package-name.rpm

Step 3: Convert the .rpm Package to .deb

Now that you have both Alien and the .rpm package, you can proceed with the conversion.

Navigate to the directory containing your .rpm package:

cd /path/to/downloaded/package

Then, run the following command to convert the .rpm package to a .deb package:

sudo alien -k package-name.rpm

The -k flag keeps the original version number of the package, which can be useful for tracking purposes. Alien will create a .deb file in the same directory.

Step 4: Install the .deb Package

Now that the .rpm package has been converted, you can install it on your system as you would any .deb package:

sudo dpkg -i package-name.deb

If any dependencies are missing, you can resolve them by running:

sudo apt install -f

This will automatically fetch and install any required dependencies.

Troubleshooting Tips

  • Error: “alien: command not found” - Make sure Alien is installed correctly. Re-run the installation command from Step 1 if necessary.
  • Error with dependencies - Running sudo apt install -f typically solves dependency issues. However, if the software depends on very specific libraries or versions, check the developer's documentation for additional requirements.

Conclusion

With Alien, converting and installing .rpm packages on Debian-based systems becomes a straightforward process. This tool is especially helpful when the software you need is available only in .rpm format. Just remember to exercise caution, as converting packages can sometimes lead to compatibility issues, especially for critical system libraries. Always test conversions in a safe environment before deploying to production.