Alien: Converting Between Package Formats

I was aware of alien program for quite some time, but never had any real chance to use it in practice. However, that time has finally come.

Alien

As the alien man page says, alien is a program that converts between Red Hat rpm, Debian deb, Stampede slp, Slackware tgz, and Solaris pkg file formats. This basically means that if we lack some package on a Linux distribution of choice, we can convert that package from another distribution and attempt to install it on ours.

However, alien should not be used to replace any important system packages or other things that are vital for the functioning of a system.

In order to convert between different formats, alien requires both RPM and Debian package systems to be installed. This shouldn’t sound that scary as alien doesn’t use the database features of these packages by default. The presence of a foreign package manager is not a problem as long as we don’t use it to install software.

Convert Htop .deb Package to .rpm and Install on CentOS

All this alien idea came to reality at the point where I got my CentOS testing server set up, and was just about to install my favourite htop process viewer, when yum suddenly told me that no package htop is available.

Having in mind that htop .rmp package is available for download on the Internet, it is unlikely to represent the best usage of alien, however, otherwise it wouldn’t be interesting. Long story short, we have two testing servers in place.

Debian Wheezy:

# uname -rv
3.2.0-4-686-pae #1 SMP Debian 3.2.51-1

And CentOS 6.3 (final):

# uname -rv
2.6.32-279.el6.i686 #1 SMP Fri Jun 22 10:59:55 UTC 2012

We already have htop installed on a Debian machine. What we have to do now is to get alien:

root@debian:~# apt-get update && apt-get install rpm alien -y

Download htop package with no installation:

root@debian:~# apt-get install -d htop

Convert htop .deb package to .rpm:

root@debian:~# alien --to-rpm /var/cache/apt/archives/htop-1.0.1-2.i386.deb 
htop-1.0.1-2.i386.rpm generated

Let’s check:

root@debian:~# ls 
htop-1.0.1-2.i386.rpm

Looks good. Now we need to get the .rpm file transferred from Debian server to CentOS:

root@centos:~# scp -P12 root@debian:/root/htop-1.0.1-2.i386.rpm ./ 
root@debian's password:
htop-1.0.1-2.i386.rpm           100%   73KB  72.7KB/s   00:00

Since both machines are for testing and have no public ssh access enabled, we use root user for the sake of convenience.

Let’s install the package:

root@centos:~# rpm -ihv ./htop-1.0.1-2.i386.rpm
Preparing... ########################################### [100%]
1:htop ########################################### [100%]

The package information should identify the alien version that was in use:

root@centos:~# rpm -qi htop
 Name : htop Relocations: (not relocatable)
 Version : 1.0.1 Vendor: (none)
 Release : 2 Build Date: Sat 23 Nov 2013 07:02:44 PM GMT
 Install Date: Sat 23 Nov 2013 07:03:51 PM GMT Build Host: debian
 Group : Converted/utils Source RPM: htop-1.0.1-2.src.rpm
 Size : 149862 License: see /usr/share/doc/htop/copyright
 Signature : (none)
 Summary : interactive processes viewer
 Description :
 Htop is an ncursed-based process viewer similar to top, but it
 allows one to scroll the list vertically and horizontally to see
 all processes and their full command lines.
 Tasks related to processes (killing, renicing) can be done without
 entering their PIDs.

(Converted from a deb package by alien version 8.87.)

Alien sofwtare is no longer needed on our Debian server, and therefore can be removed:

root@debian:~# apt-get remove alien rpm -y ; apt-get autoremove -y

We also want to clear out the local repository of retrieved package files:

root@debian:~# apt-get clean