Oct 082011

As many of you know the most used packages on GNU/Linux are deb and rpm.

deb is the extension of the Debian software package format and the most often used name for such binary packages.
Debian packages are standard Unix ar archives that include two gzipped, bzipped or lzmaed tar archives: one that holds the control information and another that contains the data.
The accepted program for handling these packages is dpkg, commonly used via other programs such as apt/aptitude or Gdebi.

RPM Package Manager (RPM) is a package management system. The name RPM variously refers to the .rpm file format, files in this format, software packaged in such files, and the package manager itself. RPM was intended primarily for GNU/Linux distributions; the file format is the baseline package format of the Linux Standard Base.

Originally developed by Ethan “E$” Cohen at Red Hat for Red Hat Linux, RPM is now used by many GNU/Linux distributions. It has also been ported to some other operating systems, such as Novell NetWare and IBM’s AIX.

Debian packages can be converted into other packages and vice versa using alien

Alien is a program that converts between the rpm, dpkg, stampede slp, and slackware tgz file formats. If you want to use a package from another distribution than the one you have installed on your system, you can use alien to convert it to your preferred package format and install it.

Despite the large version number, alien is still (and will probably always be) rather experimental software. It has been used by many people for many years, but there are still many bugs and limitations.

Alien should not be used to replace important system packages, like sysvinit, shared libraries, or other things that are essential for the functioning of your system. Many of these packages are set up differently by Debian and Red Hat, and packages from the different distributions cannot be used interchangably. In general, if you can’t uninstall the package without breaking your system, don’t try to replace it with an alien version.

Let’s see some example.

From RPM to DEB

As first thing install alien on your Debian or Ubuntu with the command:

# sudo aptitude install alien

Now let’s say you have in the directory /tmp the file myprogram.rpm, which is not present on Debian or Ubuntu and we want to convert it, simply enter the command

sudo alien /tmp/myprogram-1.10-2.i386.rpm
myprogram-1.10-3.i386.deb generated

Now you will find in /tmp the file myprogram.deb that you can install with dpkg:

dpkg -i /tmp/miprogramma.deb

You can skip the install phase, telling to alien to install directly with the -i option

 sudo alien -i /tmp/myprogram.rpm

From DEB to RPM

Simply use alient -r to convert a deb file to a rpm file, for example:

sudo alien -r pytube_0.0.8.1-1_all.deb
pytube- generated

Once that the rpm file it’s generated, you can install it on Red Hat, Fedora or any rpm based distribution.

Frontend for Alien

Package Converter, it’s the front-end GUI for Alien is intuitive and easy-to-use.

Package Converter is written with Realbasic and has downloadable packages in BIN, RPM and DEB. And naturally it requires Alien to work.

Popular Posts:

flattr this!

  2 Responses to “How to convert from .deb to .rpm and viceversa”

  1. Hi,
    while converting from deb to rpm, sometimes it becomes useful (or unavoidable) to convert pre and post install scripts, as well, with -c (–scripts) option. As stated in man pages it’s quite a dangerous option, therefore I think IMVHO a good practice should be to inspect the install scripts content, before converting/installing the deb package(s). (e.g: It happened that some binaries into a file.deb had wrong file permissions, along with directory trees: the install scripts were fixing the issue, but if one missed them during the conversion…).
    It should be interesting to know what your opinion about the aforementioned option.

    Thanks and of course a big thanks for the very nice article, as usual!

  2. Richiede i pacchetti gcc e make e tutto il Perl.

 Leave a Reply




You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>