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.
- Download/obtain the RPM you wish to extract.
- Make a temporary directory for your RPM extraction.
- Run the following command:
rpm2cpio wget-1.9.1-22.i386.rpm | cpio -idmv
- 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: