Zabbix is a free and open-source software used to monitor several IT components, including networks, servers, virtual machines, and cloud services. It provides real-time monitoring metrics such as network utilization, CPU load, and disk space consumption. These metrics help the system administrators to check the current health of your IT infrastructure and detect problems with hardware or software components. Zabbix uses MySQL, PostgreSQL, or Oracle to store its collected data. Zabbix uses agent software on the monitored server to gather data and send it to the Zabbix server.

This tutorial will show you how to install the Zabbix monitoring server on Debian 11.

Prerequisites

  • A server running Debian 11.
  • A root password is configured on the server.

Add Zabbix Repository

By default, the Zabbix package is not included in the Debian 11 default repository. So you will need to add the Zabbix official repository on your server.

First, download the Zabbix 6 repository package using the following command:

wget https://repo.zabbix.com/zabbix/6.0/debian/pool/main/z/zabbix-release/zabbix-release_6.0-1 debian11_all.deb

Once the package is downloaded, install it using the following command:

dpkg -i zabbix-release_6.0-1 debian11_all.deb

This will add the Zabbix repository to the APT. Once you are finished, you can proceed to install Zabbix server.

Install Zabbix 6 Server

Now, update the repository cache using the following command:

apt-get update -y

Once the repository is updated, install the Zabbix 6 server with other required components using the following command:

apt-get install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent zabbix-frontend-php zabbix-apache-conf -y

Once all the packages are installed, edit the PHP configuration file and set your timezone:

nano /etc/php/7.4/apache2/php.ini

Change the following line:

date.timezone = UTC

Save and close the file when you are finished.

Install and Configure MariaDB Database

Next, you will need to install the database server to store the Zabbix data. You can install the MariaDB database server by running the following command:

apt-get install mariadb-server -y

Once the MariaDB is installed, secure the MariaDB installation and set the root password with the following command:

mariadb-secure-installation

Answer all the questions as shown below:

Enter current password for root (enter for none): 
Switch to unix_socket authentication [Y/n] n
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

Next, log in to the MariaDB shell using the following command:

mysql -u root -p

Once you are log in, create a database and user for Zabbix with the following command:

MariaDB [(none)]> CREATE DATABASE zabbix character set utf8mb4 collate utf8mb4_bin;

MariaDB [(none)]> GRANT ALL PRIVILEGES ON zabbix.* TO [email protected] IDENTIFIED BY 'password';

Next, flush the privileges and exit from the MariaDB with the following command:

MariaDB [(none)]> FLUSH PRIVILEGES;

MariaDB [(none)]> EXIT;

Once you are finished, you can proceed to the next step.

Configure Zabbix Server

Next, you will need to define your database in the Zabbix configuration file. You can do it by editing the following file:

nano /etc/zabbix/zabbix_server.conf

Change the following lines:

DBName=zabbix
DBUser=zabbix
DBPassword=password

Save and close the file then import the Zabbix data with the following command:

zcat /usr/share/doc/zabbix-sql-scripts/mysql/server.sql.gz | mysql -u zabbix -p zabbix

Next, restart and enable all the services using the following command:

systemctl restart apache2

systemctl enable zabbix-server zabbix-agent apache2

systemctl restart zabbix-server zabbix-agent

You can now check the Zabbix status using the following command:

systemctl status zabbix-server

You will get the following output:

? zabbix-server.service - Zabbix Server
     Loaded: loaded (/lib/systemd/system/zabbix-server.service; disabled; vendor preset: enabled)
     Active: active (running) since Fri 2022-03-25 15:00:56 UTC; 27s ago
    Process: 15504 ExecStart=/usr/sbin/zabbix_server -c $CONFFILE (code=exited, status=0/SUCCESS)
   Main PID: 15511 (zabbix_server)
      Tasks: 48 (limit: 2341)
     Memory: 37.1M
        CPU: 333ms
     CGroup: /system.slice/zabbix-server.service
             ??15511 /usr/sbin/zabbix_server -c /etc/zabbix/zabbix_server.conf
             ??15524 /usr/sbin/zabbix_server: ha manager
             ??15527 /usr/sbin/zabbix_server: service manager #1 [processed 0 events, updated 0 event tags, deleted 0 problems, synced 0 serv>
             ??15528 /usr/sbin/zabbix_server: configuration syncer [synced configuration in 0.299588 sec, idle 60 sec]
             ??15542 /usr/sbin/zabbix_server: alert manager #1 [sent 0, failed 0 alerts, idle 5.006726 sec during 5.006891 sec]
             ??15543 /usr/sbin/zabbix_server: alerter #1 started
             ??15544 /usr/sbin/zabbix_server: alerter #2 started
             ??15545 /usr/sbin/zabbix_server: alerter #3 started
             ??15546 /usr/sbin/zabbix_server: preprocessing manager #1 [queued 0, processed 5 values, idle 5.005976 sec during 5.006175 sec]
             ??15547 /usr/sbin/zabbix_server: preprocessing worker #1 started
             ??15548 /usr/sbin/zabbix_server: preprocessing worker #2 started
             ??15549 /usr/sbin/zabbix_server: preprocessing worker #3 started
             ??15550 /usr/sbin/zabbix_server: lld manager #1 [processed 0 LLD rules, idle 5.002947sec during 5.003052 sec]
             ??15551 /usr/sbin/zabbix_server: lld worker #1 started
             ??15552 /usr/sbin/zabbix_server: lld worker #2 started
             ??15553 /usr/sbin/zabbix_server: housekeeper [startup idle for 30 minutes]
             ??15554 /usr/sbin/zabbix_server: timer #1 [updated 0 hosts, suppressed 0 events in 0.001865 sec, idle 59 sec]
             ??15555 /usr/sbin/zabbix_server: http poller #1 [got 0 values in 0.001076 sec, idle 5 sec]
             ??15556 /usr/sbin/zabbix_server: discoverer #1 [processed 0 rules in 0.000573 sec, idle 60 sec]
             ??15557 /usr/sbin/zabbix_server: history syncer #1 [processed 2 values, 1 triggers in 0.006625 sec, idle 1 sec]
             ??15558 /usr/sbin/zabbix_server: history syncer #2 [processed 0 values, 0 triggers in 0.000037 sec, idle 1 sec]
             ??15559 /usr/sbin/zabbix_server: history syncer #3 [processed 0 values, 0 triggers in 0.000047 sec, idle 1 sec]
             ??15567 /usr/sbin/zabbix_server: history syncer #4 [processed 0 values, 0 triggers in 0.000036 sec, idle 1 sec]
             ??15568 /usr/sbin/zabbix_server: escalator #1 [processed 0 escalations in 0.005513 sec, idle 3 sec]
             ??15569 /usr/sbin/zabbix_server: proxy poller #1 [exchanged data with 0 proxies in 0.000025 sec, idle 5 sec]
             ??15570 /usr/sbin/zabbix_server: self-monitoring [processed data in 0.000081 sec, idle 1 sec]

To check the Zabbix agent status, run the following command:

systemctl status zabbix-agent

You will get the following output:

? zabbix-agent.service - Zabbix Agent
     Loaded: loaded (/lib/systemd/system/zabbix-agent.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2022-03-25 15:00:56 UTC; 1min 12s ago
    Process: 15508 ExecStart=/usr/sbin/zabbix_agentd -c $CONFFILE (code=exited, status=0/SUCCESS)
   Main PID: 15513 (zabbix_agentd)
      Tasks: 6 (limit: 2341)
     Memory: 4.0M
        CPU: 79ms
     CGroup: /system.slice/zabbix-agent.service
             ??15513 /usr/sbin/zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf
             ??15517 /usr/sbin/zabbix_agentd: collector [idle 1 sec]
             ??15518 /usr/sbin/zabbix_agentd: listener #1 [waiting for connection]
             ??15519 /usr/sbin/zabbix_agentd: listener #2 [waiting for connection]
             ??15520 /usr/sbin/zabbix_agentd: listener #3 [waiting for connection]
             ??15521 /usr/sbin/zabbix_agentd: active checks #1 [idle 1 sec]

Mar 25 15:00:56 debian11 systemd[1]: Starting Zabbix Agent...

To check the Apache status, run the following command:

systemctl status apache2

You will get the following output:

? apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2022-03-25 15:00:56 UTC; 1min 31s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 15531 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 15535 (apache2)
      Tasks: 6 (limit: 2341)
     Memory: 13.6M
        CPU: 83ms
     CGroup: /system.slice/apache2.service
             ??15535 /usr/sbin/apache2 -k start
             ??15536 /usr/sbin/apache2 -k start
             ??15537 /usr/sbin/apache2 -k start
             ??15538 /usr/sbin/apache2 -k start
             ??15539 /usr/sbin/apache2 -k start
             ??15540 /usr/sbin/apache2 -k start

Access Zabbix 6 Web Interface

Now, open your web browser and access the Zabbix 6 web interface using the URL http://your-server-ip/zabbix. You should see the Zabbix language selection page:

<img alt="" data-ezsrc="https://kirelos.com/wp-content/uploads/2023/02/echo/p1.png63f3970009ab9.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="478" loading="lazy" src="data:image/svg xml,” width=”750″>

Select your language and click on the Next step. You should see the pre-requisites check page:

<img alt="" data-ezsrc="https://kirelos.com/wp-content/uploads/2023/02/echo/p2.png63f397002cb7e.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="460" loading="lazy" src="data:image/svg xml,” width=”750″>

If all checks are ok then click on the Next step button. You should see the database connection page:

<img alt="" data-ezsrc="https://kirelos.com/wp-content/uploads/2023/02/echo/p3.png63f3970051f72.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="459" loading="lazy" src="data:image/svg xml,” width=”750″>

Provide your database information and click on the Next step button. You should see the Settings page:

<img alt="" data-ezsrc="https://kirelos.com/wp-content/uploads/2023/02/echo/p4.png63f39700741a6.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="448" loading="lazy" src="data:image/svg xml,” width=”750″>

Define your Zabbix server name, timezone, theme, and click on the Next step button. You should see the installation summary page:

<img alt="" data-ezsrc="https://kirelos.com/wp-content/uploads/2023/02/echo/p5.png63f397009751f.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="454" loading="lazy" src="data:image/svg xml,” width=”750″>

If everything is fine, click on the Next step button to start the installation. Once the Zabbix 6 is installed, you should see the following page:

<img alt="" data-ezsrc="https://kirelos.com/wp-content/uploads/2023/02/echo/p6.png63f39700ce1ef.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="449" loading="lazy" src="data:image/svg xml,” width=”750″>

Click on the Finish button to finish the installation. You should see the Zabbix login page:

<img alt="" data-ezsrc="https://kirelos.com/wp-content/uploads/2023/02/echo/p7.png63f3970115b35.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="400" loading="lazy" src="data:image/svg xml,” width=”750″>

Provide default username as Admin and the password as zabbix then click on the Sign in button. You should see the Zabbix dashboard on the following page:

<img alt="" data-ezsrc="https://kirelos.com/wp-content/uploads/2023/02/echo/p8.png63f397012a4ce.jpg" ezimgfmt="rs rscb5 src ng ngcb5" height="372" loading="lazy" src="data:image/svg xml,” width=”750″>

Conclusion

Congratulations! you have successfully installed Zabbix 6 on Debian 11. You can now install the Zabbix agent on the remote servers and start monitoring them from the Zabbix dashboard.