Install SRC.RPM on RHEL4 if no rpmbuild present

Last Friday I had a new challenge in my life as a system administrator. The challenge was to install Munin-node on Red Hat Enterprise Linux 4 Nahant 4. I thought it was easy, until I noticed that it were few x86_64 architecture servers with minimal install, so I had small troubles with SRC.RPMs.

As you may notice from Munin installation instructions there are some dependencies and those dependencies have some more dependencies… and so on… One of them that I had trouble with was sysstat. Dag’s repository that I used for Munin RPM doesn’t have sysstat RPM package at all and in RPM Find you will find only SRC.RPM package for x86_64 (actually sysstat-5.0.5-16.rhel4.src.rpm).

Of course, it would be easy to download and build that SRC.RPM package if rpmbuild would be installed on one of those servers, but it was minimal install and there was no rpmbuild utility. I couldn’t find any proper RHEL4 repository on-line. The only solution I’ve found on-line was to use CentOS 4 RPM. As far as I know from my contacts and RHEL conference – CentOS 4 is compatible with RHEL 4.

So I used the nearest CentOS 4 RPMS mirror (for example <ftp://ftp.pbone.net/mirror/ftp.centos.org/4.8/os/x86_64/CentOS/RPMS/>) and downloaded next RPMs rpm-4.3.3-32_nonptl.x86_64.rpm, rpm-build-4.3.3-32_nonptl.x86_64.rpm, rpm-libs-4.3.3-32_nonptl.x86_64.rpm, rpm-python-4.3.3-32_nonptl.x86_64.rpm (and any dependency they will require) and installed them:

  1. rpm -Uvh rpm-python-4.3.3-32_nonptl.x86_64.rpm rpm-4.3.3-32_nonptl.x86_64.rpm rpm-libs-4.3.3-32_nonptl.x86_64.rpm
  2. rpm -Uvh rpm-build-4.3.3-32_nonptl.x86_64.rpm

Now I can build required SRC.RPM packages.

In order to install SRC.RPM package I use command rpm -ivh, in my case: rpm -ivh sysstat-5.0.5-16.rhel4.src.rpm. Source package will be placed in /usr/src/redhat/SRPMS directory and spec file (that we need for rpmbuild) in /usr/src/redhat/SPECS
Now we need to run rpmbuild -ba with proper path spec file, in my case rpmbuild -ab /usr/src/redhat/SPECS/sysstat.spec.
If everything is OK, at the end you will find RPM package in /usr/src/redhat/RPMS.

Now you can install you package with command rpm -Uvh and I can install my sysstat RPM: rpm -Uvh /usr/src/redhat/RPMS/x86_64/sysstat-5.0.5-16.rhel4.x86_64.rpm

I was lucky – all servers that required Munin-node was x86_64 and created RPM package were compatible with all servers and I didn’t have to repeat all operation with SRC.RPM all over again. I just had to upload it to the server and run rpm -Uvh sysstat-5.0.5-16.rhel4.x86_64.rpm.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.