Zabbix is an open source software for networks and application monitoring. Zabbix provides agents to monitor remote hosts as well as Zabbix includes support for monitoring via SNMP, TCP and ICMP checks.
Step 1 – Setup LAMP Stack
You must have a LAMP environment on your server to use Zabbix server. If you already have LAMP configured, just skip this step, else install Apache, MySQL, and PHP using the following commands.
sudo apt-get update
sudo apt-get update
sudo apt-get install apache2
sudo apt-get install mysql-server
sudo apt-get install php php-mbstring php-gd php-xml php-bcmath php-ldap php-mysql
Update timezone in php configuration file /etc/php/PHP_VERSION/apache2/php.ini. Like below:
[Date]
; http://php.net/date.timezone
date.timezone = 'Europe/Athens'
Step 2 – Configure Apt Repository
Before installing Zabbix first configure Zabbix package repository in your system using following commands. Use commands as per your operating system.
# For Debian 10:
wget https://repo.zabbix.com/zabbix/4.0/debian/pool/main/z/zabbix-release/zabbix-release_4.0-3+buster_all.deb
sudo dpkg -i zabbix-release_4.0-3+buster_all.deb
## For Debian 9:
wget https://repo.zabbix.com/zabbix/4.0/debian/pool/main/z/zabbix-release/zabbix-release_4.0-3+stretch_all.deb
sudo dpkg -i zabbix-release_4.0-3+stretch_all.deb
## For Debian 8:
wget https://repo.zabbix.com/zabbix/4.0/debian/pool/main/z/zabbix-release/zabbix-release_4.0-3+jessie_all.deb
sudo dpkg -i zabbix-release_4.0-3+jessie_all.deb
Step 3 – Install Zabbix Server
After adding the Zabbix repository in your system use following command to install Zabbix server. Here zabbix-server-mysql package includes Zabbix server with MySQL support. The zabbix-frontend-php package provides and web interface is written in PHP for the Zabbix server management
sudo apt-get update
sudo apt-get install zabbix-server-mysql zabbix-frontend-php zabbix-agent
Step 4 – Create Database Schema
Now create a database schema for your Zabbix server. Login to your MySQL server using administrative privileges and use the following queries to create MySQL database and user for the Zabbix server.
mysql -u root -p
mysql> CREATE DATABASE zabbixdb character set utf8 collate utf8_bin;
mysql> CREATE USER 'zabbix'@'localhost' IDENTIFIED BY 'password';
mysql> GRANT ALL PRIVILEGES ON zabbixdb.* TO 'zabbix'@'localhost' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;
Also, load the Zabbix database schema to the database created above.
cd /usr/share/doc/zabbix-server-mysql
zcat create.sql.gz | mysql -u zabbix -p zabbixdb
Step 5 – Edit Zabbix Configuration File
Edit Zabbix server configuration file /etc/zabbix/zabbix_server.conf in your favorite text editor and update the following database configurations. This will be used by Zabbix server to connect to the database.
DBHost=localhost
DBName=zabbixdb
DBUser=zabbix
DBPassword=password
Step 6 – Restart Apache and Zabbix
Zabbix creates its own apache configuration file /etc/zabbix/apache.conf and make a link to Apache configuration directory. Let’s use the following command to restart Apache service.
sudo systemctl restart apache2.service
Zabbix server configuration file are located at /etc/zabbix/zabbix_server.conf. Restart Zabbix server.
sudo systemctl restart zabbix-server
sudo systemctl restart zabbix-agent
Step 7 – Run Zabbix Web Installer
Zabbix web installer can be accessed on /zabbix
subdirectory URL on your servers IP or domain. For example, host.tecadmin.net is pointed to my Zabbix server. Now access the Zabbix using the following URL. You must change FQDN as per your setup.
http://host.domain.com/zabbix/