You can support us by downloading this article as PDF from the Link below. Download the guide as PDF

Introduction

Zabbix is the ultimate enterprise-level software designed for real-time monitoring of millions of metrics collected from tens of thousands of servers, virtual machines, and network devices.” It is capable of monitoring not only Linux but Windows, Solaris, IBM AIX. It has the capabilities of monitoring applications, services, databases and much more.

We are going to install Zabbix Server in the latest Debian 10 (Buster) in this guide. Kindly follow through as we get it done together.

The dependencies for this setup are:

  • Nginx webserver
  • PHP with required extensions
  • MySQL/ MariaDB database server

Step 1: Add Zabbix repository

sudo wget https://repo.zabbix.com/zabbix/4.4/debian/pool/main/z/zabbix-release/zabbix-release_4.4-1+buster_all.deb
sudo dpkg -i zabbix-release_4.4-1+buster_all.deb
sudo apt update

Step 2: Install Zabbix Server

Zabbix comes with three components, the Server, Proxy and Frontend. The proxy is optional.

Install Zabbix Server

This will install MariaDB database server for Zabbix server.

sudo apt install zabbix-server-mysql

Check the installed version by running the command below

$ mariadb --version
mariadb  Ver 15.1 Distrib 10.3.22-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

Step 3: Configure and create Zabbix Server Database

Secure your Database

Run the command below and say “Yes(Y)” to remove anonymous users, remove test databases and to disable remote root login.

 $ sudo mysql_secure_installation
Enter current password for root (enter for none):
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y

Login to MariaDB

sudo mysql -u root -p

Create Zabbix DataBase and Zabbix User:

CREATE DATABASE zabbixdb character set utf8 collate utf8_bin;
GRANT ALL PRIVILEGES ON zabbixdb.* TO [email protected] IDENTIFIED by 'SafePassWord';
FLUSH PRIVILEGES;
QUIT;

Import data

Now import initial schema and data for the server with MySQL:

sudo zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql -uuserzabbix -p zabbixdb

Step 3: Install Zabbix frontend:

This will install Nginx and PHP.

sudo apt install zabbix-frontend-php zabbix-nginx-conf

Check installed versions of Nginx and PHP

$ nginx -v
nginx version: nginx/1.14.2

$ php -v
PHP 7.3.11-1~deb10u1 (cli) (built: Oct 26 2019 14:14:18) ( NTS )

Configure PHP’s date.timezone parameter that Zabbix uses in its setup

sudo vim /etc/php/7.3/fpm/php.ini
## Navigate till "Date" category 

[Date] 
; Defines the default timezone used by the date functions 
; http://php.net/date.timezone  
date.timezone =Africa/Nairobi  ## Set your timezone here as shown 

Restart php-fpm

sudo systemctl restart php7.3-fpm

Start and enable Nginx

sudo systemctl enable nginx
sudo systemctl start nginx

Configure Nginx

Zabbix creates its own Nginx configuration file. Open and uncomment the “listen” and “server_name” parts as shown below

sudo vim /etc/nginx/conf.d/zabbix.conf
server {
        listen          80;                       ## Uncomment this part
        server_name     zabbix.computingforgeeks.com;    ## Uncomment this part too

Change port of the “default” Nginx file in Debian to listen on a different port so that it does not collide with Zabbix as configured above.

sudo vim /etc/nginx/sites-available/default
server {

        listen 82 default_server;      ## Change from 80 to 82
        listen [::]:82 default_server; ## Change from 80 to 82 as well

Change permissions on Zabbix root folder

sudo chmod -R 775 /usr/share/zabbix/

Restart Nginx

sudo systemctl restart nginx

Step 4: Configure the database for Zabbix server

Open the Zabbix server configuration file and make changes as shown below. If you had used different Database and User names, kindly update them accordingly.

sudo vim /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbixdb
DBUser=userzabbix
DBPassword=SafePassWord

Replace the values with your correct database settings.

Step 5: Install Zabbix Agent on Debian 10

This agent will monitor the server itself but you can easily install

To install the agent, run

sudo apt -y install zabbix-agent

Start and enable Zabbix agent and server

sudo systemctl enable zabbix-server zabbix-agent
sudo systemctl start zabbix-server zabbix-agent

Step 5: Set up Zabbix Web Interface

Open up your favorite browser and enter the IP of your Zabbix Server. Mine is as shown below

http://172.17.37.54

You should see a page similar to the one illustrated below. Click “Next step“.

Make sure all pre-requisites record a green “OK” then click “Next step

Enter the Database details we set up earlier and then click “Next step

Input your Zabbix Server details

View the summary of your settings

Finish up the settings

Let us now Log in and proceed to the Dashboard. The default username is “Admin” and password is “zabbix“. This credential can be changed under the Administration tab once you log in.

Navigate to Administration > Users > Admin > Password > Change Password

Conclusion

Zabbix Server is now running on Nginx and we hope everything went well on your side. Thank you for taking the time on the blog.

You might also like

How To Install Zabbix Server on CentOS 8 / RHEL 8

Install Zabbix Server 4 on CentOS 7

How to Install and configure Zabbix agent 4.0 on Ubuntu 18.04 and CentOS 7

10 Best Open Source Linux Monitoring Tools

You can support us by downloading this article as PDF from the Link below. Download the guide as PDF