[CentOS] How to extract one file from rpm using yum?

Thu Jan 31 17:37:14 UTC 2013
Johnny Hughes <johnny at centos.org>

On 01/31/2013 11:05 AM, Connie Sieh wrote:
> On Thu, 31 Jan 2013, Robert Moskowitz wrote:
>> On 01/31/2013 11:36 AM, John Doe wrote:
>>> From: Robert Moskowitz <rgm at htt-consult.com>
>>>> I want to get the original version of /etc/clamd.d/amavis.conf from the
>>>> amavisd-new rpm to get the defaults to submit a bug report.  I could not
>>>> figure out how to do this, so I did a reinstall, but it did not replace
>>>> this file (whatprovides says it comes from this rpm).
>>>> Is there a way to extract just the one file, and better yet, place it
>>>> elsewhere than its regular destination?
>>> You could also just have renamed your conf file temporarily,
>>> reinstalled, moved the default conf file and renamed back
>>> your conf file...
>> OK.  I am set for what I needed.  I went to the repo via http and
>> downloaded the rpm.  I then used archive manager via nautilus to get to
>> the file(s) I needed.  Now to write up the bug report.  Minor item, but
>> it bugs me.... ;)
> The command line way of getting 1 file out of a rpm is to rpm2cpio.
>     rpm2cpio <rpmfilename> > <filename.cpio>
> Now you have a cpio archive which you can use to get files out of.


rpm2cpio <rpmfilename> | cpio -idv

That will extract all the files to the current directory (create a
temporarily directory and cd into it before you start).

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://lists.centos.org/pipermail/centos/attachments/20130131/e9a10464/attachment-0004.sig>