Building Zabbix 1.8.6 from source on Centos 5.5

Zabbix can be extremely useful for monitoring and trouble shooting. It is my weapon of choice for monitoring Linux and network devices. This brief tutorial covers the steps i went through in order to get the latest release of Zabbix installed on Centos 5.5 (i386). I have not mastered SE Linux yet so this tutorial assumes that SE Linux is disabled.

Log on as root

Prerequisites
yum install php php-gd install php-xml php-mysql php-bcmath php-mbstring make gcc curl curl-devel mysql-devel gnutls-devel net-snmp-devel

Start / restart Apache so the PHP modules are active

CMD
/etc/init.d/httpd restart

Start MySQL and run mysql_secure_installation

CMD
/etc/init.d/httpd start
mysql_secure_installation

Download the source

CMD
cd ~
wget  http://voxel.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/1.8.6/zabbix-1.8.6.tar.gz

Extract the files files

CMD
tar -xzf zabbix-1.8.6.tar.gz

Browse http://pkgs.repoforge.org/iksemel/ for the correct version of iksemel
I used

CMD
wget http://pkgs.repoforge.org/iksemel/iksemel-devel-1.4-1.el5.rf.i386.rpm
wget http://pkgs.repoforge.org/iksemel/iksemel-1.4-1.el5.rf.i386.rpm
rpm -ivh iksemel-1.4-1.el5.rf.i386.rpm iksemel-devel-1.4-1.el5.rf.i386.rpm

Create Zabbix user and group if it does not exist

CMD
/usr/sbin/groupadd zabbix
/usr/sbin/useradd -c 'Zabbix' -g zabbix -s /dev/null zabbix

Create zabbix mysql user.

CMD
mysql -u<username> -p<password>
MySQL SQL
CREATE USER `zabbix`@'%' IDENTIFIED BY 'zabbix';

Note: Security could be tightened by replacing % with localhost or the loopback address.

Setup database

MySQL SQL
CREATE DATABASE zabbix CHARACTER SET utf8;
GRANT ALL ON `zabbix`.* TO 'zabbix'@'%';
FLUSH PRIVILEGES;
quit;

Create the zabbix db

CMD
cd /root/zabbix-1.8.6/create/schema/
cat mysql.sql | mysql -u zabbix -pzabbix zabbix
 
cd ../data/
cat data.sql | mysql -u zabbix -pzabbix zabbix
cat images_mysql.sql | mysql -u zabbix -pzabbix zabbix

Change back to the root of the Zabbix download

CMD
cd ../../

Run configure and make install

CMD
./configure --enable-server --enable-agent --with-mysql --with-net-snmp --with-jabber --with-libcurl
 
make install

Add the agent services to the end of /etc/services

CMD
vi /etc/services

Add these lines to the end

zabbix-agent    10050/tcp  Zabbix Agent
zabbix-agent    10050/udp  Zabbix Agent
zabbix-trapper  10051/tcp  Zabbix Trapper
zabbix-trapper  10051/udp  Zabbix Trapper

Create Zabbix conf directory

CMD
mkdir /etc/zabbix

Copy agent and server config files

CMD
cp /root/zabbix-1.8.6/misc/conf/zabbix_agentd.conf /etc/zabbix/zabbix_agentd.conf
cp /root/zabbix-1.8.6/misc/conf/zabbix_server.conf /etc/zabbix/zabbix_server.conf

Modify Zabbix server configuration and set appropriate value for DBPassword and DBUser. zabbix_agentd.conf is fine.

CMD
cd /etc/zabbix/
vi zabbix_server.conf
</pre
 
Adjust these values like so
<pre>
DBUser=zabbix
DBPassword=zabbix

Create startup script

CMD
cp /root/zabbix-1.8.6/misc/init.d/redhat/8.0/zabbix_server /etc/init.d/
chmod +x /etc/init.d/zabbix_server
cp /root/zabbix-1.8.6/misc/init.d/redhat/8.0/zabbix_agentd /etc/init.d/
chmod +x /etc/init.d/zabbix_agentd

Edit progdir in /etc/init.d/zabbix_server and /etc/init.d/zabbix_agentd

CMD
vi /etc/init.d/zabbix_server
vi /etc/init.d/zabbix_agentd
progdir="/usr/local/sbin/"

Test start and stop commands.

CMD
/etc/init.d/zabbix_agentd start
/etc/init.d/zabbix_agentd stop
/etc/init.d/zabbix_server start
/etc/init.d/zabbix_server stop

Make sure you leave Zabbix in a started state.

CMD
/etc/init.d/zabbix_agentd start
/etc/init.d/zabbix_server start

Make zabbix server and agent start at reboot

CMD
chkconfig zabbix_agentd on
chkconfig zabbix_server on

Setup the web interface

CMD
mkdir /var/www/html/zabbix
cd /root/zabbix-1.8.6/frontends/php/
cp -a . /var/www/html/zabbix/
chown -R apache.apache /var/www/html/zabbix

Edit php.ini

CMD
vi /etc/php.ini

Set date.timezone to your time zone.

date.timezone = "America/New_York"

Some other php settings

post_max_size = 16M
max_execution_time = 300
max_input_time = 600

Restart Apache so the php modules are active and the config changes take effect

CMD
/etc/init.d/httpd restart

Browse to your webserver/zabbix/ and complete the install. The default logon is admin and password is zabbix.


http://<your_ip>/zabbix

Comments (1)

  1. 10:14, 2011/12/10Irene  / Reply

    Great article, thank you again for wriitng.

Leave a Reply

Allowed Tags - You may use these HTML tags and attributes in your comment.

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

Pingbacks (0)

› No pingbacks yet.