Home / Linux / How to Convert Linux Installation Packages to Other Formats

How to Convert Linux Installation Packages to Other Formats

Laptop screen showing a terminal prompt.
fatmawati achmad zaenuri/Shutterstock.com

The alien program converts installation packages from one Linux distribution for use on another one. But don’t Snap and Flatpak make that redundant now? Sort of, but it’s not quite that simple.

Linux Packaging Systems

In order to allow their users to install software, Linux distributions need a software packaging system. If the distribution is a fork of another established distribution, it’ll usually stick with the packaging system of the older distribution.

How to Install an RPM File in Linux

RELATEDHow to Install an RPM File in Linux

That’s why Fedora uses RPM packages (which used to stand for RedHat Package Manager) and Ubuntu and its numerous children use DEB packages. DEB is simply short for “Debian.” Other distributions opt to write their own package management system. Installation files packaged for one package manager are not interchangeable with other package managers.

Traditionally, application developers had to either package their application in every format that they chose to support or to work with the maintainers of the different Linux distributions and pass the packaging steps over to them. The latter introduces delays in getting new releases into the hands of the users, the former gives the developers a lot of extra work.

The Snap and Flatpak projects try to deliver the Holy Grail of package distribution: package your application once, and install it on any Linux distribution. Of course, there may or may not be a Snap or Flatpak for the application you’re after.

How To Compile and Install from Source on Ubuntu

RELATEDHow To Compile and Install from Source on Ubuntu

You can remove packaging systems from the equation completely, just as long as you are comfortable with cloning a Git repository and building an application from the source code. But not everybody is. And not all applications—even on Linux—are open source, so you can’t build everything from source anyway.

The maintainers of some distributions are great at getting packages for other platforms and repackaging them for their own package management system, including closed-source applications. But there will always be cases where an application offers a DEB or an RPM—the big two formats—and everyone else needs to figure it out for themselves.

Programs like alien exist to solve the problem of converting a package file from another distribution to the version you need on your Linux computer. That’s fine in theory, but how successful are they?

The alien Experiment

The proof of the pudding is in the eating.

We took three different RPMs and used alien to convert them to DEBs. We then tried to install the freshly-created DEBs on Ubuntu.

In all of our test cases, there was a DEB available for download too, so what we were doing was actually redundant. But we thought the test applications—Microsoft Edge browser, the Atom editor, and Slack—would be a good test of alien‘s capabilities so we ignored the off-the-shelf DEBs.

Installing alien

Installing alien was simple on Ubuntu, Fedora, and Manjaro.

On Ubuntu you can use this command:

sudo apt install alien

Installing alien on Ubuntu

On Fedora, you need to type:

sudo dnf install alien

Installing alien on Fedora

On Manjaro, the alien package is in the Arch User Repository. This means pacman won’t be able to see it, so we need to use an AUR helper program like yay. The package name is slightly different too.

yay -S alien_package_converter

Installing alien on Manjaro

Using alien

To use alien you specify the file you want to convert, and the format you want to convert to. It creates a file with the same filename—usually—and with the extension of the format you asked for.

Using alien to create a package causes alien to increment the version number of the package. If the package number is in the filename, the filename will be changed too.

These are the formats alien can convert from and into.

  • -d: Convert to a DEB file, for Debian, Ubuntu, and all the derivatives.
  • -r: Convert to an RPM file, for RedHat, CentOS, and Fedora.
  • -t: Convert to a TAR.GZ archive file, for Arch and Arch-based systems like EndeavourOS and Manjaro.
  • -l: Convert to an LSB file, a Linux Standard Base file. This was another initiative to develop a cross-distribution package format.
  • -p: Convert to a PKG file, a format used by Solaris amongst others.
  • –to-slp: Convert to an SLP package, a format used by the discontinued Stampede Linux distribution.

The format option we’ll be using is -d (DEB) as we’re converting to a DEB file. We’ll also use the -c (scripts) option to convert any scripts contained in the package.

Microsoft Edge

We downloaded an RPM for Microsoft’s Edge browser, and ran the following command on it:

sudo alien -d -c microsoft-edge-beta-97.0.1072.54-1.x86_64.rpm

Converting the Edge RPM to a DEB file

Without the -c (scripts) option it didn’t create the DEB file, it reported an error. With the -c option, it did create the DEB.

The original RPM file and the newly created DEB file

Note the DEB filename contains 54-2, not 54-1.

Converting scripts is unlikely to end well. They may well be written for a particular situation or configuration unique to the genuine target platform of the original package file. Because of this, we didn’t have high hopes. Nevertheless, we tried to install the DEB with the dpkg program and the -i (install) option.

sudo dpkg -i microsoft-edge-beta_97.0.1072.54-2_amd64.deb

Failed installation with the newly created DEB file

It didn’t work.

We also tried double-clicking the DEB file and using the Ubuntu Software application to install the DEB. Interestingly, the Software application knew that the DEB had been created by alien.

Using the Ubuntu Software application to install the newly created DEB file

That didn’t work either. Just to make sure the Edge browser would actually install on Ubuntu, we installed the official Microsoft Edge DEB file.

sudo dpkg -i microsoft-edge-beta_97.0.1072.54-1_amd64.deb

Installation command for the official Microsoft Edge DEB file

That worked without an issue. You can see below Microsoft Edge running on Ubuntu.

Microsoft Edge running on Ubuntu

The Atom Editor

We downloaded the RPM install package for the popular Atom editor. We used the same alien command to convert it to a DEB.

sudo alien -d -c atom.x86_64.rpm

Converting the Atom RPM file to a DEB file

That created a DEB file without any warnings or errors. We installed it using the dpkg command with the -i (install) option.

sudo dpkg -i atom_1.58.0-1.1_amd64.deb

Installing Atom from the newly created DEB file

That worked perfectly.

Atom running on Ubuntu

Slack Business Messaging App

Finally, we tried converting the Slack RPM to a DEB.

sudo alien -d -c slack-4.23.0-0.1.fc21.x86_64.rpm

Converting the Slack RPM file to a DEB file

Again, this created a DEB with no warnings and no errors. We used this installation command:

sudo dpkg -i slack_4.23.0-1.1_amd64.deb

Installing Slack from the newly created DEB file

The installation worked flawlessly. Slack was up and running with no issues.

Slack running on Ubuntu

Mixed Results

A utility such as alien is inevitably fighting an uphill battle. The odds are stacked against it being able to work in every case, and this was borne out by our small amount of testing. Having said that, when it worked it was great.

If you’re in a situation where there’s nothing else for it, give alien a try. But if there is any other method available to you—Snap, Flatpak, or building from source—try those first. Even the authors of alien know its limitations, and put this warning in the man page:

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. Many of these packages are set up differently by the different distributions, and packages from the different distributions cannot be used interchangeably. In general, if you can’t remove a package without breaking your system, don’t try to replace it with an alien version.

While it might get you out of a hole, make sure you’ve exhausted all other possibilities before turning to alien.

But, when there’s nothing else, alien might just surprise you.

RELATED: How to Use Linux’s man Command: Hidden Secrets and Basics

Leave a Reply

Your email address will not be published. Required fields are marked *



Check Also

How to Add and Remove Users on Ubuntu

Hannah Stryker / How-To Geek To create a new user named “maxn” ...