LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Red Hat (https://www.linuxquestions.org/questions/red-hat-31/)
-   -   How to create an rpm for an ordinary tar.gz file? (https://www.linuxquestions.org/questions/red-hat-31/how-to-create-an-rpm-for-an-ordinary-tar-gz-file-786630/)

ginda 02-03-2010 04:32 AM

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 :)

knudfl 02-03-2010 07:11 AM

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/
.....

ginda 02-03-2010 08:26 AM

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.

DrLove73 02-03-2010 12:17 PM

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.

ginda 02-04-2010 03:36 AM

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

knudfl 02-04-2010 04:15 AM

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>.
.....

ginda 02-04-2010 07:45 AM

Quote:

Originally Posted by knudfl (Post 3852045)
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

ginda 02-24-2010 03:49 AM

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

DrLove73 02-24-2010 05:29 AM

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


All times are GMT -5. The time now is 06:32 PM.