Fortunately, Linux has got the tool you need. With Alien, you can easily convert your existing Linux package to other formats through the command line. Let’s start by installing the tool on your system first.

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 alien package using APT as you’d normally do.

Debian users can simply install the package using APT:

Alien isn’t available in the official Arch repositories yet. However, you can install it from the AUR using an AUR helper. For the purpose of this guide, we’ll use yay.

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

Once done, verify the installation by typing alien –version in the terminal. If the command returns version information for the package, the installation is successful. However, if not, try going through the installation steps again.

Convert Between Linux Packages Using Alien

Using Alien, you can convert between a number of Linux packages. To list a few:

DEB (Debian-based distros) TAR. GZ (Packaged Archive) RPM (Fedora, CentOS, and other distros) PKG (Solaris package format) SLP LSB

Alien can interpret the following options:

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

How to Use Alien on Linux

The basic syntax of the utility is:

…where options are the various 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:

To demonstrate how you can convert a package to all the other formats, we will convert a DEB file to other Linux packages.

DEB to RPM:

DEB to TAR.GZ:

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

DEB to SLP:

Note that you can also convert any package format to any other format. For example, RPM to LSB, SLP to PKG, PKG to DEB, etc.

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

If the package contains scripts specific to the format, you can convert those scripts using the –scripts or -c flag.

Install Packages After Conversion

Apart from converting packages, Alien can also install the packages for you. You can add the –install or -i flag with the command to immediately install the package after conversion.

For example:

Handling Version Information During Conversion

By default, Alien automatically increments the version details of the package. If you convert a package with version number 1.17.1 using Alien, the generated package will have version number 1.17.2.

You can override this default behavior using the -k or –keep-version flag as follows:

You Can Now Convert Packages in Linux

As a developer, rebuilding a package for different Linux distros can be tough. To tackle this issue, you can use Alien to convert your package to other Linux formats easily.

Although Alien is a reliable utility, it is not recommended if you want to properly develop native packages for distros. Also, while publishing a package, you should always list down the dependencies required by the program.