November 12, 2011

Extract a RPM package without installing it

Sometimes you want to use the programs, config files provided by a RPM package, but you cannot install the package since you are not root. You can extract the files you want from the package:
 


Command:
 
rpm2cpio myrpmfile.rpm | cpio -idmv


Explanation:

rpm2cpio: converts the .rpm file specified to a cpio archive on standard out.
cpio: copy files to and from archives.
cpio options:
  • -i: extracts the archive
  • -v: shows the file names as they are extracted
  • -d: create directories as necessary
  • -m: retain previous file modification times when creating files.

Reference:
cpio manpage
rpm2cpop manpage
How To Extract an RPM Package Without Installing It

No comments:

Post a Comment