There is no direct RPM option available via rpm command to extract an RPM file. But there is a small utility available called rpm2cpio. It extract cpio archive from RPM Package Manager (RPM) package.
rpm2cpio converts the .rpm file specified as a single argument to a cpio archive on standard out.
Example
$ mkdir test
$ cd test
Extract RPM file using rpm2cpio and cpio command:
$ rpm2cpio php-5.1.6-12.el5.i386.rpm | cpio -idmv
Output of rpm2cpio piped to cpio command with the following options:
* i: Restore archive
* d: Create leading directories where needed
* m: Retain previous file modification times when creating files
* v: Verbose i.e. display progress
Output:
./etc/httpd/conf.d/php.conf
./usr/lib64/httpd/modules/libphp5.so
....
.....
..
./var/lib/php/session
./var/www/icons/php.gif
6349 blocks
Verify that you have extracted an RPM file in current directory:
$ls
Output:
etc php-5.1.4-1.esp1.x86_64.rpm usr var
This is useful if you want to extract configuration file or other file w/o installing an RPM file.
rpm2cpio converts the .rpm file specified as a single argument to a cpio archive on standard out.
Example
$ mkdir test
$ cd test
Extract RPM file using rpm2cpio and cpio command:
$ rpm2cpio php-5.1.6-12.el5.i386.rpm | cpio -idmv
Output of rpm2cpio piped to cpio command with the following options:
* i: Restore archive
* d: Create leading directories where needed
* m: Retain previous file modification times when creating files
* v: Verbose i.e. display progress
Output:
./etc/httpd/conf.d/php.conf
./usr/lib64/httpd/modules/libphp5.so
....
.....
..
./var/lib/php/session
./var/www/icons/php.gif
6349 blocks
Verify that you have extracted an RPM file in current directory:
$ls
Output:
etc php-5.1.4-1.esp1.x86_64.rpm usr var
This is useful if you want to extract configuration file or other file w/o installing an RPM file.
No comments:
Post a Comment