Alien Command

Convert Packages with Alien

Generating Packages with Alien

The "alien" command is a piece of software that allows you to convert between different package types for use with Linux operating systems. Alien supports the conversion of the following package formats: RPM, deb, and Slackware (.tgz) packages.

Alien options:

-i Automatically install the output package and remove the converted package file.

-r Convert package to a RPM format.

Converting RPM packages to DEB packages

In the following example, we are going to look at how to convert a Red Hat Package (rpm) to that of a Debian type package .(deb).

To install the alien conversion software, you will need to issue the command:

# sudo apt-get update
# sudo apt-get install alien

In the following example the alien command will convert htop-0.9-1.el6.rf.i686.rpm file to htop_0.9-2_i386.deb file. Once you generate the deb file, you can install it on a Debian based system (Debian, Ubuntu, Mint...). The rpm file was downloaded in the example using the "wget" command. If this is not available, it can be installed by issuing "sudo apt-get install wget".


john@john-desktop:/tmp$ ls -l *.rpm
-rw-rw-r-- 1 john john 75812 Nov 28  2010 htop-0.9-1.el6.rf.i686.rpm

john@john-desktop:/tmp$ sudo alien htop-0.9-1.el6.rf.i686.rpm
htop_0.9-2_i386.deb generated

john@john-desktop:/tmp$ ls -rtl *.deb
-rw-r--r-- 1 root root 83610 Jul 22 20:17 htop_0.9-2_i386.deb

Converting a DEB package to a RPM

In the following example we will convert a debian based package into a Red Hat RPM package.

To install the alien conversion software on a Red Hat based system, you will need to download the appropriate rpm file that matches your architecture. rpm files can be downloaded directly from your browser or from the command line using the "wget" command providing this package is installed.

In the example below I installed version: alien-8.81-2.noarch.rpm

[root@centos64 tmp]# rpm -Uhv rpm -Uvh alien-8.81-2.noarch.rpm

You may need to install some further package dependencies by issuing the following command:

[root@centos64 tmp]# sudo yum -y install python rpm-build make m4 gcc-c++ autoconf automake redhat-rpm-config mod_dav_svn mod_ssl mod_wsgi

To verify your installation you can issue the following commands:

[root@centos64 tmp]# rpm -qa alien
[root@centos64 tmp]# alien --version
alien version 8.81

Once installed, you may now convert your package to a Red Hat format using the "-r" option:

[root@centos64 tmp]# alien -r htop_1.0.1-1_i386.deb
htop-1.0.1-2.i386.rpm generated

The use of the alien command to convert packages should only be used as a last resort. You should always try to find a package first that has been specifically built for your platform. For some installations you may need to specify the "--scripts" option. Before running with this option you may wish to read the man pages regarding the "--scripts" option: (see below)

"--script Try to convert the scripts that are meant to be run when the package is installed and removed. Use this with caution, because these scripts might be designed to work on a system unlike your own, and could cause problems. It is recommended that you examine the scripts by hand and check to see what they do before using this option"

Alien Help

For further help with installing packages you may want to view the built in help options:

john@john-desktop:/tmp$ alien --help
Usage: alien [options] file [...]
  file [...]                Package file or files to convert.
  -d, --to-deb              Generate a Debian deb package (default).
     Enables these options:
       --patch=<patch>      Specify patch file to use instead of automatically
                            looking for patch in /var/lib/alien.
       --nopatch	    Do not use patches.
       --anypatch           Use even old version os patches.
       -s, --single         Like --generate, but do not create .orig
       --fixperms           Munge/fix permissions and owners.
       --test               Test generated packages with lintian.
  -r, --to-rpm              Generate a Red Hat rpm package.
      --to-slp              Generate a Stampede slp package.
  -l, --to-lsb              Generate a LSB package.
  -t, --to-tgz              Generate a Slackware tgz package.
     Enables these options:
       --description=<desc> Specify package description.
       --version=<version>  Specify package version.
  -p, --to-pkg              Generate a Solaris pkg package.
  -i, --install             Install generated package.
  -g, --generate            Generate build tree, but do not build package.
  -c, --scripts             Include scripts in package.
  -v, --verbose             Display each command alien runs.
      --veryverbose         Be verbose, and also display output of run commands.
  -k, --keep-version        Do not change version of generated package.
      --bump=number         Increment package version by this number.
  -h, --help                Display this help message.
  -V, --version		    Display alien's version number.