Zabbix server is installable on any Linux distribution, but in this tutorial, I will show you how to install latest Zabbix 7.0 LTS release on Debian 12 _(bookworm) or 11 (Bullseye).
Zabbix is 100% free open-source ultimate enterprise-level software designed for monitoring availability and performance of IT infrastructure components. You can read a case-study about Zabbix popularity and find out more about open-source movement in this article.
Enough of talk lets do some work! First, we will install and configure Zabbix server, then a database and lastly the frontend – check the picture bellow for a better understanding of Zabbix architecture.
This guide is for installing Zabbix monitoring system (Server) on Debian, while guide for installing Zabbix-Proxy on Debian can be found on this link.
Table of Contents
- Step 1: Install Zabbix server, frontend, and agent
- Step 2: Configure database
- Step 3: Start Zabbix server and agent processes
- Step 4: Configure Zabbix frontend
- Step 5: Login to frontend using Zabbix default login credentials
- Step 6: Create MySQL partitions on History and Events tables
- Step 7: Optimizing Zabbix Server (optional)
- Step 8: Optimizing MySQL database (optional)
- Step 9: How to manage Zabbix / MySQL / Apache service
- Step 10: Upgrade between minor versions
Step 1: Install Zabbix server, frontend, and agent
Note: You need to log in as a root user on your Linux server with “su -
” or use “sudo
” to successfully execute commands used in this tutorial.
Install Zabbix 7 .deb package on your Debian:
Zabbix 7.0 LTS version (supported until June 31, 2029)
wget https://repo.zabbix.com/zabbix/7.0/debian/pool/main/z/zabbix-release/zabbix-release_7.0-2+debian$(cut -d"." -f1 /etc/debian_version)_all.deb
dpkg -i zabbix-release_7.0-2+debian$(cut -d"." -f1 /etc/debian_version)_all.deb
apt update
apt -y install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent
You can find more information about Zabbix’s life cycle and release policies on the official website.
Step 2: Configure database
In this installation, I will use password rootDBpass as root password and zabbixDBpass as Zabbix password for DB. Consider changing your password for security reasons.
a. Install MariaDB 10.11
In your terminal, use the following command to install MariaDB 10.11 (supported untill 2028).
sudo apt install software-properties-common -y
curl -LsS -O https://downloads.mariadb.com/MariaDB/mariadb_repo_setup sudo bash mariadb_repo_setup --mariadb-server-version=10.11
sudo apt update sudo apt -y install mariadb-common mariadb-server-10.11 mariadb-client-10.11
NOTE: If you get error on Ubuntu 24.04: “The repository ‘https://dlm.mariadb.com/repo/maxscale/latest/apt noble Release’ does not have a Release file. [error] Failed to add trusted package signing keys” then use these commands instead of those above:
sudo rm /etc/apt/sources.list.d/mariadb.list curl -fsSL https://mariadb.org/mariadb_release_signing_key.asc | sudo gpg --dearmor -o /usr/share/keyrings/mariadb-archive-keyring.gpg echo "deb [signed-by=/usr/share/keyrings/mariadb-archive-keyring.gpg] https://dlm.mariadb.com/repo/mariadb-server/10.11/repo/ubuntu mantic main" >> /etc/apt/sources.list apt update apt install mariadb-server
Once the installation is complete, start the MariaDB service and enable it to start on boot using the following commands:
sudo systemctl start mariadb sudo systemctl enable mariadb
b. Reset root password for database
Secure MySQL/MariaDB by changing the default password for MySQL root, I will change it to “rootDBpass”:
sudo mysql_secure_installation
Enter current password for root (enter for none): Press Enter Switch to unix_socket authentication [Y/n] y Change the root password? [Y/n] y New password: <Enter root DB password, I will set "rootDBpass"> Re-enter new password: <Repeat root DB password, I will set "rootDBpass"> 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
c. Create database
sudo mysql -uroot -p'rootDBpass' -e "create database zabbix character set utf8mb4 collate utf8mb4_bin;" sudo mysql -uroot -p'rootDBpass' -e "create user 'zabbix'@'localhost' identified by 'zabbixDBpass';" sudo mysql -uroot -p'rootDBpass' -e "grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbixDBpass';"
d. Import initial schema and data.
Import database shema for Zabbix server (could last up to 5 minutes):
sudo zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p'zabbixDBpass' zabbix
e. Enter database password in Zabbix configuration file
Open zabbix_server.conf
file with command:
sudo nano /etc/zabbix/zabbix_server.conf
and add database password in this format anywhere in file:
DBPassword=zabbixDBpass
Save and exit file (ctrl+x, followed by y and enter).
Step 3: Start Zabbix server and agent processes
systemctl restart zabbix-server zabbix-agent systemctl enable zabbix-server zabbix-agent
Step 4: Configure Zabbix frontend
a. Restart Apache web server and make it start at system boot
systemctl restart apache2
systemctl enable apache2
b. Configure web frontend
Connect to your newly installed Zabbix frontend using URL “http://server_ip_or_dns_name/zabbix” to initiate the Zabbix installation wizard.
In my case, that URL would be “http://192.168.1.161/zabbix” because I have installed Zabbix on the server with IP address 192.168.1.161 (you can find the IP address of your server by typing “ip a
” command in the terminal).
Basically, in this wizard you only need to enter a password for Zabbix DB user and just click “Next step” for everything else. In this guide, I have used a zabbixDBpass as a database password, but if you set something else, be sure to enter the correct password when prompted by the wizard.
If you get the error “zabbix Locale for language “en_US” is not found on the web server. Tried to set: en_US, en_US.utf8, en_US.UTF-8, en_US.iso885915, en_US.ISO8859-1” then use this command to fix it:
apt-get install -y locales && echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen && locale-gen && service apache2 restart
That’s it, you have installed Zabbix monitoring system!
Step 5: Login to frontend using Zabbix default login credentials
Use Zabbix default admin username “Admin” and password “zabbix” (without quotes) to login to Zabbix frontend at URL “http://server_ip_or_dns_name/zabbix” via your browser.
In my example, I have installed Zabbix on server 192.168.1.161 so I will enter in my browsers URL field http://192.168.1.161/zabbix (you can find the IP address of your server by typing “ip a
” command in the terminal)
CONGRATULATIONS!
You have successfully installed Zabbix 7 monitoring system and now you can monitor anything!
No need to change anything else as other steps are optional.
CONTINUE TO LEARN MORE:
How to create MySQL partitions on History and Events tables
Optimizing Zabbix server and MySQL database
Managing Zabbix / MySQL / Apache service
Step 6: Create MySQL partitions on History and Events tables
Zabbix’s housekeeping process is responsible for deleting old trend and history data. Removing old data from the database using SQL delete query can negatively impact database performance. Many of us have received that annoying alarm “Zabbix housekeeper processes more than 75% busy
” because of that.
That problem can be easily solved with the database partitioning. Partitioning creates tables for each hour or day and drops them when they are not needed anymore. SQL DROP is way more efficient than the DELETE statement.
You can partition MySQL tables in 5 minutes using this simple guide.
Step 7: Optimizing Zabbix Server (optional)
Don’t bother with this optimization if you are monitoring a small number of devices, but if you are planning to monitor a large number of devices then continue with this step.
Open “zabbix_server.conf
” file with command: “nano /etc/zabbix/zabbix_server.conf
” and add this configuration anywhere in file:
StartPollers=100
StartPollersUnreachable=50
StartPingers=50
StartTrappers=10
StartDiscoverers=10
StartHTTPPollers=10
CacheSize=128M
HistoryCacheSize=64M
HistoryIndexCacheSize=32M
TrendCacheSize=32M
ValueCacheSize=256M
Save and exit file (ctrl+x, followed by y and enter).
This is not a perfect configuration, keep in mind that you can optimize it even more. Let’s say if you don’t use ICMP checks then set the “StartPingers
” parameter to 1 or if you don’t use active agents then set “StartTrappers
” to 1 and so on. You can find out more about the parameters supported in a Zabbix server configuration file in the official documentation.
If you try to start the Zabbix server you may receive an error “[Z3001] connection to database 'Zabbix' failed: [1040] Too many connections
” in the log “/var/log/zabbix/zabbix_server.log
” because we are using more Zabbix server processes than MySQL can handle. We need to increase the maximum permitted number of simultaneous client connections and optimize MySQL – so move to the next step.
Step 8: Optimizing MySQL database (optional)
a. Create custom MySQL configuration file
Create file “10_my_tweaks.cnf"
with “/etc/mysql/mariadb.conf.d/10_my_tweaks.cnf
” and paste this configuration:
[mysqld]
max_connections = 300
innodb_buffer_pool_size = 800M
innodb-log-file-size = 128M
innodb-log-buffer-size = 128M
innodb-file-per-table = 1
innodb_buffer_pool_instances = 8
innodb_old_blocks_time = 1000
innodb_stats_on_metadata = off
innodb-flush-method = O_DIRECT
innodb-log-files-in-group = 2
innodb-flush-log-at-trx-commit = 2
tmp-table-size = 96M
max-heap-table-size = 96M
open_files_limit = 65535
max_connect_errors = 1000000
connect_timeout = 60
wait_timeout = 28800
Save and exit the file (ctrl+x, followed by y and enter) and set the correct file permission:
chown mysql:mysql /etc/mysql/mariadb.conf.d/10_my_tweaks.cnf
chmod 644 /etc/mysql/mariadb.conf.d/10_my_tweaks.cnf
Configuration parameter innodb_buffer_pool_size determines how much memory can MySQL get for caching InnoDB tables and index data. You should set that parameter to 70% of system memory if only database is installed on server.
However, in this case, we are sharing a server with Zabbix and Apache processes so you should set innodb_buffer_pool_size to 40% of total system memory. That would be 800 MB because my Debian server has 2 GB RAM.
I didn’t have any problems with memory, but if your Zabbix proxy crashes because of lack of memory, reduce “innodb_buffer_pool_size
” and restart MySQL server.
Note that if you follow this configuration, you may receive “Too many processes on the Zabbix server
” alarm in Zabbix frontend due to the new Zabbix configuration. It is safe to increase the trigger threshold or turn off that alarm (select “Problems” tab → left click on the alarm → select “Configuration” → remove the check from “Enabled” → hit the “Update” button)
Learn more about database optimization in the tutorial: How to optimize Zabbix database?
b. Restart Zabbix Server and MySQL service
Stop and start the services in the same order as below:
systemctl stop zabbix-server
systemctl stop mysql
systemctl start mysql
systemctl start zabbix-server
Step 9: How to manage Zabbix / MySQL / Apache service
Sometimes you will need to check or restart Zabbix, MySQL or Apache service – use commands below to do that.
Zabbix Server systemctl <status/restart/start/stop> zabbix-server MySQL Server systemctl <status/restart/start/stop> mysql Apache Server systemctl <status/restart/start/stop> apache2 Zabbix Agent systemctl <status/restart/start/stop> zabbix-agent
Step 10: Upgrade between minor versions
I wrote about these upgrade procedures in my post about Zabbix upgrade. Zabbix’s team releases new minor versions at least once a month. The main purpose of minor upgrades is to fix bugs (hotfix) and sometimes even bring new functionality. Therefore, try to do a minor upgrade of Zabbix at least once a month.
There is no need for backups when doing a minor upgrade, they are completely safe. With this command you can easily upgrade smaller versions of 6.0.x (for example, from 6.0.1 to 6.0.3):
apt install --only-upgrade 'zabbix*'
And restart Zabbix server afterward:
systemctl restart zabbix-server
Clear , Precise , the best way to setup Zabbix 6 on Debian 12, worked like a charm , All parts described here are understandable and easily automated.
Total time : aprox. one hour
Except for the locale setting with LCX debian 12 Image , all is working Well.
THX you are my GOD !! 🙂
Thanks a lot!
Thanks for the guide. Is there a way to reset the web interface. I’ve got a password based issue and not found where I need to update the password to get my web interface back yet.
Thank You very much. Worked perfectly.
Dont Work to Debian 11 and Zabbix 6.0.1
dpkg -i zabbix-release_6.0-1+debian$(cut -d”.” -f1 /etc/debian_version)_all.deb
apt update
ERROR
apt -y install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent
ERROR
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Zabbix 6 installation commands are working fine on Debian 11. Make sure to use root or sudo when executing commands. Can you c/p full error message?
Dont Work To Debian 9
Good afternoon,
This configuation i should use 3 Vms or 2 (zabbix server+frontend + db)
await feedback,
Regards
For a small environment, you can use one VM. However, I like to have DB on the dedicated VM and Zabbix Server+Frontend on the other.
Regards
thanks so much!
Good afternoon, I have a problem, the pre-requisites are lower.
How do I change?
Thanks
Can you give me more details – screenshot?
Does this setup work on Debian nginx?
Zabbix can work with NGINX, you just need to replace zabbix-apache-conf with zabbix-nginx-conf when installing Zabbix from packages and tweak Nginx conf file, more details on https://www.zabbix.com/download?zabbix=5.0&os_distribution=debian&os_version=10_buster&db=mysql&ws=nginx