Zabbix: How to Install Zabbix on Linux
Zabbix is Open Source cross platform Monitoring Tool, which provide fairly good features for various platforms.platforms. Zabbix is absolutely free product and release under the GPL license, thus it is free for any commercial and non-commercial use. There is no limitation, can monitor as many devices as possible. Code is freely available and can be customized for any integration and can change as per requirement.
Installation of Zabbix contain few major steps.
1. Installation and configuration of MySQL for Zabbix Database.
2. Download and Configuration of zabbix.
3. Installation and configuration of PHP.
4. Installation and configuration Apache for Zabbix hosting.
Installation and configuration of MySQL
Installation through YUM command on Linux system
#yum install mysql-server mysql -y
Further we have start MySQL service and should set root password for security purpose.
#service mysqld start #chkconfig mysqld on ]# chkconfig --list mysqld mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off # mysql -V mysql Ver 14.14 Distrib 5.1.73, for redhat-linux-gnu (x86_64) using readline 5.1
MySQL can connect without password as root user, So it is good to set root password through below command.
# mysqladmin -u root -p 'new-password' Then you need to connect MySQL with password like below. # mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 5 Server version: 5.1.73 Source distribution Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
Now MySQL is installed and running on system, we have configure MySQL as per Zabbix requirement. we have to create one database for Zabbix and provide permission as per require for Zabbix.
[root@srv3 ~]# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4 Server version: 5.1.71 Source distribution Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | test | +--------------------+ 3 rows in set (0.00 sec) mysql> CREATE DATABASE zabbix CHARACTER SET UTF8; Query OK, 1 row affected (0.00 sec) mysql> GRANT ALL PRIVILEGES on zabbix.* to 'zabbix'@'localhost' IDENTIFIED BY 'Passw0rd'; Query OK, 0 rows affected (0.00 sec) mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec) mysql> Bye
Now we have to create MySQL schema for Zabbix inside MySQL database. Below commands for same. For this Zabbix tar contain SQL file that need to import in zabbix database inside MySQL.
[root@srv3 mysql]# mysql -u zabbix zabbix -p < schema.sql Enter password: [root@srv3 mysql]# mysql -u zabbix zabbix -p < images.sql Enter password: [root@srv3 mysql]# mysql -u zabbix zabbix -p < data.sql Enter password:
It will ask for same password that you have entered for MySQL Zabbix user as above we used Passw0rd
Now your MySQL is ready to connect with Zabbix server.
Download , installation and configuration of Zabbix
Download Zabbix bundle from Download here
Extact it with below command.
#tar -xzf zabbix-2.4.7.tar.gz
#ls
zabbix-2.4.7 zabbix-2.4.7.tar.gz
#cd zabbix-2.4.7
# ls
aclocal.m4 bin ChangeLog conf config.sub configure.ac database frontends INSTALL m4 Makefile.in misc NEWS src
AUTHORS build compile config.guess configure COPYING depcomp include install-sh Makefile.am man missing README upgrades
Compilation of Zabbix Code
Before working on Zabbix , we have to Compile and install Zabbix binaries in proper place. For compilation we need to run configure command with some of its opions as described below command. Options used below could be as per your requirement with monitoring system. With each option you have to support them with there libraries which used during compilation for this you have to install those packages whihc provides these libraries in system.
[root@srv3 zabbix-2.4.7]# ./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-ldap --with-openipmi --with-libxml2 --with-ssh2 --with-unixodbc
Above command need to be ru from Zabbix untar directory as above. If everything run perfectly then you should be able to see below screen.
Configuration: Detected OS: linux-gnu Install path: /usr/local Compilation arch: linux Compiler: gcc Compiler flags: -g -O2 -I/usr/include/mysql -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv -fPIC -DUNIV_LINUX -DUNIV_LINUX -I/usr/include/libxml2 -I/usr/include -I/usr/include/rpm -I/usr/local/include -I/usr/lib64/perl5/CORE -I. -I/usr/include -I/usr/include -I/usr/include -I/usr/include Enable server: yes Server details: With database: MySQL WEB Monitoring: cURL Native Jabber: no SNMP: yes IPMI: yes SSH: yes ODBC: yes Linker flags: -rdynamic -L/usr/lib64/mysql -L/usr/lib64 -L/usr/lib64 -L/usr/lib -L/usr/lib -L/usr/lib Libraries: -lm -ldl -lrt -lresolv -lmysqlclient -lxml2 -lodbc -lnetsnmp -lssh2 -lOpenIPMI -lOpenIPMIposix -lldap -llber -lcurl Enable proxy: no Enable agent: yes Agent details: Linker flags: -rdynamic -L/usr/lib Libraries: -lm -ldl -lrt -lresolv -lldap -llber -lcurl Enable Java gateway: no LDAP support: yes IPv6 support: yes *********************************************************** * Now run 'make install' * * * * Thank you for using Zabbix! * * <http://www.zabbix.com> * ***********************************************************
In above output, we can able to see compiler Compiler flags, Libraries, Linker flags etc which were used in during compilation. Now we have to run “make install”.
#make install .... OutPut truncate .... make[2]: Entering directory `/root/zabbix-2.4.7' make[2]: Nothing to be done for `install-exec-am'. make[2]: Nothing to be done for `install-data-am'. make[2]: Leaving directory `/root/zabbix-2.4.7' make[1]: Leaving directory `/root/zabbix-2.4.7'
After “make install”. you would see some binary and configuration files present in system which are responsible for Zabbix process.
[root@srv3 zabbix-2.4.7]# ls -l /usr/local/sbin/zabbix_* -rwxr-xr-x. 1 root root 860486 Jan 28 18:31 /usr/local/sbin/zabbix_agent -rwxr-xr-x. 1 root root 1019331 Jan 28 18:31 /usr/local/sbin/zabbix_agentd -rwxr-xr-x. 1 root root 3623098 Jan 28 18:31 /usr/local/sbin/zabbix_server [root@srv3 etc]# pwd /usr/local/etc [root@srv3 etc]# ls -lh total 40K -rw-r--r--. 1 root root 2.5K Jan 28 18:31 zabbix_agent.conf drwxr-xr-x. 2 root root 4.0K Jan 28 18:31 zabbix_agent.conf.d -rw-r--r--. 1 root root 7.7K Jan 28 18:31 zabbix_agentd.conf drwxr-xr-x. 2 root root 4.0K Jan 28 18:31 zabbix_agentd.conf.d -rw-r--r--. 1 root root 13K Jan 28 18:31 zabbix_server.conf drwxr-xr-x. 2 root root 4.0K Jan 28 18:31 zabbix_server.conf.d
Installation and configuration of PHP.
Installation of PHP on Linux system through YUM.
#yum install php -y check PHP with below command. # php -v PHP 5.3.3 (cli) (built: Jul 9 2015 17:39:00) Copyright (c) 1997-2010 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
Add few lines in /etc/php.ini for Zabbix hosting server (Zabbix fronted is made up of PHP). Please check file should not contain some other entries with some other values before where you entered.
php_value max_execution_time=300 php_value memory_limit=128M php_value post_max_size=16M php_value upload_max_filesize=2M php_value max_input_time=300
Installation and configuration Apache for Zabbix hosting.
For zabbix hosting we need to use some kind of Hosting Server like Apache in Linux. Installation of Apache in Linux through YUM.
#yum install http* -y Start apache service with below command #service httpd start # chkconfig httpd on # chkconfig --list httpd httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off Can confirm with with httpd -V # httpd -V Server version: Apache/2.2.15 (Unix) Server built: Dec 15 2015 15:50:14 Server's Module Magic Number: 20051115:25 Server loaded: APR 1.3.9, APR-Util 1.3.9 Compiled using: APR 1.3.9, APR-Util 1.3.9 Architecture: 64-bit Server MPM: Prefork threaded: no forked: yes (variable process count)
For Zabbix fronted we need to copy Zabbix fronted files which are located in zabbix tar ball to Apache DocumentRoot, As mention below.
# cp -rf zabbix-2.4.7/frontends/php/* /var/www/html/ # chown -R apache:apache /var/www/html/
Open browser and put try to access same machine by through IP address, Hostname. As below images.
This is Just a welcome Screen of Zabbix installation
Below Screen would show you all pre-requites of Zabbix installation
This Screen ask for MySQL database connection
This screen ask for Zabbix server Hostname and port to which we connect for show statics
This screen would show Summary for various inputs provided earlier
All these configuration saved in one PHP file located in DocumentRoot/conf/zabbix.conf.php in my case it is “/var/www/html/conf/zabbix.conf.php”
Click on Finish and Zabbix Dashboard screen appear.
Leave a Reply