Wednesday, August 21, 2013

Converting .rpm Packages To Debian/Ubuntu .deb Format With Alien




This article shows how you can convert .rpm packages to .deb packages with a tool called alien so that you can easily install them on Debian and Ubuntu systems. Sometimes this is quite convenient as not all software projects release their software as Debian/Ubuntu packages.

However, you should keep in mind what the alien man page says:


"alien should not be used to replace important system packages, like init, libc, or other things that are essential for the functioning of your system. Many of these packages are set up differently by the different distributions, and packages from the different distributions cannot be used interchangeably. In general, if you can't remove a package without breaking your system, don't try to replace it with an alien version."


1 Preliminary Note

In this example I use a Debian Sarge system, and I will show how to convert the mysql-zrm rpm package to a .deb file and install that one. The procedure is the same for Ubuntu.


2 Alien Installation

Alien is available in the normal Debian repositories, so we can install it like this:

apt-get install alien


3 Converting .rpm To .deb

Next we  use any rpm file which you want to convert,  Here I am using VLC (vlc-1.1.13-1.el6.rf.x86_64.rpm)

To convert it into a .deb package, we simply run

alien vlc-1.1.13-1.el6.rf.x86_64.rpm

Afterwards, run

ls -l

You'll see that alien has created the file vlc-1.1.13-2.el6.rf.x86_64.deb. You'll also notice that alien has counted up the version number,  it's now 1.1.13-1 instead of 1.1.13-2. If you want to keep the original version number, you must use the -k switch:

alien -k vlc-1.1.13-1.el6.rf.x86_64.rpm

will create the file vlc-1.1.13-1.el6.rf.x86_64.deb.

To install the new .deb file, we use dpkg -i:

dpkg -i vlc-1.1.13-1.el6.rf.x86_64.deb

If you want to save the dpkg -i step, you can have alien install the package. The command

alien -i vlc-1.1.13-1.el6.rf.x86_64.rpm

would convert the original rpm package and immediately install it.

You see, converting .rpm files to .deb files is very easy. You can have a look at

man alien

to learn about what else you can do with alien.