trivial command to extract files from an rpm file.

Greg_Swift at Greg_Swift at
Thu Mar 4 00:08:43 UTC 2010

> > As a corollary to creating the rpm file, I'd like a trivial way to
> > extract (install) a rpm file in a non-standard location, in an
> > environment where I don't have root and don't want to 'pollute' the
> > environment, to do various checks on that rpm file.
> >
> > So, how do you do this? I tried:
> >
> > rpm -i <bin.rpm> --root /tmp/myroot --nodeps
> >
> >  but it still looks like it is trying to install the files in the same
> > location as where they were packaged (ie: prefixed with slash, etc,
> > curl goes into /usr/bin/curl as usual)
> >
> > Shouldn't this command put all the files rooted in /tmp/myroot, eg.
> > /tmp/myroot/usr/bin/curl? If not, how do you make it do so?
> I believe you are looking for --prefix, but the RPM has to support the
> change.  (not sure hot to verify that).

Ohh.. and if you just actually want to extract the files and not perform an
install (such as the pre/post scripts) you can use rpm2cpio.

rpm2cpio <filename> | cpio -idmv


More information about the Rpm-list mailing list