SL6 and Zabbix 1.8.5

9 05 2011

Someone pointed out to me that my post on compiling Zabbix on CentOS no longer works. Well to be honest, I have switched my CentOS systems to Scientific Linux 6 for a plethora of reasons (Short Story: a lot of the scientific packages we use at work are now being tested on SL6 by the various development groups where they are left up to the community on CentOS. So we jumped to SL6).

Nevertheless, I didn’t want to have bad information posted on my blog so I decided to update.

If you try to use my old post for compiling on SL6 or CentOS you end up with an error message like reader mailo got:
make[2]: Nothing to be done for `install-exec-am’.
make[2]: Nothing to be done for `install-data-am’.
make[2]: Leaving directory `/usr/src/redhat/BUILD/zabbix-1.8.5′
make[1]: Leaving directory `/usr/src/redhat/BUILD/zabbix-1.8.5′
+ install misc/conf/zabbix_agent.conf misc/conf/zabbix_agentd misc/conf/zabbix_agentd.conf misc/conf/zabbix_agentd.win.conf misc/conf/zabbix_server.conf misc/conf/zabbix_proxy.conf /var/tmp/zabbix-1.8.5-root/etc/zabbix
install: omitting directory `misc/conf/zabbix_agentd’
error: Bad exit status from /var/tmp/rpm-tmp.54232 (%install)
RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.54232 (%install)

This is due to a new directory structure in misc/conf/zabbix_agentd. Lennart at Andrew Farley’s blog caught the fix.

Here are the steps to compile now.
1) Download the zabbix spec file into ~/rpmbuild/SPECS/

2) Edit the spec file
2a) Change line 6 from “Version: 1.8.3” to “Version: 1.8.5”
2b) Change line 382 from “install misc/conf/zabbix_{a*,s*,p*} $RPM_BUILD_ROOT%{_sysconfdir}” to “install misc/conf/zabbix_{a*,s*,p*}.conf* $RPM_BUILD_ROOT%{_sysconfdir}”

3) Download Zabbix 1.8.5 from zabbix.com into ~/rpmbuild/SOURCES/

4) Download the patch file into ~/rpmbuild/SOURCES/

5) Build your RPMS!

So all together on the command line:
$ cd ~/rpmbuild/SPECS/
$ wget http://repo.andrewfarley.com/centos/specs/zabbix.spec
$ sed -e 's/1.8.3/1.8.5/' -i zabbix.spec
$ sed -e 's/p\*\}\ /p\*\}.conf\*\ /' -i zabbix.spec
$ cd ~/rpmbuild/SOURCES/
$ wget http://repo.andrewfarley.com/centos/specs/zabbix-centos-log-and-pid-paths.patch
$ wget (find download link from here)
$ cd ~/rpmbuild/SPECS/
$ rpmbuild -bb --target=`uname -m` zabbix.spec

That should be it! So far this is working for me. If I come across any other issues I will fix them here.

Once again, major props to Andrew. And props to Lennart for the fix.

[EDIT] Eric G built RPMs for 1.8.5 and 1.9.3 below in the comments. If you just want to install the RPMs instead of building from source you should be able to use his repo. Thanks Eric G!