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:

[email protected]:~# apt-get update && apt-get install rpm alien -y

Download htop package with no installation:

[email protected]:~# apt-get install -d htop

Convert htop .deb package to .rpm:

[email protected]:~# 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:

[email protected]:~# ls 
htop-1.0.1-2.i386.rpm

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

[email protected]:~# scp -P12 [email protected]:/root/htop-1.0.1-2.i386.rpm ./ 
[email protected]'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:

[email protected]:~# 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:

[email protected]:~# 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:

[email protected]:~# apt-get remove alien rpm -y ; apt-get autoremove -y

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

[email protected]:~# apt-get clean

Leave a Reply

Your email address will not be published. Required fields are marked *