How To Extract Rpm Or Deb Packages _ G-loaded Journal

RPM, DEB
View more...
   EMBED

Share

Preview only show first 6 pages with water mark for full document please download

Transcript

How to extract RPM or DEB packages | G-Loaded Journal G-Loaded Journal       About Howto Archives License  Viceo Backend for SANE with libusb support Advertise Contact Size text with em in your CSS – Explained with example  How to extract RPM or DEB packages  January 28, 2008  George Notaras System  25 Comments RPM and DEB packages are both containers for other files. An RPM is some sort of cpio archive. On the other hand, a DEB file is a pure ar archive. So, it should 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, rpm or dpkg and their frontends, to manage those files. But, if you need to be more generic, here is how to do it. RPM http://www.g-loaded.eu/2008/01/28/how-to-extract-rpm-or-deb-packages/[3/7/2014 9:57:58 μμ] How to extract RPM or DEB packages | G-Loaded Journal For RPMs you need two command line utilities, Bluehost ® $3.95 Special rpm2cpio and cpio. Extracting the contents of the RPM package is a one step process: Professional Web Hosting Special Coupon Offer $3.95/mo 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 -v option 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 about the options, please refer to the cpio(1) cpio manual page. DEB DEB files are ar archives, which contain three files: debian-binary control.tar.gz data.tar.gz As you might have already guessed, the needed archived files exist in data.tar.gz . It is also obvious that unpacking this file is a two-step process. First, extract the aforementioned three files from the DEB file (ar archive): ar vx mypackage.deb Then extract the contents of data.tar.gz using tar: tar -xzvf data.tar.gz Or, if you just need to get a listing of the files: tar -tzvf data.tar.gz Again the -v option in both ar and tar is 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 knows a one step process to extract the contents of the http://www.g-loaded.eu/2008/01/28/how-to-extract-rpm-or-deb-packages/[3/7/2014 9:57:58 μμ] data.tar.gz , I’d be very interested How to extract RPM or DEB packages | G-Loaded Journal 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. How to extract RPM or DEB packages by George Notaras, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. Copyright © 2008 - Some Rights Reserved  Backup DEB HOWTO Packaging RPM Shell About George Notaras George Notaras is the editor of G-Loaded Journal, a technical blog about Free and OpenSource Software. George is a GNU/Linux enthusiast, a self-taught programmer and system administrator. He strongly believes that "knowledge is power" and has created this web site to share the IT knowledge and experience he has gained over the years with other people. George primarily uses CentOS and Fedora and spends some of his spare time developing open-source software. Follow George on Twitter: @gnotaras http://www.g-loaded.eu/2008/01/28/how-to-extract-rpm-or-deb-packages/[3/7/2014 9:57:58 μμ] How to extract RPM or DEB packages | G-Loaded Journal   View all posts by George Notaras → Related Articles Restore original configuration files from RPM packages VeriTAR – Verify checksums of files within a TAR archive Choosing a format for data backups – tar vs cpio How To Build RPM Packages on Fedora Verify a burned CD/DVD image on Linux 25 responses on “How to extract RPM or DEB packages” knud May 2, 2008 at 11:46 Permalink → Please also try these: ‘rpm -qpvl package.rpm’ ‘rpm -qpvl package.rpm > textfile’ ‘less package.rpm’ ‘lesspipe… > textfile’ ‘less package.deb’ ‘lesspipe… package.deb > textfile’ And of course The Midtnight Commander ‘mc’ will open both rpm and deb. Rgds Reply ↓ Jon February 1, 2009 at 19:53 Permalink → One-liner to extract data.tar.gz: http://www.g-loaded.eu/2008/01/28/how-to-extract-rpm-or-deb-packages/[3/7/2014 9:57:58 μμ] How to extract RPM or DEB packages | G-Loaded Journal ar p package.deb data.tar.gz|tar zx Reply ↓ George Notaras Post author February 3, 2009 at 15:19 Permalink → Jon: Excellent. Thanks for your feedback. I will update the post. Reply ↓ Kilgore Trout March 22, 2009 at 14:36 Permalink → Is there a GUI program to do all this that will take any package and convert it to what you want? Reply ↓ George Notaras Post author March 24, 2009 at 02:47 Permalink → None that I know of. There is a command line tool though, called alien, which can convert packages between the RPM and DEB formats. Its use is very straightforward. I highly recommend you give it a shot. Reply ↓ Johny Desmons July 27, 2009 at 17:53 Permalink → You can also extract deb files on Windows and Mac for free with AnyToISO program Reply ↓ http://www.g-loaded.eu/2008/01/28/how-to-extract-rpm-or-deb-packages/[3/7/2014 9:57:58 μμ] How to extract RPM or DEB packages | G-Loaded Journal Steven Li August 18, 2009 at 07:06 Permalink → to extract RPM, I recommend p7z Reply ↓ Benjamin May 9, 2010 at 16:52 Permalink → The easiest way to extract a Debian package is with dpkg-deb. To extract the content run “dpkg-deb –extract mypackage.deb foobar”. If you want to modify the package: dpkg-deb –extract mypackage.deb foobar dpkg-deb -e mypackage.deb foobar/DEBIAN modify files in foobar directory dpkg-deb -b foobar Reply ↓ George Notaras Post author May 9, 2010 at 18:07 Permalink → Hi Benjamin, Having used RPM-based distributions, I was not aware that it was so easy to modify the contents of a DEB package and then repackage the modified files. Thanks for the tip! As for the method of extracting the contents of RPM or DEB I describe in that post, it is meant to be a generic method without requiring any distribution specific tools, but generic archive managers. I had decided to write it because I once needed to extract a DEB package under CentOS; I cannot recall why. Thanks for stopping by. http://www.g-loaded.eu/2008/01/28/how-to-extract-rpm-or-deb-packages/[3/7/2014 9:57:58 μμ] How to extract RPM or DEB packages | G-Loaded Journal Reply ↓ asfd August 18, 2010 at 08:15 Permalink → ar is rare to fine already installed. Please revise this to use dpkg-deb or at least show it as an option. dpkg-deb -x Reply ↓ George Notaras Post author August 18, 2010 at 12:18 Permalink → This article describes how to extract a DEB or RPM package using generic archive decompressors. The fact that utilities like rpm or dpkg are not used is intentional. Thanks Reply ↓ Jonathan August 23, 2010 at 19:11 Permalink → “An one-step process” should be “a one step process.” This is because a/an is decided based on the pronunciation of the following word, not on the spelling. See: http://www.englishtest.net/forum/ftopic31401.html Thanks for the article :-). Reply ↓ George Notaras Post author August 23, 2010 at 22:22 Permalink → http://www.g-loaded.eu/2008/01/28/how-to-extract-rpm-or-deb-packages/[3/7/2014 9:57:58 μμ] How to extract RPM or DEB packages | G-Loaded Journal Hi Jonathan. Thanks for pointing it out! The same mistake probably exists in several posts throughout the web site. It has been corrected in the current post. Thanks :-) Reply ↓ toto September 19, 2011 at 10:22 Permalink → good tutorial and very clear description and how to solve my problem. Thank for your tutorial. My problem about how to extract rpm file is solve :) Reply ↓ Eruva September 26, 2011 at 10:11 Permalink → It’s good to mention that ar is in binutils package. Reply ↓ George Notaras Post author September 28, 2011 at 02:54 Permalink → Hi and thanks for your feedback. The binutils package is installed by default even in minimal installations on RHEL, Fedora, CentOS and Scientific Linux, so it was kind of impossible for this package to be missing. Also the following command reveals the containing RPM package: yum provides /usr/bin/ar Reply ↓ srm http://www.g-loaded.eu/2008/01/28/how-to-extract-rpm-or-deb-packages/[3/7/2014 9:57:58 μμ] How to extract RPM or DEB packages | G-Loaded Journal November 15, 2011 at 14:58 Permalink → What is the use of : debian-binary control.tar.gz in a .deb package. Dont we need to extract files in them too ? Reply ↓ koofoos January 16, 2012 at 13:10 Permalink → Any way to convert .deb packages to .rpm and vice versa, without losing the post-install scripts? Reply ↓ vamsi March 5, 2012 at 12:59 Permalink → @Benjamin, awesome!! That’s exactly what I was looking for. So I wanted to make few changes to the priority level in control file and your process is what I wanted. Thanks @George Notaras for posting good stuff. Reply ↓ gracias March 20, 2012 at 00:18 Permalink → Thanks, worked for me! http://www.g-loaded.eu/2008/01/28/how-to-extract-rpm-or-deb-packages/[3/7/2014 9:57:58 μμ] How to extract RPM or DEB packages | G-Loaded Journal Reply ↓ Mark March 27, 2012 at 00:27 Permalink → just came in very handy, my dpkg and tar binaries were incompatible (dpkg calling tar with an unknown option), so I couldn’t use the famed dpkg-deb, I guess this is a good reason to have another way to unpack these things. Got the tar.deb and unpacked it to get the newer tar binary, so my dpkg would work again. Reply ↓ chauhan June 23, 2013 at 05:44 Permalink → really helpful in extraction. Reply ↓ chauhan June 23, 2013 at 05:45 Permalink → but after axtraction not getting excess… Reply ↓ Hanspeter December 28, 2013 at 02:05 Permalink → On OS X (and presumably *BSD), bsdtar can handle ar archives natively. Reply ↓ http://www.g-loaded.eu/2008/01/28/how-to-extract-rpm-or-deb-packages/[3/7/2014 9:57:58 μμ] How to extract RPM or DEB packages | G-Loaded Journal Richard March 22, 2014 at 19:14 Permalink → You da man, man! Reply ↓ Leave a Reply Your email address will not be published. Required fields are marked * Name * Email * Website Comment * I have read and accept this web site's Privacy Statement and Terms of Use. (required) You may use these HTML tags and attributes:
http://www.g-loaded.eu/2008/01/28/how-to-extract-rpm-or-deb-packages/[3/7/2014 9:57:58 μμ] How to extract RPM or DEB packages | G-Loaded Journal Post Comment Search Search for: Search Topics Announcements Blogging Programming Security Desktop Servers Editorial Services Hardware Licenses Software System Linux Virtualization Operating Systems Web Applications Recent Posts Back to blogging Some thoughts about Copyright related activism Why ReactOS leads the way with their decision to hire full-time developers gzip and deflate compression support by web browsers Mobile version of G-Loaded Lessons learned from a recent OS upgrade Limit the number of stored revisions per post in WordPress Restore original configuration files from RPM packages The 1st Rule of Discussion Speed up Apache by including htaccess files into httpd.conf About G-Loaded Journal is a technical blog that publishes news, guides and tutorials about GNU/Linux and http://www.g-loaded.eu/2008/01/28/how-to-extract-rpm-or-deb-packages/[3/7/2014 9:57:58 μμ] How to extract RPM or DEB packages | G-Loaded Journal other Free Open-Source Software. Our mission is to share our experience and knowledge about system administration, automation and programming. About Contact The Team License Technology Privacy Policy Advertise Terms of Service Copyright © 2005-2013 G-Loaded Journal – All Rights Reserved http://www.g-loaded.eu/2008/01/28/how-to-extract-rpm-or-deb-packages/[3/7/2014 9:57:58 μμ]