How do I extract the contents of an rpm?
Did you try the rpm2cpio
commmand? See the example below:
$ rpm2cpio php-5.1.4-1.esp1.x86_64.rpm | cpio -idmv
/etc/httpd/conf.d/php.conf
./etc/php.d
./etc/php.ini
./usr/bin/php
./usr/bin/php-cgi
etc
Extract RPM to directory other than current directory
Since cpio
is just reading from standard input, you can change to another directory before running it:
rpm2cpio mypackage.rpm | (cd /to/other/directory; cpio -idmv)
This is a general solution that will work with a variety of tools. The cpio
command has a --directory
(-D
) option that will accomplish the same thing:
rpm2cpio mypackage.rpm | cpio -D /to/other/directory -idmv
Is there a way to extract .rpm file through windows batch file? Can anyone help me with this?
7zip has the capability to extract files from an .rpm
. Use the e
option to extract.
7z e file1.rpm
How to extract RPM from RPM database on Red Hat Enterprise Linux
If you want to save a copy of the package as currently installed before upgrading or removing it, use rpm --repackage
-- it'll save the RPMs in /var/tmp or /var/spool/repackage or elsewhere, depending on your configuration.
Otherwise, there exists rpmrebuild
, which does exactly what you ask for.
Word of caution: with neither of these tools do you obtain the exact same *.rpm
as the one you started from. Any changes to the installed files belong to the package will be in the RPMs generated.
Related Topics
How to Get Multi-Line String Between Two Braces Containing a Specific Search String
How to Increase the Scrollback Buffer in a Running Screen Session
Linux Command (Like Cat) to Read a Specified Quantity of Characters
How to Run Sudo Command in Winscp to Transfer Files from Windows to Linux
Cmake:Set Environment Variables from a Script
How to Calculate the Mean of a Column
.Net-Core: Equivalent of Ildasm/Ilasm
How to Analyse a Crash Dump File Using Gdb
Install Rabbitmqadmin on Linux
Grep Command to Add End Line After Every Match
What Is Partition Checker in Arm Secure Mode
Why Does Find -Exec Mv {} ./Target/ + Not Work
Check If Directory Mounted with Bash
How to Read Websocket Response in Linux Shell
Linux Execute Command Remotely
Using Jq to Fetch Key Value from JSON Output
Handling Input Confirmations in Linux Shell Scripting
Where to Start Learning About Linux Dma/Device Drivers/Memory Allocation