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.
| < Prev | Next > |
|---|
My Twitter
- feed:
- follow:
- 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 0 tweets in past 30 days from atirjavid:
People talking about '@Linux':




















