How to Install Zabbix Monitoring Tool on Debian 11/10
Zabbix is a free, open-source, popular, and feature-rich IT infrastructure monitoring software developed using PHP language. It is used to monitor networks, servers, applications, services as well as cloud resources. It also supports the monitoring of storage devices, databases, virtual machines, telephony, IT security resources, and much more.
This tutorial shows how to install and configure the latest release of Zabbix open-source monitoring tool on Debian 11 and Debian 10 with MySQL database to keep data, PHP, and Apache Web Server as the main web interface.
If you don’t have root privileges, use sudo before every command!
Step 1: Installing Apache Web Server and PHP Packages
To install Zabbix, first, you need to install Apache and PHP along with some required PHP modules as follows.
apt-get install apache2 php php-mysql php-mysqlnd php-ldap php-bcmath php-mbstring php-gd php-pdo php-xml libapache2-mod-php
2. In the installation process, the installer triggers the systemd to automatically start Apache service, and it also enables it to automatically start at system boot. You can check if it is up and running using the systemctl command.
systemctl status apache2
The following are some useful systemctl commands for managing the Apache services under systemd:
systemctl start apache2
systemctl stop apache2
systemctl restart apache2
Step 2: Install MariaDB Server and Client
1. To store data, Zabbix requires a database management system. It supports MySQL by default but for this guide, we will install MariaDB as a drop-in replacement for MySQL.
apt install mariadb-server mariadb-client
2. When the installation is complete, the MariaDB service is auto-started and enabled to automatically start at system startup. To check if it is up and running, use the following command.
systemctl status mariadb
3. Next, you need to secure your MariaDB server database installation. The installed package ships with a script that you need to run and follow the security recommendations.
mysql_secure_installation
It will ask you to determine actions to remove anonymous users, disable root login remotely, remove test database and access to it, and apply all changes.
4. Once the database server is secured, you need to create a database for Zabbix. First, log in to the database to gain access to the MariaDB shell as follows.
mysql -u root -p
5. Then issues the following SQL commands to create the required database (do not forget to set a secure password).
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'admin@irgnet';
MariaDB [(none)]> quit;
Step 3: Installing and Configuring Zabbix Server
1. To install Zabbix, you need to enable the Zabbix Official Repository which contains the Zabbix packages, as follows.
wget --no-check-certificate https://repo.zabbix.com/zabbix/5.4/debian/pool/main/z/zabbix-release/zabbix-release_5.4-1+debian11_all.deb
dpkg -i zabbix-release_5.4-1+debian11_all.deb
apt update -y
2. Now install the Zabbix server, web frontend, agent packages using the following command.
apt install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent
3. If the package installation is successful, next, import the initial schema and data into the Zabbix database which you created in the previous step.
zcat /usr/share/doc/zabbix-sql-scripts/mysql/create.sql.gz | mysql -uzabbix -p zabbix
4. Next, configure the Zabbix server daemon to use the database you created for it by editing the file /etc/zabbix/zabbix_server.conf.
nano /etc/zabbix/zabbix_server.conf
Look for the following configuration options and update their values to reflect your database settings. Note that you need to uncomment any option(s) that are commented out and set their correct values.
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=admin@irgnet
Then save the new changes in the file and exit it.
5. You should also set up PHP to work correctly with the Zabbix frontend by defining your timezone in the /etc/zabbix/apache.conf file.
nano /etc/zabbix/apache.conf
Find the configuration section for your PHP version, for example, PHP 7.x. Then uncomment the following line (by removing the “#”
character at the start) to enable timezone for your server as shown in the screenshot.
php_value date.timezone Europe/Berlin
Save the changes and close the file.
6. Now restart the Apache server to apply recent changes.
systemctl restart apache2
7. With all the perfect environment setup, you can now start the Zabbix server and agent processes, enabling them to auto-start at system boot as shown.
systemctl start zabbix-server zabbix-agent
systemctl enable zabbix-server zabbix-agent
8. Then make sure to check the status of the Zabbix server using the following command.
systemctl status zabbix-server
9. Also, ensure that the Zabbix agent process is up and running by checking its status as shown. Remember the agent you have started is running on and monitoring the local host. If you want to monitor remote servers, install and configure agents on them (refer to related articles at the end of the guide).
systemctl status zabbix-agent
10. (optional) Before you can access the Zabbix web frontend as shown in the next section if you have the UFW firewall service running, you need to open port 80(HTTP) and 443(HTTPS) to allow traffic to the Apache server.
ufw allow 80/tcp
ufw allow 443/tcp
ufw reload
Step 4: Installing and Configuring Zabbix Web Frontend Interface
1. Before you can start using the Zabbix web frontend for monitoring, you need to configure and set it up via a web installer. To access the installer, open a web browser and point it to the following URL.
http://SERVER_FQDM/zabbix
# OR
http://SERVER_IP/zabbix
2. Once you click go, or press Enter, you will land on the Welcome page as shown in the following screenshot. Click Next step to start the setup process.
3. The installer will then check the pre-requisites as shown in the screenshot, if all required PHP modules and configuration options are OK (scroll down to view more requirements), click Next step to proceed.
4. Next, enter the database connection settings for the Zabbix frontend to link to the database. Choose the database type (which should be MySQL), provide the database host, database port, database name, and database user, and the user’s password as shown in the screenshot.
5. Next, enter the Zabbix server details (hostname or host IP address and port number of the hosting server). Optionally, set a name for the installation.
6. Under GUI settings you can change the Timezone and Theme. ( I prefer dark 🙂 )
7. Now the installer should show you the pre-installation summary page. If all is fine, click Next step to complete the setup.
8. Now click Finish, and you should be re-directed to the login page as shown in the next screenshot.
9. To login, enter the username Admin and password zabbix. (exactly as described, A of Admin large and z of zabbix small, otherwise the login will not work).
10. Once you have logged on, you will see the Monitoring section Dashboard. The Global view will display a sample of System information, problems by severity, problems, local time, and more, as shown in the screenshot.
As you can see, there is one failed login attempt. 😀
11. As an important step, you need to change the default administrator account password. To do that, go to Administration ==> Users.
From the list of users, under Alias, click on Admin to open the user’s details. In the user details page, look for the Password field and click Change password. Then set a secure password and confirm it. And click Update to save the password.
And that was it, the initial installation of Zabbix. In the next blog posts I will describe how to add Linux and Windows hosts to the monitoring via Zabbix Agent, so stay tuned.
If you have any questions please use the comment section. 🙂
[…] How to Install Zabbix Monitoring Tool on Debian 11/10 […]
[…] How to Install Zabbix Monitoring Tool on Debian 11/10 […]