How to extract an RPM (without installing)

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:

image

image

 image

 

 

Leave a Reply

Your email address will not be published / Required fields are marked *