Extract RPM or DEB packages in Slackware

Published: {ts '2011-02-05 00:00:00'}
Author: Steven Neiland
Site Url: http://www.neiland.net/article/extract-rpm-or-deb-packages-in-slackware/

Many times I have needed a tgz package for my slackware server only to find that it is only available in .rpm or .deb format. After alot of googling I found some simple solutions. Here they are.

Note: While these methods will convert the data as you need, be aware that the packages have been built for an alternative distribution and may not work as expected.

Convert .rpm to .tgz

This is the simplest of them all. Slackware comes with a handy utility called oddly enough "rpm2tgz".Simply run this on your rpm file and thats it.

rpm2tgz [packagename].rpm

Convert .rpm to tar.gz

Alternatively if you need a tar.gz file just run "rpm2targz" on your rpm file

rpm2targz [packagename].rpm

Convert .deb to tgz

This took a little more time to figure out. The easiest solution I found is to first install the "deb2tgz" utility which can be downloaded from http://code.google.com/p/deb2tgz/. Then once again run the relevent command.

deb2tgz [packagename].deb

Convert .deb to tar.gz

It turns out that deb files are simply "ar" archives which contain the following files.

The file we are interested in is the "data.tar.gz" file. To extract it we simply use the "ar" command. This leaves us with the three files above from which we select the data.tar.gz file which we can list or extract as normal using the tar command.

//extract deb file using ar ar vx mypackage.deb //list all files in the resultant tar.gz file tar -tzvf data.tar.gz //extract the tarball tar -xzvf data.tar.gz

There you have it, four simple ways of converting rpm/deb into slackware usable packages.