Unpack an RPM file

Sometimes you want to unpack an RPM file to just get the executable out of it, and not have it install all the other parts, libraries, etc., over your working versions. You might for example have a tool installed which, in the latest version, is slightly unstable or crash-prone, but you know that the previous version was not that unstable. And, you might also in the process have upgraded a bunch of other things and dependencies etc. and not want to undo all that. Hence, you just want to extract the executable. Alternatively, another use case may be where you want a specific sourcecode file without extracting all of them, e.g. a specific kernel header file.

Suppose your package is called to-install.rpm.

mkdir unpack_folder/

mv to-install.rpm unpack_folder/

cd unpack_folder/

rpm2cpio to-install.rpm | cpio -idv

The contents of the RPM should now be inside your folder. 

Popular posts from this blog

ZFS syntax (updated)

/var/log/journal taking up lots of space

throttle traffic on apache