Creating RPM from tar.gz
I'm sure there's a way to do this, but I am not experienced with building RPMs.
I have a tarball which contains the files and installation script for an agent that we want to install on a subset of systems. I've been asked to create an RPM in order to expedite the installation of this agent.
Basically, the manual process is to explode the tarball and then run the installation script and then the tarball and directory created from exploding the tarball are to be removed.
Is there a way to take this process and create an RPM that handles these steps automatically?
Responses
Hello Dan,
The best way to create rpm from a source available in tar.gz is by writing a spec file and creating it using rpmbuild utility Red Hat ships. If you look from GSS perspective, there is very limited scope for rpmbuilding, but in upstream Fedora, very good documentation is available.
http://fedoraproject.org/wiki/How_to_create_an_RPM_package
This can give you few guidelines on how to create rpm package using source by writing a spec file.
Hey Dan,
Even though the link Red Hat gave is very thorough, you might find it also easy to have a simple example on how to create an rpm, which I personally use this link for:
http://www.rpm.org/max-rpm/ch-rpm-build.html
To be honest, building an RPM isn't considerably harder than building from source. It's more that it's picayune. RPM-building really only becomes "difficult" when you want to include %pre and/or %post scripts that customize the installation, want to pass non-default build arguments to the tarball's configure script or have a program that requires links to lib-locations not in the standard system search path.
While different from the SysV package utilities, it's really not any harder.
As to being "worth it", it depends on what factors into your equation:
* Is system auditability of value to you
* Is version control of value to you
* Is repeatability of installation of value to you
* Is completeness of software removal of value to you
If you answer "yes" to any of those, then sucking it up and building an RPM is definitely a worthwhile endeavor. And, once you've been through the effort to learn pick up the skill, you frequently find that you want to package other stuff that way (and find it annoying when a vendor delivers dumb tarballs).
If you're on RHEL 6 (or derivatives), just typing vi <FILENAME>.spec creates the basic SPEC template for you - which is a fine improvement of releases prior to RHEL 6.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
