Home > Linux > How to extract an RPM (without installing)

How to extract an RPM (without installing)

December 4th, 2007 Leave a comment Go to comments

Most of us are familiar with RPM packages and how to install them. Sometimes it can be useful to extract the files without installing them into the RPM database. We use CPIO (a utility to copy files to and from archives) and a tool called rpm2cpio.

  1. Download/obtain the RPM you wish to extract.
  2. Make a temporary directory for your RPM extraction.
  3. Run the following command: 
    rpm2cpio wget-1.9.1-22.i386.rpm | cpio -idmv
  4. Your files are now extracted (with directory structure) in your temporary directory. The cpio flags are as follows:
    i - restore archive
    d - create any leading directories if needed
    m - retain file modification times
    v - verbose mode (display progress and folder structure)

Here’s what we see on the screen when performing the above operations:






Categories: Linux Tags:
  1. No comments yet.
  1. No trackbacks yet.