In this tutorial, we will show you how to install Zabbix on CentOS 6. For those of you who didn’t know, Zabbix is an open-source monitoring tool that is ideal for monitoring your cloud servers. Zabbix is very flexible, information can be retrieved using HTTP/SNMP or by installing a Zabbix agent on the machines to monitor, and allows a lot of customization.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple. I will show you the step-by-step installation of Zabbix on CentOS 6.
Prerequisites
- A server running one of the following operating systems: CentOS 6.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install Zabbix on CentOS 6
Step 1. First of all, make sure that all packages are up to date.
yum -y update
Step 2. Install LAMP server and include some PHP extensions.
yum install httpd httpd-devel yum install mysql mysql-server yum install php php-cli php-common php-devel php-pear php-gd php-mbstring php-mysql php-xml
Start service Apache web server and MySQL also enable it to start on boot of the server:
service httpd start service mysql start chkconfig httpd on chkconfig mysqld on
Step 3. Install Zabbix.
Add the Zabbix repository and install the packages:
rpm -ivh http://repo.zabbix.com/zabbix/2.4/rhel/6/i386/zabbix-release-2.4-1.el6.noarch.rpm
Use the following command to install Zabbix using MySQL database support packages on your system:
yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-java-gateway
Step 4. Configure MySQL Database for Zabbix.
By default, MySQL is not hardened. You can secure MySQL using the mysql_secure_installation
script. you should read and below each step carefully which will set a root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MySQL.
mysql_secure_installation
Next, we will need to log in to the MySQL console and create a database for Zabbix. Run the following command:
mysql -u root -p
This will prompt you for a password, so enter your MySQL root password and hit Enter. Once you are logged in to your database server you need to create a database for the Zabbix software:
mysql> CREATE DATABASE zabbix CHARACTER SET UTF8; mysql> GRANT ALL PRIVILEGES on zabbix.* to 'zabbix'@'localhost' IDENTIFIED BY 'SECRET_PASSWORD'; mysql> FLUSH PRIVILEGES; mysql> quit
Import Zabbix templates to the Zabbix database:
mysql -u zabbix -p zabbix < /usr/share/doc/zabbix-server-mysql-2.2.8/create/schema.sql mysql -u zabbix -p zabbix < /usr/share/doc/zabbix-server-mysql-2.2.8/create/images.sql mysql -u zabbix -p zabbix < /usr/share/doc/zabbix-server-mysql-2.2.8/create/data.sql
Step 5. Configure Apache webserver.
Created a file for Apache in /etc/httpd/conf.d/zabbix.conf
:
nano /etc/httpd/conf.d/zabbix.conf
Edit this file to look similar to this:
Alias /zabbix /usr/share/zabbix <Directory "/usr/share/zabbix"> Options FollowSymLinks AllowOverride None Require all granted </Directory> <Directory "/usr/share/zabbix/conf"> Require all denied </Directory> <Directory "/usr/share/zabbix/include"> Require all denied </Directory>
Edit timezone in /etc/httpd/conf.d/zabbix
to read this, or your own time zone:
php_value date.timezone Europe/London
We should adjust php.ini
file as per Zabbix recommended settings:
### nano /etc/php.ini max_execution_time = 600 max_input_time = 600 memory_limit = 256M post_max_size = 32M upload_max_filesize = 16M date.timezone = Europe/London
Restart the Apache and Zabbix service for the changes to take effect:
service zabbix-server start service zabbix-agent start service httpd restart service mysqld restart chkconfig zabbix-server on chkconfig zabbix-agent on
Step 6. Accessing Zabbix.
Zabbix will be available on HTTP port 80 by default. Open your favorite browser and navigate to http://yourdomain.com/zabbix
or http://server-ip/zabbix
and complete the required steps to finish the installation. If you are using a firewall, please open port 80 to enable access to the control panel.
Congratulations! You have successfully installed Zabbix. Thanks for using this tutorial for installing Zabbix Monitoring Tool on CentOS 6 system. For additional help or useful information, we recommend you check the official Zabbix website.