Author: Steven Neiland
Published:

Warning: This blog entry was written two or more years ago. Therefore, it may contain broken links, out-dated or misleading content, or information that is just plain wrong. Please read on with caution.

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.

  • debian-binary
  • control.tar.gz
  • data.tar.gz

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.

What Do You Think?

Reader Comments

Pepe's Gravatar
Pepe
Sunday, July 1, 2012 at 3:39:36 PM EDT

thanks for posting!!!i don't know how extract DEB packages without convert to TGZ.
Other smart way to extract RPM:

rpm2cpio <file>.rpm | cpio -idmv

extracted from www.cyberciti.biz/tips/how-to-extract-an-rpm-package-without-installing-it.html.

maybe RPM's from OpenSUSE : rpm2cpio file.rpm | lzma -d | cpio -idmv

Thanks guys.!

Post a Comment

Comment Etiquette:

  • Please keep comments on-topic.
  • Please do not post unrelated questions or large chunks of code.
  • Please do not engage in flaming/abusive behaviour.
  • Comments that contain or appear to be advertisments, will not be published.
  • Comments that appear to be created for the purpose of linkbuilding to commercial sites will be removed.

We are all adults here so play nice.

*
*



Archives Blog Listing

Tag Listing

Learn CF In A Week

Treehouse

 
Fork me on GitHub