Extract an RPM Package Files Without Installing It

Just recently i’ve stumpled apon a problem, that needed to have a libgcc_4.2.0.so.1 for Java on an old Suse Enterprise 11.
Due to the security structure, it’s not possible to “just install it”.
Moreover the Java-Application does search for the lib in it’s own setup-Folder.

So how do I get the right version?
After googeling some long time, i finally found an Server which still holds the old RPM-file. (I will try to attach the old rpm on this post)
So okay, next question, how do I get the lib out of the rpm?

Lucky – again thanks to google – I found a nice solution on cyberciti.
with just a small command, it’s possible to extract the files within the rpm:

rpm2cpio libgcc42-4.2.1_20070724-17.x86_64.rpm | cpio -idmv
  • i: Restore archive
  • d: Create leading directories where needed
  • m: Retain previous file modification times when creating files
  • v: Verbose i.e. display progress

Download libgcc42-4.2.1_20070724-17.x86_64.rpm as zip-Archive. (Use unzip to … well … unzip 🙂 )