LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 02-03-2010, 04:32 AM   #1
ginda
Member
 
Registered: Mar 2004
Distribution: SUSE8.2, 9.2, Knoppix
Posts: 323

Rep: Reputation: 31
How to create an rpm for an ordinary tar.gz file?


Hello everyone

I have some compressed (tar.gz) files that i need to get users to install on their servers but it becomes a pain some times to explain the command and where to uncompress it to.

Is there a way to create an rpm of the files inside the tar.gz so that by just running rpm -ivh "file.rpm" it extracts them to the correct target destination.

For example: rpm -ivh "www.rpm" will exact files inside rpm into /var/www

Thanks in advance

Last edited by ginda; 02-03-2010 at 05:25 AM.
 
Old 02-03-2010, 07:11 AM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2021 CentOS7.9 + 50+ other Linux OS, for test only.
Posts: 17,430

Rep: Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623
su

alien -r file.tar.gz

.. will work on most rpm based Linux :
.. when the file.tar.gz contains a directory tree
like /var/www/files..

If you have no package 'alien' in your repo :
http://kitenet.net/~joey/code/alien/
.....

Last edited by knudfl; 02-03-2010 at 07:13 AM.
 
Old 02-03-2010, 08:26 AM   #3
ginda
Member
 
Registered: Mar 2004
Distribution: SUSE8.2, 9.2, Knoppix
Posts: 323

Original Poster
Rep: Reputation: 31
Thank you very much for your reply, no we dont have alien installed and would not be abled to install it over quite a number of different servers.

Is is no way i can build an rpm just to extract files to a certain location? Especially as i may need to supply this rpm to red hat satalite servers so they can be used as a respositary based install.
 
Old 02-03-2010, 12:17 PM   #4
DrLove73
Senior Member
 
Registered: Sep 2009
Location: Srbobran, Serbia
Distribution: CentOS 5.5 i386 & x86_64
Posts: 1,118
Blog Entries: 1

Rep: Reputation: 129Reputation: 129
You need alien package only do compile the tar.gz's, once rpm's are created you do not need it.

To create rpms with rpmbuild, you need to create simple spec file first and use it to compile rpm. Check this tutorial and Maximum RPM tutorial.
You can also check checkinstall utility.

Last edited by DrLove73; 02-03-2010 at 12:21 PM.
 
Old 02-04-2010, 03:36 AM   #5
ginda
Member
 
Registered: Mar 2004
Distribution: SUSE8.2, 9.2, Knoppix
Posts: 323

Original Poster
Rep: Reputation: 31
Thank you so much for you reply, i am little closer to my goal thanks to you, i ran the command

alien --to-rpm "file.tar.gz"

which created an rpm which can be installed using rpm -ivh "file.rpm", but i dont know where it is installing it to?

how can i tell alien "when creating the rpm" where i would like the rpm to get installed?

for example i may want the files inside the rpm to be extracted to /usr/lib/"filename" or even /var/www/website

Thanks again for your help, really appriciated
 
Old 02-04-2010, 04:15 AM   #6
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2021 CentOS7.9 + 50+ other Linux OS, for test only.
Posts: 17,430

Rep: Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623Reputation: 3623
Please read post # 2 again.

Make up a directory tree : var/www/<file>
where <file> is the stuff, you want into /var/www/

and next : tar -cf new-package.tar var/
.. and do not write /var !

And : gzip new-package.tar
.. getting new-package.tar.gz

1) su
2) alien -r new-package.tar.gz
creates the same, but with suffix .rpm
> > Easy to install anywhere with # rpm -Uvh <package>.
.....
 
Old 02-04-2010, 07:45 AM   #7
ginda
Member
 
Registered: Mar 2004
Distribution: SUSE8.2, 9.2, Knoppix
Posts: 323

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by knudfl View Post
Please read post # 2 again.

Make up a directory tree : var/www/<file>
where <file> is the stuff, you want into /var/www/

and next : tar -cf new-package.tar var/
.. and do not write /var !

And : gzip new-package.tar
.. getting new-package.tar.gz

1) su
2) alien -r new-package.tar.gz
creates the same, but with suffix .rpm
> > Easy to install anywhere with # rpm -Uvh <package>.
.....
Thank you, this solution worked fine

Thanks to all you guys
 
Old 02-24-2010, 03:49 AM   #8
ginda
Member
 
Registered: Mar 2004
Distribution: SUSE8.2, 9.2, Knoppix
Posts: 323

Original Poster
Rep: Reputation: 31
Hi all

I now need to run a simple bash script but would like to deploy and execute it using an rpm, is this also possible?

Thanks in advance
 
Old 02-24-2010, 05:29 AM   #9
DrLove73
Senior Member
 
Registered: Sep 2009
Location: Srbobran, Serbia
Distribution: CentOS 5.5 i386 & x86_64
Posts: 1,118
Blog Entries: 1

Rep: Reputation: 129Reputation: 129
You can pack it inside rpm, and then use %post (or was it %postinstall ?) to run it immediately after rpm is installed. Check http://www.rpm.org/max-rpm/index.html for details
 
  


Reply


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Create file using tar and ls commands Ejdaha Linux - Newbie 2 02-16-2009 08:55 AM
how to uninstall a software installed with tar.gz file..or .rpm file av.dubey Linux - Newbie 3 06-21-2008 01:27 PM
create an RPM install file from tar? Siljrath Linux - Newbie 8 01-07-2005 01:33 PM
how to create a tar.gz file? fuelinjection Linux - General 2 07-09-2004 05:22 AM
where to find a tar-file in a rpm sneezesnoeze Linux - Newbie 1 04-06-2004 11:18 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

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

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