How to Install Zabbix on Debian 10
This tutorial exists for these OS versions
- Debian 11 (Bullseye)
- Debian 10 (Buster)
- Debian 9 (Stretch)
- Debian 4 (Etch)
On this page
Zabbix is an open-source monitoring tool for network services, network hardware, servers, and application. Designed to track and monitor the status of your system and servers. Zabbix offers support for many database systems - including MySQL, PostgreSQL, SQLite, and IBM DB2 - to store data. Zabbix backend is written in C, and the frontend is written in PHP.
In this tutorial, we will show you how to install Zabbix 4.4. on the Debian Buster 10. We will install and configure the latest stable version of Zabbix 4.4.5 under the LAMP Stack (Linux, Apache, MariaDB, and PHP).
Prerequisite
For this guide, we will install Zabbix on the Debian Buster 10 with 4GB of RAM and 50GB of disk space with 4 CPUs. Also, you must have the root privileges on the server.
What we will do?
- Install Apache Webserver
- Install and Configure PHP
- Install and Configure MariaDB
- Install and Configure Zabbix
- Zabbix Frontend Installation
Step 1 - Install Apache Webserver
First, we will install the Apache webserver to our Debian 10. It will be used as a web server for the Zabbix web administrator.
Update list repositories and upgrade all packages to the latest version.
sudo apt update
sudo apt upgrade
Now install the Apache webserver using the apt command below.
sudo apt install apache2
Once the installation is complete, start the Apache service and add it to the system boot.
systemctl start apache2
systemctl enable apache2
The Apache service is up and running, check using the following command.
systemctl status apache2
You will get the result as below.
The Apache webserver is installed on the Debian Buster 10.
Step 2 - Install and Configure PHP Packages
In this step, we will install and configure PHP on the Debian 10. We will configure the PHP as a Zabbix system requirement.
Install PHP and other extensions needed using the apt command below.
sudo apt install php-cli php-common php-dev php-pear php-gd php-mbstring php-mysql php-xml php-bcmath libapache2-mod-php
Once the installation is complete, go to the PHP configuration directory '/etc/php/7.3'.
cd /etc/php/7.3/
Edit the 'php.ini' configuration for both 'apache2' and 'cli'.
vim apache2/php.ini
vim cli/php.ini
Change some PHP options as below.
date.timezone = Asia/Jakarta
max_execution_time = 600
max_input_time = 600
memory_limit = 256M
post_max_size = 32M
upload_max_filesize = 16M
Save and close.
Now restart the Apache service.
systemctl restart apache2
Make sure you got no error, and the PHP installation and configuration for Zabbix has been completed.
Step 3 - Install and Configure MariaDB Server
After installing PHP, we will and configure the MariaDB database. We will install the MariaDB, setup the root password for MariaDB, and create a new database and user for Zabbix.
Install MariaDB to the Debian server using the apt command below.
sudo apt install mariadb-server
Once the installation is complete, start the MariaDB service and add it to the boot time.
systemctl start mariadb
systemctl enable mariadb
Next, run the 'mysql_secure_installation' command below to set up the MariaDB root password.
mysql_secure_installation
Type your root password for MariaDB and type 'Y' for all questions.
Set a root password? [Y/n] Y
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
Now you've set up the MariaDB root password.
Next, log int to the MariaDB/MySQL shell and create a new database and user for Zabbix.
Login to the MariaDB/MySQL shell using the mysql command below.
mysql -u root -p
Type your Password:
Create a new database and user named 'zabbix' using the following queries.
create database zabbix character set utf8 collate utf8_bin;
grant all privileges on zabbix.* to zabbix@'localhost' identified by 'hakase-labs@';
grant all privileges on zabbix.* to zabbix@'%' identified by 'hakase-labs@';
flush privileges;
Now type 'exit' to log out from the MySQL shell, and the MariaDB/MySQL database and user for Zabbix has been created.
Step 4 - Install and Configure Zabbix
In this step, we will install and configure Zabbix on the Debian server. We will install Zabbix from the official Zabbix repository, import the MariaDB database scheme, setup Zabbix Server and Agent.
- Install Zabbix Packages
First, add the Zabbix 4.4 repository for the Debian Buster 10 using the command below.
wget https://repo.zabbix.com/zabbix/4.4/debian/pool/main/z/zabbix-release/zabbix-release_4.4-1+buster_all.deb
dpkg -i zabbix-release_4.4-1+buster_all.deb
Now update list repositories on your system.
sudo apt update
After that, install Zabbix packages using the apt command below.
sudo apt install zabbix-frontend-php zabbix-apache-conf zabbix-server-mysql zabbix-agent
And the Zabbix packages have been installed to the Debian Buster 10.
- Import Zabbix Database
After installing Zabbix packages, we will import the Zabbix database scheme to the 'zabbix' database.
Go to the '/usr/share/doc/zabbix-server-mysql' directory and extract Zabbix database scheme.
cd /usr/share/doc/zabbix-server-mysql
gunzip create.sql.gz
Now import the database scheme to the 'zabbix' database using the mysql command below.
mysql -u root -p zabbix < create.sql
Type your root and the Database scheme for Zabbix has been imported to the 'zabbix' database.
- Configure Zabbix Server
Edit the zabbix configuration '/etc/zabbix/zabbix_server.conf' using vim editor.
vim /etc/zabbix/zabbix_server.conf
Uncomment the MySQL database configuration and change details with your own.
DBHost=localhost
DBPassword=hakase-labs@
Save and close.
Next, start the Zabbix Server service and add it to the system boot.
systemctl start zabbix-server
systemctl enable zabbix-server
And the Zabbix Server is up and running.
- Configure Zabbix Agent
Now we will set up the Zabbix Agent.
Edit the Zabbix Agent configuration '/etc/zabbix/zabbix_agentd.conf' using vim editor.
vim /etc/zabbix/zabbix_agentd.conf
Change the Server configuration with the IP address of the Zabbix Server.
Server=10.5.5.50
ServerActive=10.5.5.50
Change the Hostname with the server hostname.
Hostname=zabbix10
Save and close.
Next, start the Zabbix Agent service and add it to the system boot.
systemctl start zabbix-agent
systemctl enable zabbix-agent
The Zabbix Agent is up and running.
- Restart Apache Webserver
After configuring the Zabbix Server and Agent, we need to restart the Apache service.
Restart Apache service using the systemctl command below.
systemctl restart apache2
As a result, the Apache service has been restarted, and the Zabbix installation and configuration has been completed.
Step 5 - Zabbix Frontend Post-Instaallation
Open your web browser and type the server IP address following the URL path '/zabbix'.
Now you will get the welcome message for Zabbix installation.
Click the 'Next step' button to continue.
Now the Zabbix will check all requirements for the Zabbix Frontend installation. Make sure all requirements have a green 'OK' indication.
Click the 'Next step' button to continue.
For database configuration, choose the MySQL database and type the password for database and user 'zabbix'.
Click the 'Next step' button again.
For the Zabbix Server details, type your server IP address and hostname, then click the 'Next step' button again.
Now click the 'Next step' button again to confirm all configurations to install the Zabbix Frontend.
Once the installation is complete, you will get the 'Congratulations' message as below.
Click the 'Finish' button and you will be redirected to the Zabbix login page.
Type the Zabbix default user as 'Admin' with password 'zabbix', then click the 'Sign In' button.
Now you will get the Zabbix Dashboard as below.
As a result, the installation of Zabbix 4.4 on Debian Buster 10 has been completed successfully.