Skip to content
Learni
View all tutorials
DevOps

How to Install and Configure Zabbix 7 in 2026

Lire en français

Introduction

Zabbix is a powerful open-source monitoring solution capable of supervising thousands of hosts via SNMP, agents, or JMX. In 2026, version 7.x integrates AI for anomaly detection and a modernized UI. This intermediate tutorial guides you step-by-step through a full deployment on Ubuntu 24.04: installing the server with MariaDB and Nginx, configuring agents, creating advanced triggers and items. Why is it crucial? In a cloud-native world, proactive monitoring prevents costly downtimes (up to $10k/hour). You'll end up with a production-ready, horizontally scalable setup, complete with copy-paste examples. At the end, you'll monitor CPU, disks, and logs in real-time like a pro DevOps engineer.

Prerequisites

  • Ubuntu 24.04 LTS server with at least 4 GB RAM (8 GB recommended for >100 hosts)
  • Root or sudo access
  • Internet connection for packages
  • Basics in Linux, SQL, and networking
  • Ports open: 10050 (agent), 10051 (server), 80/443 (web)

Add the repo and install packages

terminal
wget https://repo.zabbix.com/zabbix/7.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_7.0-1+ubuntu24.04_all.deb
dpkg -i zabbix-release_7.0-1+ubuntu24.04_all.deb
apt update
apt install -y zabbix-server-mysql zabbix-frontend-php-nginx zabbix-nginx-conf zabbix-sql-scripts zabbix-agent2 mariadb-server nginx-full

This script adds the official Zabbix 7 repo for Ubuntu 24.04, updates packages, and installs the MySQL server, PHP/Nginx frontend, SQL scripts, agent2 (new in 7.x, written in Go), and MariaDB. Agent2 outperforms the old agentd. Note: Run as root, or services won't start.

Secure and configure MariaDB

Before creating the database, secure MariaDB with mysql_secure_installation. This removes anonymous users and disables remote root login, essential in production. Use a strong root password (e.g., generate with pwgen 32 1).

Create the Zabbix database and user

create_zabbix_db.sql
CREATE DATABASE zabbix CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
CREATE USER 'zabbix'@'localhost' IDENTIFIED BY 'VotreMotDePasseFort123!';
GRANT ALL PRIVILEGES ON zabbix.* TO 'zabbix'@'localhost';
FLUSH PRIVILEGES;
QUIT;

This SQL script creates an optimized UTF8MB4 database (for emojis and special characters in Zabbix 7) and a dedicated user. Replace 'VotreMotDePasseFort123!' with a strong secret. The utf8mb4_bin collation prevents false positives on text triggers. Test with mysql -u zabbix -p zabbix.

Import the database schema

terminal
zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -u zabbix -p zabbix
zcat /usr/share/zabbix-sql-scripts/mysql/images.sql.gz | mysql --default-character-set=utf8mb4 -u zabbix -p zabbix
zcat /usr/share/zabbix-sql-scripts/mysql/data.sql.gz | mysql --default-character-set=utf8mb4 -u zabbix -p zabbix

Imports the server, images, and data schemas for Zabbix 7. Order is critical: server first. Use zcat to decompress on the fly—faster than gunzip. Time: ~2-5 min depending on SSD. Verify with mysql -u zabbix -p -e "SELECT COUNT(*) FROM hosts;" zabbix (should be >0).

Configure the Zabbix server

Now edit /etc/zabbix/zabbix_server.conf. Enable Housekeeper cache to clean historical data and HistoryCache for high-frequency items.

Full zabbix_server.conf configuration

/etc/zabbix/zabbix_server.conf
LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=100M
PidFile=/run/zabbix/zabbix_server.pid
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=VotreMotDePasseFort123!
SNMPTrapperFile=/var/log/zabbix/zabbix_traps.tmp
AlertScriptsPath=/usr/lib/zabbix/alertscripts
ExternalScripts=/usr/lib/zabbix/externalscripts
CacheSize=128M
HistoryCacheSize=64M
TrendCacheSize=64M
ValueCacheSize=512M
HistoryIndexCacheSize=32M
HousekeepingFrequency=1
MaxHousekeeperDelete=5000
StartPollers=10
StartPollersUnreachable=5
StartPingers=10
StartTrappers=10
StartHTTPPollers=5
StartDiscoverers=5
StartTimers=10
StartEscalators=5
Timeout=30
AlertScriptsPath=/usr/lib/zabbix/alertscripts

Full config optimized for 100-500 hosts: increased caches for scalability, housekeeper every hour. Adjust CacheSize based on RAM (about 1/10th total). DBPassword must match the SQL above. After editing, validate syntax with zabbix_server -t.

Start and enable services

terminal
systemctl restart zabbix-server zabbix-agent2 nginx mariadb
systemctl enable zabbix-server zabbix-agent2 nginx mariadb
systemctl status zabbix-server
ufw allow 10050/tcp
ufw allow 10051/tcp
ufw allow 80/tcp
ufw reload

Restarts and enables services. Status checks logs (journalctl -u zabbix-server). Opens agent/server/web ports via UFW. In production, add HTTPS with Let's Encrypt afterward.

Install and configure a remote agent

On the host to monitor (Ubuntu 24.04): Install zabbix-agent2 the same way. Then configure it to point to your server.

Agent2 configuration with custom userparameter

/etc/zabbix/zabbix_agent2.conf
Server=IP_DU_SERVEUR_ZABBIX
ServerActive=IP_DU_SERVEUR_ZABBIX
Hostname=mon-serveur-exemple
Include=/etc/zabbix/zabbix_agent2.d/
UserParameter=custom.disk.usage[*],df -h $1 | tail -1 | awk '{print $5}' | sed 's/%//'
AllowRoot=1
LogFile=/var/log/zabbix/zabbix_agent2.log
LogFileSize=10M

Agent2 points to the server via Server/ServerActive (pull/push). Custom userparameter for disk usage: calls df and parses %. Copy to all hosts, restart agent2. Test: zabbix_get -s 127.0.0.1 -k custom.disk.usage[/].

Access the UI and initial setup

Access http://IP_SERVEUR_ZABBIX/zabbix. In the setup wizard: DB zabbix/zabbix/YourStrongPassword, timezone Europe/Paris. Create admin/zabbix. Add the host 'mon-serveur-exemple' in Configuration > Hosts, with agent interface port 10050.

Best practices

  • Automated backups: Crontab for mysqldump zabbix > /backup/zabbix-$(date +%Y%m%d).sql.gz daily.
  • HTTPS required: Certbot for Nginx (certbot --nginx), force 80→443 redirect.
  • Scalability: Zabbix proxies for >1000 hosts, DB partitioning.
  • Security: 2FA via SAML, limit IPs in Nginx (allow IP_SERVER; deny all;).
  • Alerts: Integrate Slack/Telegram via media types, test escalations.

Common errors to avoid

  • Wrong DB charset: Without utf8mb4_bin, text triggers glitch (e.g., "é" != "e").
  • Closed ports: Agent unresponsive → ufw status, telnet IP 10050.
  • Insufficient caches: Pollers saturated → logs "cannot send data"; double ValueCacheSize.
  • Slow housekeeper: MaxHousekeeperDelete too high → timeout; lower to 1000.

Next steps