Compiling Zabbix SVN for CentOS 5.0
Zabbix is a complex monitoring tool that allows an administrator to easily view the state of the network. Easily view, that is, once it is set up completely.
At the time of this writing Zabbix has no RPMs to download for CentOS. I made mine with two scripts. It could have been one script if I wanted. getsvn and make_zabbix are the two scripts. Place both in the same empty directory and run getsvn. Update your release number so rpm -Uvh works. You can get some of the files needed by make_zabbix from a src.rpm on a similar platform. Fedora has a 1.4 src at a mirror. Use midnight commander open the src.rpm, navigate to CONTENTS.cpio and extract zabbix.spec, zabbix-agent.init, zabbix-logrotate.in, zabbix-server.init, and zabbix-web.conf.
Now copy zabbix.spec to zabbixsrcrpm.spec and edit zabbix.spec. Before the make line add these lines:
make dist
# copy tar.gz file for src.rpm
cp %{name}-%{version}.tar.gz ../../SOURCES
# move in src.rpm .spec
mv ../../SPECS/%{name}srcrpm.spec ../../SPECS/%{name}.spec
cd ..
tar xvfz %{name}-%{version}/%{name}-%{version}.tar.gz
cd %{name}-%{version}
What this does is create a few more missing files like include/dbsync.h and creates a tar.gz file. This tar.gz file is what will be used for the src.rpm. It is also extracted in the same build directory and the spec file for the src.rpm is moved in place at this point too. When your src.rpm is completed you can also run rpmbuild –rebuild zabbix*src.rpm and it should compile correctly.
File: getsvn
#!/bin/tcsh -f
set NAME=zabbix
set VER=1.4.1
set TARGZ=$NAME-$VER.tar.gz
set old_dir = `pwd`
# increment rpm numbers so rpm -Uvh works
nano zabbix.spec
nano zabbixsrcrpm.spec
svn co svn://svn.zabbix.com/branches/$VER
mv $VER “$NAME-$VER”
cd “$NAME-$VER”
aclocal -I m4
autoconf
autoheader
automake -a
automake
cd old_dir
tar cvfz “$TARGZ” “$NAME-$VER”
rm -rf “$NAME-$VER”
./make_zabbix
File: make_zabbix
#!/bin/tcsh -f
set TARGZ=zabbix-1.4.1.tar.gz
set RSPEC=zabbix.spec
set RSPEC2=zabbixsrcrpm.spec
set F1=zabbix-agent.init
set F2=zabbix-logrotate.in
set F3=zabbix-server.init
set F4=zabbix-web.conf
cp “$TARGZ” /usr/src/redhat/SOURCES
cp “$F1″ /usr/src/redhat/SOURCES
cp “$F2″ /usr/src/redhat/SOURCES
cp “$F3″ /usr/src/redhat/SOURCES
cp “$F4″ /usr/src/redhat/SOURCES
cp “$RSPEC” /usr/src/redhat/SPECS
cp “$RSPEC2″ /usr/src/redhat/SPECS
set old_dir = `pwd`
cd /usr/src/redhat/SPECS
rpmbuild -ba –clean –rmsource `basename $RSPEC`
mv /usr/src/redhat/RPMS/i386/zabb* /usr/src/redhat/SRPMS/zabb* $old_dir
rm /usr/src/redhat/SPECS/`basename $RSPEC`