Currently Online

We have 7 guests online
None

Login

             | 

Search

Like it? Share it!

How To Extract an RPM Without Installing (EXTRACT & UNPACK .RPM)

linux - Tutorials

User Rating: / 2
PoorBest 

How To Extract an RPM Without Installing (EXTRACT & UNPACK .RPM)

Most of you linux users may already know to how extract .tgz tarballs and/or a zip/rar archives. Some of you advanced linux users may even know how to extract files from a Debian Package Archive (.DEB). However, a lot of you do not know how to extract files from an RPM archive as I get frequently asked this question on IRC. I will just write an article and point to to here :)

I should begin by mentioning that RPM is evil.

BLAH.rpm has 226 dependencies, of which your system will have 10 unresolved. Attempting to resolve those 10 involves serveral more rpm files, that have their own 826 dependcies, of which yet more are unresolved, of course, and it goes on and on until you go bald from too much hair pulling. Stop! Do not pull your hair out :)

Now, finally down to business.

Method 1:

This technique assumes that you already have the 'rpm', 'rpm2cpio' and 'cpio' packages installed on your distribution. As far as Microsoft Windows goes, you'll have to figure that out on your own, as I don't use windows. I heard that WinRAR can extract RPM files, and possibly Zip Genius or some such. Do your own research if you like to use shitty operating systems.

Make sure you have the above packages installed oherwise this will not work. The basic syntax for RPM2CPIO is

$>rpm2cpio /path/to/file.rpm | cpio -mvid

This will extract the contents of the RPM package to your current directory. This is useful for working with the files that the package provides without installing the package on your system. Might be useful to create a temporary directory to hold the packages before running the extraction:

$>mkdir /tmp/new-package/; cd /tmp/new-package;

Now run the rpm2cpio command. Read the documentation for rpm2cpio in order to learn how to use its various options.

Method 2:

This technique involves using the Alien software. 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, or extract files from it and do with it as you like.

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.

I use Debian GNU/Linux, and as such you can simply install Alien by typing (as root or as sudo)

#> aptitude install alien

After alien has installed you can convert an RPM to a standard TGZ. To do so, run the following command:

$>alien -t /path/to/some.rpm (note: you may have to run this as root or sudo as well)

This is generate a some.tgz in the current directory. Now you can easily extract this archive using the command

$>tar zxvf some.tgz

This will unpack the archive in the current directory and you can then browse the archive and with the files as you please.

I hope this helped. You should definitely look into reading more about rpm2cpio and alien. I would put my money on alien as it is the cleanest way to generate packages.

My Twitter

atirjavid's avatar
Atir Javid atirjavid
  • bio:
    C.E.O Frosted Web, Social Media Marketing & Development | C.T.O. Sky Social Media Inc, former Debian contributor, maintainer and developer. Currently w/FreeBSD.
  • web:
  • location:
    Baton Rouge, LA. USA
  • updates:
    389
  • followers:
    136
  • following:
    15
Last 4 following:
runev's avatar emiltofan's avatar CalEvans's avatar fabpot's avatar
Loading...

Last 0 tweets in past 30 days from atirjavid:

People talking about '@Linux':

Quick Links

CopyLeft Notice

Distribution of the Original Works

You’re free to copy and redistribute the copylefted work — either by itself, or as part of a larger collection of works. All you have to do is (1) be honest - by clearly crediting me as the author, and only redistributing accurate copies of the original (But you don't REALLY have to :) hehe )- and (2) keep it free - by distributing the copy under the same copyleft license, and including either a copy of the license, or a reference to its URL (http://creativecommons.org/licenses/by-sa/1.0/legalcode).

You don’t have to copyleft your whole newsletter to reprint a single article of mine in it (although copylefting your whole newsletter is certainly worthwhile on its own merits). You only have to distribute the copy of my work under the copyleft terms. You’re also free to distribute abridged, translated, or otherwise edited copies of my works — but these count as derivative works, not copies of the original.

Derivative Works

You’re also free to make and distribute derivative works from the copylefted work (such as abridged or edited copies of original works, stories about characters introduced in the original works, etc.). All you have to do is (1) be honest — by clearly identifying your work as a derivative work, and clearly crediting me as the author of the original work on which it was based (But you don't REALLY have to do that either :) Hehehe) — and (2) keep it free — by distributing your derivative work as free content under the terms of the same copyleft license under which the original work was distributed. Please read the (The GNU General Public License ). Thank you very much.

Credit me or don't. Just please keep the information free and flowing.