The way to Convert Between Linux Packages Utilizing Alien

Do you want to convert a Linux package to a different format? The package you are looking for may not be available for your distribution, but you still want it. Or you are a developer and want to save time by quickly repackaging your program in other formats without having to repackage the package.

Fortunately, Linux has the tool you need. Alien makes it easy to convert your existing Linux package to other formats from the command line. Let's start by installing the tool on your system.

How to install Alien on Linux

Alien is available in the Ubuntu Universe Repository. To install it, first enable the universe Repository and update your system's package list. Then install the extraterrestrial Package with APT as you normally would.

sudo add-apt-repository universe
sudo apt update
sudo apt install alien

Debian users can easily install the package with APT:

sudo apt install alien

Alien is not yet available in the official Arch repositories. However, you can install it from the AUR with an AUR helper. We'll use yay for this guide.

yay -S alien

On Fedora, CentOS, and other RPM-based distributions, you can install Alien using DNF as follows:

sudo dnf install alien

When you're done, verify the installation by typing extraterrestrial version in the terminal. If the command returns version information for the package, the installation is successful. If not, please try the installation steps again.

Convert between Linux packages with Alien

Alien allows you to convert between a number of Linux packages. To name a few:

  1. DEB (Debian-based distributions)

  2. TAR.GZ (Packaged Archive)

  3. RPM (Fedora, CentOS and other distributions)

  4. PKG (Solaris Package Format)

  5. SLP

  6. LSB

Alien can interpret the following options:

  1. -d or –to-dpkg: Converts the specified package to the DEB package format
  2. -r or –to-rpm: Convert the package to RPM format
  3. -t or –to-tgz: Generate a TAR.GZ archive file from the specified package
  4. -l or –to-lsb: Create a LSB (Linux Standard Base) package
  5. -p or –to-pkg: Converts the specified package to PKG format
  6. –to-slp: Create an SLP package

Related: How to List Installed Packages in Ubuntu Using APT

How to use Alien on Linux

The basic syntax of the utility is:

sudo alien options filename

…Where Options are the different flags you can use with the command and Filename is the absolute or relative path to the package you want to convert.

To convert an RPM package to DEB:

sudo alien –d file.rpm
sudo alien –to-deb file.rpm

To demonstrate how you can convert one package to all other formats, let's convert a DEB file to other Linux packages.

DEB to RPM:

sudo alien -r file.deb
sudo alien –to-rpm file.deb

DEB to TAR.GZ:

sudo alien -t file.deb
sudo alien –to-tgz file.deb

DEB to LSB: sudo alien -l file.deb sudo alien –to-lsb file.deb DEB to PKG:

sudo alien -p file.deb
sudo alien –to-pkg file.deb

DEB to SLP:

sudo alien –to-slp file.deb

Note that you can convert any packet format to any other format as well. For example RPM to LSB, SLP to PKG, PKG to DEB etc.

Converting a package to multiple formats with a single command is also possible. All you have to do is specify the flags for the conversion as follows:

sudo alien –to-deb –to-rpm –to-tgz file.pkg
sudo alien -d -r -p file.tar.gz

If the package contains format-specific scripts, you can use the – scripts or -C Flag.

sudo alien –scripts –to-deb file.rpm
sudo alien -c –to-deb file.rpm

Install packages after conversion

In addition to converting packages, Alien can also install the packages for you. You can add that –To install or -I Flag with the command to install the package immediately after conversion.

For example:

sudo alien –to-rpm –install file.deb
sudo alien -r -i file.deb

Handling version numbers during conversion

By default, Alien will automatically increment the version details of the package. When converting a package with a version number 1.17.1 With Alien, the generated package has the version number 1.17.2.

You can override this default behavior by editing the -k or – Keep version Flag as follows:

sudo alien –to-rpm -k file.deb
sudo alien –to-rpm –keep-version file.deb

You can now convert packages to Linux

As a developer, it can be difficult to rebuild a package for different Linux distributions. To solve this problem, you can use Alien to easily convert your package to other Linux formats.

While Alien is a reliable utility, it is not recommended if you want to properly develop native packages for distributions. In addition, when you publish a package, you should always list the dependencies required by the program.

How to list a package's dependencies in Ubuntu

Almost every Linux package requires additional dependencies in order to function properly. This is how you can check the dependencies of a package in Ubuntu.

Continue reading

About the author

Deepesh Sharma
(93 published articles)

Deepesh is Junior Editor for Linux at MUO. He writes informational guides on Linux with the aim of providing a blissful experience for all newbies. I'm not sure about movies, but if you want to talk about technology, he's your type. In his spare time he can be found reading books, listening to different genres of music, or playing guitar.

More
From Deepesh Sharma

Subscribe to our newsletter

Subscribe to our newsletter for tech tips, reviews, free e-books, and exclusive offers!

Click here to subscribe

Leave a Reply

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