How to extract RPM or Deb packages

Source: Internet
Author: User

From ::

Http://www.g-loaded.eu/2008/01/28/how-to-extract-rpm-or-deb-packages/

Rpm and Deb packages are both containers for other files. An rpm is some sortCpioArchive. On the other hand, a deb file is a pure
ArArchive. so, it shoshould be possible to unpack their contents using standard archiving tools, regardless of your distribution's package format. under normal conditions, you should use your distribution's standard package manager,
RpmOrDpkgAnd their frontends, to manage those files. But, if you need to be more generic, here is how to do it.

Rpm

For RPMs you need two command line utilities,Rpm2cpioAnd
Cpio. Extracting the contents of the RPM package isOne stepProcess:

 
Rpm2cpio mypackage. RPM | cpio-vid

If you just need to list the contents of the package without extracting them, use the following:

 
Rpm2cpio mypackage. RPM | cpio-vt

The-VOption is used in order to get verbose output to the stdout. If you don't need it, you can safely omit this switch. For more information aboutCpioOptions,
Please refer toCpio (1)Manual page.


Deb

Deb files areAr Archives, Which contain three files:

    • Debian-binary
    • Control.tar.gz
    • Data.tar.gz

As you might have already guessed, the needed archived files exist inData.tar.gz. It is also obvious that unpacking this file is
Two-stepProcess.

First, extract the aforementioned three files from the Deb file (ArArchive ):

 
Ar VX mypackage. Deb

Then extract the contentsData.tar.gzUsing
Tar:

 
Tar-xzvf data.tar.gz

Or, if you just need to getListingOf the files:

Tar-tzvf data.tar.gz

Again-VOption in bothArAnd
TarIs used in order to get verbose output. It is safe not to use it. For more information, read the man pages:Tar (1)And
AR (1).

If anyone knowsOne Step ProcessTo extract the contents of
Data.tar.gz, I 'd be very interested in it!

Update

As Jon
Suggested in the comment area, the contents of data.tar.gz can be extracted from the Deb package in a one step process as shown below:

 
Ar P mypackage. Deb data.tar.gz | tar ZX

That will do it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.