Jimmy's weblog

2/26/2006

Installing RPM packages on debian

Filed under: — jimmy @ 12:31 am

You might know the problem with some software packages: You can have rpms for SuSE and RedHat but no debian package. And probably no tar.gz so you have to use the rpms. Well, I don’t want to post a full HowTo of package conversion. There are enough available. But I want to summarize the most important commands that I always needed.

Conversion, method 1
First of all, let’s do the conversion with alien:

alien package.rpm

(Checkout the manpage of alien for all available options.)
This command generates a file called package.deb, which is ready to install.

In most cases the original rpm package will include some pre- and postinstall scripts which could also be converted by alien but most times the scripts are distribution specific. So you can extract the scripts and make new debian-specific scripts:

rpm -q --scripts -p package.rpm > rpmscripts

rpmscripts now consists of all the scripts in one file. Read the commands and make the pre-,postinstall and pre-,postrm scripts for debian.

Conversion, method 2
If you want to build a customized debian package you can also generate a source package:

alien -g -c package.rpm

This creates a directory “package” with all the files and the debian subdirectory.
Option -c also converts the scripts and copies them to the debian subdirectory.
This method is very useful if you want to make a clean debian package with your own modifications. If you just want to install it then method 1 might be more suitable for you.

Other useful rpm commands

  • rpm2cpio package.rpm | cpio -idv
    Extract the files of the package into current directory
    -i … extract
    -d … create leading directories
    -v … verbose

  • rpm -ql -p package.rpm
    Get a filelist of the uninstalled package

  • rpm -qi -p package.rpm
    Get info of the uninstalled package