Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


LinkBack Search this Thread
Old 01-11-2010, 12:28 PM   #1
LQ Newbie
Registered: Jan 2010
Posts: 2

Rep: Reputation: 0
How can I convert an rpm to a tar.gz in CentOS 5.3?

I've tried using rpm2targz and rpm2tar, but neither are installed on CentOS. If those are the only tools (or the best tools) available, how can I install them in CentOS?
Old 01-11-2010, 12:59 PM   #2
Registered: Jun 2007
Posts: 152

Rep: Reputation: 37
use rpm2cpio to get the file into cpio format, extract the cpio to a dir (/tmp?) then tar that directory.
1 members found this post helpful.
Old 01-11-2010, 03:06 PM   #3
LQ Newbie
Registered: Jan 2010
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks, SethsdadtheLinuxer! That is exactly what I needed!
Old 01-11-2010, 03:28 PM   #4
LQ 5k Club
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2013.07, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 13,199

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
If you want the Slackware rpm2tgz + rpm2targz :
Package name = rpm2tgz
Just unpack it and use the the script 'rpm2targz'

Or use the command :
rpm2cpio <package.rpm> | cpio -idmv

There is also a script created by @ unSpawn : ''
I modified it to unpack to the current directory ..
# Purpose: Unpack RPM archives (unSpawn)
# Args: /path/to/archive
# Deps: Bash, GNU utils, RPM
rpmDetails() { for Q in changelog provides requires scripts triggers triggerscripts; do 
 rpm -q -p --${Q} "${f}" 2>&1 | grep -v NOKEY > "${Q}.log"; done; }
rpmUnpack() { f=$(readlink -f "${f}"); file "${f}"|grep -q "RPM.v" && \
 { d=$(basename "${f}" .rpm); d="./${d:=ERROR_$$}"; mkdir -p "${d}" && \
 { cd "${d}" && rpm2cpio "${f}" | cpio -idmv && rpmDetails "${f}"; }; }; }
for f in $@; do rpmUnpack "${f}"; done
exit 0
I keep the in /usr/local/bin/

Last edited by knudfl; 01-11-2010 at 03:32 PM.


centos, convert, rpm, tar, targz

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to build an RPM from tar.gz on CentOS 4.5? thatguyinss Linux - Software 3 01-12-2009 08:30 PM
how to install tar.gz or convert to rpm vzzt! Linux - Newbie 10 05-26-2004 07:57 AM
.rpms, .tar.gz, .tgz, .src.rpm, & .tar.bz2 whoots Mandriva 10 10-18-2003 12:08 PM
Diferance between rpm, tar, tar.gz, scr.tar, etc mobassir Linux - General 12 08-21-2003 06:30 AM
convert .tar to rpm ? qwijibow Linux - Newbie 1 07-25-2003 12:47 PM

All times are GMT -5. The time now is 01:48 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration