How to Extract the Contents of an RPM Package

Table of contents:

How to Extract the Contents of an RPM Package
How to Extract the Contents of an RPM Package
Anonim

The acronym RPM derives from the English "Red Hat package manager" and represents one of the essential components of a Linux system. This software tool is used in many Linux distributions, such as Fedora, Mandriva, and so on, for package management. Installing an RPM package is fairly straightforward, but you need access to the system console or a terminal window to extract it. Using the procedure described in the article you will be able to extract the contents of any RPM file quickly and easily.

Steps

Step 1. An RPM file represents a compressed "cpio" archive

For this reason the "rpm2cpio" program is able to convert a file with the ".rpm" extension into a "cpio" archive. You can extract the contents of an RPM file using the normal archiving tools found in a Linux distribution, regardless of the package format used by that distribution. The "rpm" command is also capable of doing this. Below you will find the sequence of instructions to extract the contents of an RPM file.

Extract RPM Packages Step 1
Extract RPM Packages Step 1
Extract RPM Packages Step 2
Extract RPM Packages Step 2

Step 2. Open a terminal window (or the system console which is normally called KDE)

Extract RPM Packages Step 3
Extract RPM Packages Step 3

Step 3. Download the RPM file you want to install and save it in the folder of your choice

Run these commands in sequence:

mkdir test;

cd test;

wget ftp://download.fedora.redhat.com/pub/fedora/linux/updates/11/SRPMS/mediawiki-1.15.1-50.fc11.src.rpm.

Extract RPM Packages Step 4
Extract RPM Packages Step 4

Step 4. Now use the two commands "rpm2cpio" and "cpio" to try to extract all the files contained in the package:

rpm2cpio mediawiki-1.15.1-50.fc11.src.rpm | cpio -idmv

Extract RPM Packages Step 5
Extract RPM Packages Step 5

Step 5. You can also try to install using the following additional parameters

  • i: restore the archive;
  • d: automatically create destination directories when needed;
  • m: keep the previous modification date when creating files;
  • v: stands for "Verbose", whose function is to show the progress of the procedure on the screen.
Extract RPM Packages Step 6
Extract RPM Packages Step 6

Step 6. The package contents will most likely be extracted directly into the directory where the command was run

To check the outcome of the extraction you can use the command:

ls

Recommended: