Use alien to convert Deb to RPM (and RPM to Deb)

Oct 26, 2015 • packagecloud


Alien is a command line tool that allows you to convert Debian packages to RPM packages, and vice versa. This blog post will illustrate how to convert a Debian package to an RPM and similarly, how to convert an RPM package to a Debian package.

Installing Alien

Installation on Debian systems

alien can usually just be installed using apt-get on most Debian based systems. You’ll also want fakeroot.

$ sudo apt-get install alien fakeroot

Installation on Redhat systems

You’ll need the following dependencies installed.

$ yum install xz xz-devel perl-ExtUtils-Embed gcc make fakeroot

Note: to convert RPM to Debian Packages, you’ll need to install all the Debian tools (dpkg, dpkg-dev, debhelper), which is non-trivial on Redhat systems, so we recommend just finding a Debian system instead.

$ wget

Extract the xz archive.

$ tar -xJf alien_8.95.tar.xz

Visit the newly extracted directory.

$ cd alien-8.95

Generate the Makefile.

$ perl Makefile.PL

Run the Makefile.

$ make

Install the alien tool:

$ sudo make install

Converting an RPM to Debian package with Alien

For the example RPM package, we’ll download our packagecloud-test-1.1-1.x86_64.rpm package, from the packagecloud-test-packages repository.

$ wget --content-disposition

Now, just run alien on it (using fakeroot).

$ fakeroot alien packagecloud-test-1.1-1.x86_64.rpm
packagecloud-test_1.1-2_amd64.deb generated

Note how it correctly changed RPM’s architecture x86_64 to the Debian nomenclature: amd64.

You should now have a packagecloud-test_1.1-2_amd64.deb package in that same directory.

Let’s just install it with dpkg -i.

$ dpkg -i packagecloud-test_1.1-2_amd64.deb

Finally, you should be able to run our packagecloud_hello program to verify everything worked.

$ packagecloud_hello
Hi from the packagecloud crew's test program

Converting a Debian package to RPM with Alien

For the example Debian package, we’ll download our packagecloud-test_1.1-2_amd64.deb package from the packagecloud-test-packages repository.

$ wget --content-disposition

Again, we run alien on it (in a fakeroot), but this time with the --to-rpm flag.

$ fakeroot talien --to-rpm packagecloud-test_1.1-2_amd64.deb
packagecloud-test-1.1-3.x86_64.rpm generated

You should now have a packagecloud-test-1.1-3.x86_64.rpm package in that same directory.

Let’s install that RPM on a Redhat based system.

$ rpm -ivh packagecloud-test-1.1-3.x86_64.rpm

Finally, you should be able to run our test program to verify everything worked.

$ packagecloud_hello
Hi from the packagecloud crew's test program

How does Alien work?

Because Debian and RPM packages are a special kind of archive, automatically transforming between them is possible. For example, to transform an RPM to a Debian package, you would move the contents of an RPM cpio archive, to an ar archive.

Common Alien issues

It’s important to note that since Alien is just converting between package archive formats, the package you get may not always install, or work as desired, once installed.

Dependency Chain

It’s entirely possible that the original package dependency chain differs from the desired target system. For instance, a binary in the original package was linked against glibc-2.8 but the target system only has glibc-2.1 installed. It’s unlikely this package will work, and you might have to build a native RPM or Debian package instead.

Post/Pre/Uninstall scripts

Debian and RPM packages have shell scripts that can run before and/or after your install (during uninstall, also). By default, Alien will not include these in the converted package, as there is a high likelihood scripts written for RPM packages won’t work for a Debian system, and vice versa. It might be worth inspecting your original Debian or RPM package to see if the included scripts will work and passing --scripts to Alien, if so.

Service initialization

Converting service packages (like redis, apache, mysql, etc) with Alien is tricky because these packages tend to register themselves with the initialization service provided by the native operating system. For example, newer Ubuntu packages will want to use systemd instead of upstart or sysvinit, which is what Redhat systems usually want. The package will install successfully, but the service will not be running, as expected.

Useful Alien options

If you want to bump the version number, you can use --bump=number.

$ sudo alien --bump=5 --to-rpm packagecloud-test_1.1-2_amd64.deb
packagecloud-test-1.1-7.x86_64.rpm generated

To munge/fix permissions, you can use --fixperms.

$ sudo alien --fixperms --to-rpm packagecloud-test_1.1-2_amd64.deb

Install scripts are not included by default, but you can include them using --scripts.

$ sudo alien --scripts packagecloud-test-1.1-1.x86_64.rpm

You can run lintian (must already be installed) on the generated Debian package by using --test.

$ sudo alien --test packagecloud-test-1.1-1.x86_64.rpm

Note: Running --test with --to-rpm does not run rpmlint, as you may expect.


While finding or building native Debian or RPM packages is ideal, it’s still useful to know how to convert between them in a pinch. Be sure to check out the official alien website for more information.

Inspecting and extracting RPM package contents

Inspecting and extracting Debian package contents

Building RPM packages with mock

Building Debian and Ubuntu packages with pbuilder

Never miss an update!

Subscribe to our RSS feed