How to build rpm package correctly?

0

I'm trying to install the new version from ganglia, which provides a tar.gz. My procedure was uncompress the tar.gz file, enter in the folder and then makes rpmbuild -ba ganglia.spec, a warning message is given saying about the dependencies libraries missing, then I install them via yum, then gives the rpmbuild again, which generates some .rpm files at /usr/src/RPM/ I did this in a centOS 5 and centOS 6. Then install it in some servers.

I wonder if what I'm doing is correct ? (I read some tutorials over the internet only) A friend of mine said that this is wrong, that this .rpm that I generate is like compile and will work only for servers with exactly hardware only, is that right ?

What is the correct way to build an .rpm package from .tar.gz file ?

Valter Silva

Posted 2013-07-03T12:53:51.703

Reputation: 1 331

Answers

5

That's the correct way. It's the responsibility of the persons releasing the .tar.gz to have the proper rpm spec file, if it's meant to be built as an rpm. And that's how you build the rpm from the spec file.

The rpm files you generate that way can be installed on all matching servers, provided you have not deliberately done things that prevent them from working (like installing weird versions of the "dependencies", but if you have installed packages only from the centos base repositories, the packages will be good). But "matching" here means both centos/rhel version AND architecture. Architecture usually means just 32-bit or 64-bit x86, but there are also arm, powerpc and other architectures. For example, the Fedora project supports these architectures: https://fedoraproject.org/wiki/Architectures .

Anyway some rpms (architecture specific) can be installed on a certain architecture because they contain compiled code. Other rpms can be "noarch", which means the generated rpm can be installed on any architecture. This kind of rpms don't have compiled binaries in them, only data or interpreted language programs (shell, perl, python etc).

Viljo Viitanen

Posted 2013-07-03T12:53:51.703

Reputation: 193