Zabbix monitoring on Ubuntu 24.04
Install Zabbix 7.0 LTS on Ubuntu 24.04: add the repo, import the MySQL schema, wire up the nginx frontend and agent2, then fix every error the setup throws.
What you are building
A single Ubuntu 24.04 VPS running the full Zabbix 7.0 LTS stack: the zabbix-server daemon that polls and alerts, a MariaDB/MySQL database that stores every metric, a PHP frontend served by nginx, and zabbix-agent2 collecting metrics from the box itself. Once it is up you point it at a second server, attach a template, and get an email the moment a disk fills or a service dies.
Zabbix is heavier than a status-page tool: a real time-series system with templates, triggers, escalation and history retention. Almost all the pain lives in three steps people skip, importing the database schema, setting the database password the server actually reads, and uncommenting two lines in the nginx config. Get those right and the rest is a wizard. If you only want up/down checks and a shareable status page, a lightweight Uptime Kuma status monitor does that in one container; Zabbix earns its weight when you want per-metric thresholds and escalation across many hosts.
Use the 7.0 LTS line: its server, frontend, agent2 and schema are versioned together, and it gets security fixes for years. Before copying the repository filename below, glance at the official Zabbix download page. The latest release package only configures the 7.0 repository, it does not pick a point release: apt then installs whichever 7.0.x packages the repository holds, which is how you end up on the newest one. The page may also list numbered 7.0-N release packages, but that number versions the repository setup, not the Zabbix build. Every other command here is stable across the whole 7.0 line.
Sizing, ports and prerequisites
Assume a fresh Ubuntu 24.04 KVM VPS with root or sudo. Be honest about resources: Zabbix's documented small-install example uses two vCPUs and 8 GiB of RAM for 1,000 monitored metrics. Size by collected metrics, collection intervals and retention, then benchmark your workload; host count alone does not establish a RAM requirement or when to split out the database. Disk grows with how many items you collect and how long you keep history; budget a few gigabytes to start, and the housekeeper prunes old data on the retention windows you set.
Ports: 80 and 443 for the frontend, public or restricted to your own IP. The server listens on TCP 10051 for active agents pushing data in, and each agent listens on TCP 10050 for the server polling it. Open only what you expose if a firewall sits in front. A DNS A record for the frontend is worth having, because you will want a real certificate on it, a Zabbix box watches every other service you run, so it belongs in the wider self-hosting stack worth running in 2026 rather than bolted on as an afterthought.
Step 1, Add the official Zabbix 7.0 repository
The zabbix-release package does one thing: it drops the apt source list and signing key onto your system. Install it, then refresh the index.
wget https://repo.zabbix.com/zabbix/7.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_latest_7.0+ubuntu24.04_all.deb
sudo dpkg -i zabbix-release_latest_7.0+ubuntu24.04_all.deb
sudo apt updateIf wget returns 404 Not Found, the server found no current representation at that URL or is unwilling to disclose that one exists. That does not establish that the filename moved. Open the Zabbix download page, pick Ubuntu 24.04, and copy the exact zabbix-release URL it prints. A clean apt update shows a repo.zabbix.com line and no key warning; The following signatures couldn't be verified because the public key is not available means apt cannot find the required signing key, so re-run the dpkg -i and update again.
Step 2, Install the server, frontend, and agent
Install the server built against MySQL, the PHP frontend, the nginx config, the SQL schema files, and agent2 in one go.
sudo apt install -y zabbix-server-mysql zabbix-frontend-php \
zabbix-nginx-conf zabbix-sql-scripts zabbix-agent2zabbix-server-mysql is the server compiled for MySQL/MariaDB; for PostgreSQL install zabbix-server-pgsql instead and adjust the database steps below. zabbix-sql-scripts carries the schema you import next, it is a separate package in 7.0, and forgetting it is one reason the import path turns up missing later. None of these pull in a database engine, so install MariaDB now if the box does not already have one.
sudo apt install -y mariadb-server
sudo systemctl enable --now mariadbStep 3, Create the database with the right character set
Zabbix is strict about collation: it supports only utf8mb4 with utf8mb4_bin or the older utf8 (aka utf8mb3) with utf8_bin, and its documentation strongly recommends utf8mb4 with utf8mb4_bin, which is what this guide uses. Open a root shell with sudo mysql and run:
CREATE DATABASE zabbix CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
CREATE USER zabbix@localhost IDENTIFIED BY 'choose-a-strong-password';
GRANT ALL PRIVILEGES ON zabbix.* TO zabbix@localhost;
SET GLOBAL log_bin_trust_function_creators = 1;
FLUSH PRIVILEGES;That SET GLOBAL line is a safety valve for the import. The Zabbix schema creates deterministic triggers during the import, and a non-SUPER account like zabbix needs log_bin_trust_function_creators=1 while binary logging is on; MySQL 8 enables binary logging by default. Skip the flag on a server with binary logging enabled and the import stops with ERROR 1419 (HY000): You do not have the SUPER privilege and binary logging is enabled. Setting it as root clears that; you turn it back off after the import. Note the password exactly, the server config needs the same string byte for byte.
Step 4, Import the schema (the step people skip)
This is the single most common reason a fresh frontend refuses to load: the database you created is empty. Load the schema shipped in zabbix-sql-scripts into it.
zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | \
mysql --default-character-set=utf8mb4 -uzabbix -p zabbixIt prompts for the zabbix password, runs the import, and prints nothing on success, silence is correct here. zcat: /usr/share/zabbix-sql-scripts/mysql/server.sql.gz: No such file or directory means the file cannot be found at that path; check that zabbix-sql-scripts is installed and that its schema file is present, reinstalling the package if the file is missing. ERROR 1045 (28000): Access denied for user 'zabbix'@'localhost' means login failed; check the password and the matching MySQL User and Host entries, then the database grants from Step 3. Once it finishes, turn the safety flag back off:
sudo mysql -e "SET GLOBAL log_bin_trust_function_creators = 0;"Confirm the load with sudo mysql -e "SELECT COUNT(*) FROM zabbix.users;", a number confirms that the users table is readable; also check the import output for errors before treating the schema load as complete.
Step 5, Set the database password in zabbix_server.conf
The server reads its database credentials from /etc/zabbix/zabbix_server.conf. Only the password needs setting, DBName and DBUser already default to zabbix. Uncomment the # DBPassword= line and set it:
DBName=zabbix
DBUser=zabbix
DBPassword=choose-a-strong-passwordThe password must be byte-for-byte the one from Step 3. A blank or wrong DBPassword is the top cause of the "Zabbix server is not running" banner you meet later: the daemon starts, fails to log in, and exits. Nothing on screen says so, only the log does.
Step 6, Point nginx at the frontend
The zabbix-nginx-conf package installs a server block at /etc/zabbix/nginx.conf and links it into nginx from /etc/nginx/conf.d/zabbix.conf; edit its listen and server_name directives to set the frontend's port and domain:
server {
listen 80;
server_name zabbix.example.com;
...
}Use your domain, or the server's public IP if you have no DNS yet. Two gotchas. Ubuntu's default nginx welcome site also listens on port 80 and is marked the default server, so it handles requests whose names match no server block; a request matching the Zabbix server_name selects the Zabbix block without removing the default site. And if /etc/nginx/conf.d/zabbix.conf is somehow missing, create the link by hand with sudo ln -s /etc/zabbix/nginx.conf /etc/nginx/conf.d/zabbix.conf. Then test and reload:
sudo nginx -t
sudo systemctl reload nginxnginx -t should print test is successful. If it instead prints nginx: [emerg] a duplicate default server for 0.0.0.0:80, more than one server block claims default_server for that address and port; keep only one default and re-test. A conflicting server name warning means server blocks share a name on the same listening address and port; correct that duplicate, and check that the browser's requested name matches the Zabbix block if the welcome page still loads.
Step 7, Start and enable the services
Bring up the server, the agent, PHP-FPM and nginx, and enable them so they survive a reboot.
sudo systemctl restart zabbix-server zabbix-agent2 nginx php8.3-fpm
sudo systemctl enable zabbix-server zabbix-agent2 nginx php8.3-fpmUbuntu 24.04 ships PHP 8.3, so the FPM service is php8.3-fpm; the zabbix-nginx-conf package runs its frontend under that same master. Confirm the server started and stayed up:
sudo systemctl status zabbix-server --no-pager
sudo tail -n 20 /var/log/zabbix/zabbix_server.logA healthy log ends with the server started and its housekeeper, poller and trapper processes running. If you see [Z3001] connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost', check DBPassword from Step 5 and the matching MySQL User and Host entries, correct the login details and restart. A [Z3005] query failed: [1146] Table 'zabbix.dbversion' doesn't exist line means that table is missing from the database the server connected to; check the Step 4 import for failures and confirm the server is using the intended database instance.
Step 8, Finish the web setup wizard
Browse to http://your-domain-or-ip. The Zabbix setup wizard opens. Walk through it:
- Welcome, pick a language.
- Check of pre-requisites, every row should read OK out of the box; the packaged
/etc/zabbix/php-fpm.confpool already raises the PHP limits Zabbix needs. - Configure DB connection, database type MySQL, host
localhost, port0(which means the default port or socket), database namezabbix, userzabbix, and the password from Step 3. Wrong credentials or a missing schema surface right here. - Settings, name the install and choose the default time zone and theme.
- Pre-installation summary, then Install, the wizard writes
/etc/zabbix/web/zabbix.conf.php. - Finish, log in as
Admin(capital A) with passwordzabbix, and change that password under Users immediately.
If the wizard reports Cannot create the configuration file, the web user cannot write /etc/zabbix/web/, download the zabbix.conf.php it offers, place it there by hand with sudo, and click Finish.
Step 9, Add the local host and attach a template
Zabbix ships a predefined host called Zabbix server; this walkthrough creates a separate local host. Go to Data collection → Hosts → Create host, set the host name to zabbix-server, add it to the Linux servers group, and add an Agent interface with IP 127.0.0.1, port 10050. Under Templates, link Linux by Zabbix agent (the passive-poll variant; Linux by Zabbix agent active has the agent push instead). Save.
Within a minute the host row shows a green ZBX label and metrics arrive under Monitoring → Latest data. A red ZBX label means an agent check failed; hover over it to read the error before checking connectivity and access permissions below.
Step 10, One useful trigger and an email alert
The Linux by Zabbix agent template already ships triggers for high CPU, low memory and full disks, so you have alerts the moment you link it. To see how one is built, add your own: open the host, go to Triggers → Create trigger, name it Root filesystem over 90% full on {HOST.NAME}, set severity High, and use this expression:
last(/zabbix-server/vfs.fs.dependent.size[/,pused])>90vfs.fs.dependent.size[/,pused] is the percent-used item the template's filesystem discovery creates for the root filesystem (7.0's Linux template collects vfs.fs.get once and derives per-mount dependent items), so the trigger fires with no extra data collection. Save it.
A trigger only recolours a row on the dashboard until an action notifies someone. Under Alerts → Media types → Email, set the SMTP server, port, sender address, connection security (usually STARTTLS) and any relay credentials, then use Test, a failure there means the SMTP path is wrong before any real alert depends on it. Give the Admin user an address under Users → Users → Admin → Media → Add and pick which severities notify. Then wire it under Alerts → Actions → Trigger actions → Create action: add a condition like Trigger severity >= Warning, and under Operations send to Admin via Email. Save and enable it. Prefer chat? Zabbix 7.0 ships webhook media types for Slack, Discord and Telegram, but each needs its own service setup instead of SMTP settings: Telegram, for example, wants a bot created through BotFather, its token in the media type's api_token parameter, and the recipient's chat ID in the user's Send to field. Follow the integration's README, enable the media type, assign it to a user, and use it in an action just like Email.
Monitoring a second server with the agent
To watch another server, add the Zabbix repository there too, Ubuntu 24.04 ships no Zabbix server or agent packages of its own, then install just the agent:
wget https://repo.zabbix.com/zabbix/7.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_latest_7.0+ubuntu24.04_all.deb
sudo dpkg -i zabbix-release_latest_7.0+ubuntu24.04_all.deb
sudo apt update
sudo apt install -y zabbix-agent2Edit /etc/zabbix/zabbix_agent2.conf, set Server to the Zabbix server's IP (for passive polling) and, for active checks, ServerActive plus a unique Hostname that matches the host you create in the frontend:
Server=10.0.0.10
ServerActive=10.0.0.10
Hostname=web-01Run sudo systemctl restart zabbix-agent2 and open TCP 10050 from the Zabbix server to this box. The restart matters: the package started the agent as soon as it installed, with the shipped Server=127.0.0.1, and changes to Server, ServerActive and Hostname require a restart. Agent2's userparameter_reload runtime command reloads the UserParameter and Include options while it is running. enable --now would find it already running and change nothing, so the agent would keep refusing your Zabbix server. Starting at boot is already set, because the package enabled the unit too. Back in the frontend, create a host whose Agent interface points at that machine's IP, link the Linux template, and it reports within a minute.
Failure modes, with the strings you will see
Frontend shows Error connecting to database or a database error. In the wizard's DB step, Access denied for user 'zabbix'@'localhost' (using password: YES) means login failed; check the password from Step 3, the matching MySQL User and Host entries, and the database grants. If the database connects but the frontend reports The frontend does not match Zabbix database or Table 'zabbix.users' doesn't exist, check that the frontend points at the intended database and that its schema version matches the frontend; a missing table calls for checking the Step 4 import.
Orange banner: Zabbix server is not running: the information displayed may not be current. The frontend is up but cannot reach a live server. Check these three causes. The service is dead, check systemctl status zabbix-server and start it. The service runs but cannot reach its database, the log shows [Z3001] connection to database 'zabbix' failed: [1045] Access denied, so check DBPassword and the matching MySQL User and Host entries. Or the frontend points at the wrong server, check any explicit overrides in /etc/zabbix/web/zabbix.conf.php; the generated file leaves $ZBX_SERVER and $ZBX_SERVER_PORT commented out and empty. On Ubuntu there is no SELinux by default, so the SELinux-socket cause that RHEL guides cite does not apply.
Host shows a red ZBX label; item error Get value from agent failed: cannot connect to [[127.0.0.1]:10050]: [111] Connection refused. The connection was refused; check whether the agent is running and listening, and whether a firewall is rejecting the connection with a TCP reset. Check systemctl status zabbix-agent2 and confirm ListenPort=10050. A timeout calls for checking network filtering and how long the agent check takes; user parameters are terminated when the agent check timeout is reached. The related Received empty response from Zabbix Agent. Assuming that agent dropped connection because of access permissions. calls for checking the agent log and its Server= allowlist; if the Zabbix server's IP is missing, add it and restart the agent.
Plain nginx welcome page, or 502 Bad Gateway. The welcome page means the request reached the welcome site's server block; check that the requested name matches the Zabbix server_name and confirm /etc/nginx/conf.d/zabbix.conf exists, as in Step 6. A 502 means nginx failed to obtain a valid upstream response; check its error log, confirm php8.3-fpm is running, and check that the fastcgi_pass socket in the Zabbix block matches the running pool. Upstream name-resolution failures and prematurely closed connections also produce 502 responses.
Backups, upgrades, and TLS
The database is the whole history, so back it up with mysqldump on a schedule and keep the dump off the box:
mysqldump --single-transaction zabbix | gzip > zabbix-$(date +%F).sql.gzThe /etc/zabbix config files are small and worth saving too, but they are rebuildable; the data is not. Restoring is the reverse, create the database, import the dump, point the config at it.
Upgrades within the 7.0 line are ordinary apt update && apt upgrade runs; the server applies any schema migrations on its next start, so upgrade the packages and restart zabbix-server. A future major line is a deliberate move, read its upgrade notes, dump the database first, and expect a one-way schema change. That one-way jump is exactly why you pin to an LTS line and stay on it.
Do not leave the frontend on plain HTTP. Once DNS points at the box, put a certificate on it with Certbot and Let's Encrypt on nginx for Ubuntu 24.04, which rewrites the server block to listen on 443 and redirect 80. While you are hardening a box that logs in to watch every other server you run, lock down its SSH too with fail2ban banning brute-force SSH attempts. A monitoring login should not travel in cleartext, and its front door should not sit open to password-guessers.
FAQ
Do I need the Zabbix agent, or can I monitor without it?
Both work. The agent (agent2) gives rich per-host metrics, CPU, memory, disks, processes, services, log files, and is the normal choice for servers you control. Agentless monitoring covers devices where you cannot install software: SNMP for switches and printers, ICMP ping for reachability, HTTP checks for endpoints, IPMI for hardware health. Most real deployments mix the two.
Why does the frontend say the Zabbix server is not running?
The frontend works but cannot reach a live zabbix-server process. Check the service, its database login and the frontend's server address. Run systemctl status zabbix-server and read /var/log/zabbix/zabbix_server.log; a [Z3001] connection to database ... failed line confirms a database connection failure. For an access-denied error, check DBPassword and the matching MySQL User and Host entries, correct the login details and restart.
Do I have to use MySQL, or can I use PostgreSQL?
Either is fully supported: zabbix-server-mysql with MariaDB or MySQL as this guide does, or zabbix-server-pgsql with PostgreSQL. For small installs the choice barely matters. For large ones, PostgreSQL with the TimescaleDB extension partitions the history tables and makes housekeeping far cheaper, which is why big sites lean toward it. Pick one and stay with it, migrating later means a full export and re-import, not a config switch.
How much RAM does a Zabbix all-in-one server need?
Zabbix's documented small-install example uses 8 GiB of RAM and two vCPUs for 1,000 monitored metrics. Size by collected metrics, collection intervals and retention, then benchmark your workload; there is no fixed host-count threshold for adding RAM or moving the database to its own server.
Is Zabbix overkill for a couple of servers?
It can be. If all you need is "is it up?" and a page you can share, a lighter tool like Uptime Kuma for uptime and status monitoring is faster to stand up and easier to read at a glance. Choose Zabbix when you want per-metric thresholds, historical graphs, templated hosts and escalation rules, the things a simple pinger cannot give you across a fleet.