Saturday, July 18, 2009

Convert linux package files one to another easily

This is a familiar problem for most of the people who are using Linux. Software for Linux are available in many formats. Most popular package managers are rpm on RedHat related distributions(Fedora, CentOS, SUSELinux...) and deb on debian related dists( Debian, ubuntu, Mint...). If they are distributed as .deb or .rpm it's relative easy to install with a single command line.
Sometimes it's very difficult to find deb for an rpm only (or vice versa).
I spent some time searching for a tool to convert .deb to .rpm(still google chrome is ditributed as .deb only).
So I found this tool written in Perl very useful. It's Alien, a script which can convert between .rpm, .deb, .slp and tar.gz(.tgz)
Download it from here .
Unzip it and makesure your system has perl installed and perl version is 5.004 or greater .If not install the latest version by

$sudo apt-get install perl (on Debian distributions)

go into the folder from terminal and type to start installing.
$ perl Makefile.PL
$ make
sudo make install

and it will be installed, and check its man pages for more details.
Its very easy to convert a foriegn package format to the native packaging format of your distribution.
Like
to convert an rpm to .deb on Ubuntu

sudo alien -d file_name.rpm

file_name.deb will be generated.
But converting vice versa is a different story, such as converting a .deb to an .rpm on Ubuntu will give dependency problems. :(
Using verbose option as an command line argument, you can see what alien is doing behind the scenes.


So, no more problems of searching for rpms for deb only softwares :-)

May, Google be with you :P