How to Convert Linux Installation Packages to Other Formats

Configurare noua (How To)

Situatie

Laptop screen showing a terminal prompt.

  • 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.

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.

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.

Solutie

Tip solutie

Permanent

Voteaza

(8 din 17 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?