Home Package management How To Convert Linux Packages With Alien

How To Convert Linux Packages With Alien

By sk
Published: Updated: 9.5K views

The developers and package maintainers may not always create packages for all Linux distributions. Some packages might be available only for a specific Linux platform. In such cases, you can use package conversion tools like Alien to easily convert Linux packages to different formats. In this guide, we will see what is Alien, how to install Alien in various Linux operating systems and then how to convert a Linux package from one format to another using Alien package converter.

What is Alien?

Alien is a command line package converter that converts between different Linux package formats such as Red Hat rpm, Debian deb, Stampede slp, Slackware tgz, and Solaris pkg etc.

Alien currently supports the following package formats:

  • Linux Standard Base (LSB),
  • LSB-compliant .rpm packages,
  • .deb,
  • Stampede (.slp),
  • Solaris (.pkg)
  • Slackware (.tgz, .txz, .tbz, .tlz).

The alien programs comes in rescue when a specific package or a specific version of a package is not available for your Linux distribution. You can easily convert such package to your preferred package format using Alien and install it on your system.

Alien is not only a package converter, it can also install the generated packages automatically after package conversion. It can even has option to convert the scripts that are meant to be run when the package is installed. You must be careful when using this option. You should examine the scripts carefully and check what these scripts do before using this option.

Heads Up: Alien should not be used to convert important system packages, such as init, libc, which are necessary for the functioning of your Linux system. The system packages that are specifically designed for a particular Linux distribution can't be used interchangeably and may break your system if you forcibly try to install them.

Install Alien in Linux

Alien package converter is available in the default repositories of popular Linux distributions.

To install Alien in Alpine Linux, run:

$ sudo apk add alien

Install Alien in Debian, Ubuntu LTS, Linux Mint, Pop!_OS:

$ sudo apt install alien

Install Alien in Fedora:

$ sudo dnf install alien

Install Alien in CentOS 8, RHEL 8, AlmaLinux 8, Rocky Linux 8:

$ sudo dnf install epel-release
$ sudo dnf install alien

Convert Linux packages using Alien

The general syntax to convert Linux packages using Alien from one format to another is:

alien [--to-deb] [--to-rpm] [--to-tgz] [--to-slp] [options] file [...]

Converting packages using Alien is very easy!

To convert a .rpm package into a .deb package, simply run alien as root or sudo user:

$ sudo alien --to-deb /path/to/file.rpm

Similarly, to convert .deb file to .rpm, run:

$ sudo alien --to-rpm /path/to/file.deb

Here is the list of supported flags to convert Linux packages to different formats.

  • -d, --to-deb - Make debian packages. This is the default.
  • -r, --to-rpm - Make rpm packages.
  • -l, --to-lsb - Make a LSB package.
  • -t, --to-tgz - Make tgz packages.
  • --to-slp - Make slp packages.
  • -p, --to-pkg - Make Solaris pkg packages.

Let us see some examples. For the purpose of this guide, I will be using hello world .rpm package. Please note that hello package is packaged for almost all Linux distributions. So you don't need to convert it. I am using it just for the sake of demonstration.

Convert RPM packages to DEB packages using Alien

Now let us convert the hello rpm package to .deb format using Alien like below:

$ sudo alien --to-deb hello-2.10-5.fc34.x86_64.rpm

Or shortly,

$ sudo alien -d hello-2.10-5.fc34.x86_64.rpm

This will convert the given .rpm package into .deb package and save the generated package in the current directory.

Convert a rpm package into deb package using Alien
Convert a rpm package into deb package using Alien

Heads Up: If no flag is specified, Alien will convert the packages to .deb format by default.

You can install the generated package using the default package manager.

We can also convert multiple packages at a time. The following command will convert the given packages (hello & vim) to .deb format.

$ sudo alien hello-2.10-7.x86_64.rpm vim-enhanced-8.2.2637-1.fc34.x86_64.rpm 

Convert DEB packages to RPM packages using Alien

Similarly, we can convert the .deb package into .rpm package file like below:

$ sudo alien --to-rpm hello-2.10-5.fc34.x86_64.rpm

Or shortly,

$ sudo alien -r hello-2.10-5.fc34.x86_64.rpm
Convert a deb package into rpm package using Alien
Convert a deb package into rpm package using Alien

Install packages automatically

Sometimes, you might want to install the generated packages automatically.

To convert a package and install it automatically with Alien, use -i flag.

$ sudo alien -d -i hello-2.10-7.x86_64.rpm 

This command will convert the given .rpm package to .deb package format and then install it, and finally remove the generated package.

Sample output:

	dpkg --no-force-overwrite -i hello_2.10-8_amd64.deb
Selecting previously unselected package hello.
(Reading database ... 52712 files and directories currently installed.)
Preparing to unpack hello_2.10-8_amd64.deb ...
Unpacking hello (2.10-8) ...
Setting up hello (2.10-8) ...
Processing triggers for man-db (2.9.4-2) ...
Install packages automatically with Alien
Install packages automatically with Alien

Convert to multiple package formats

Alien can able to create multiple package file formats from a single package file. The following example shows how to create .deb, and .tgz packages from a .rpm file.

$ sudo alien --to-deb --to-tgz hello-2.10-7.x86_64.rpm
Convert a single package to multiple package formats
Convert a single package to multiple package formats with Alien

Keep version numbers

By default, Alien adds one to the minor version number of each package it converts. For instance, if the version number is 1.2-3, Alien will add one to minor version and change it to 1.2-4.

Take a look at the following command output.

$ sudo alien --to-deb hello-2.10-7.x86_64.rpm 
hello_2.10-8_amd64.deb generated

The version of source package in the above command is 2.10.7. After the package conversion, Alien changed the minor version from 7 to 8 in the target file.

If you don't want Alien to change the version number, use -k, --keep-version flag to keep the original version number in the generated package.

$ sudo alien -k --to-deb hello-2.10-7.x86_64.rpm 
hello_2.10-7_amd64.deb generated

As you see above, the source file and target have the same version number.

Getting help

To display the brief description of Alien and all supported general options, refer the Alien help section by running the following command:

$ alien --help

Also, refer the manual page.

$ man alien


I won't give any assurance about the accuracy of Alien converter. I tested only a few packages such as Vim, Hello world, and Nano. As far as I tested, Alien works just fine for me in Debian 11 bullseye.

It probably won't work for some packages that depends on large number of dependencies. The result may vary from package to package.

In such cases, you may need to build them from source manually or using other reliable applications such as CheckInstall or Fpm. I suggest you to look into the following resources to learn how to build packages from source.

Hope this helps.


You May Also Like

1 comment

Jalal Hajigholamali September 8, 2021 - 12:07 pm

Thanks a lot
Very nice and useful article


Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. By using this site, we will assume that you're OK with it. Accept Read More