Zabbix is an open source monitoring platform that collects metrics from agents, SNMP devices and HTTP checks, stores them in a SQL database, and raises problems when triggers fire. In this tutorial you will install Zabbix 7.0 LTS server, its web frontend on Nginx and a MySQL database on Ubuntu 24.04, secure the frontend with HTTPS, add Linux hosts with Zabbix agent 2 and the built-in Linux template, create a custom item and trigger, and receive problem notifications by email.

Prerequisites

To follow this tutorial you need:

  • A server running Ubuntu 24.04 LTS for the Zabbix server, for example a CubePath VPS, with at least 2 vCPUs, 4 GB of RAM and 40 GB of disk. That is enough for a few hundred monitored hosts.
  • A non-root user with sudo privileges and UFW enabled with SSH allowed.
  • A domain name with an A record pointing to the server, referred to as your_domain.
  • One or more Ubuntu 24.04 or Debian 12 hosts to monitor.
  • An SMTP account for sending alert emails.

This guide uses Zabbix 7.0, the current long-term support release, which receives full support until 2027 and security fixes until 2029.

Step 1 - Adding the Zabbix repository

Ubuntu's own Zabbix packages are older than 7.0, so use the official Zabbix repository. Zabbix publishes a small package that installs the repository definition and its signing key:

cd /tmp
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

Confirm that apt now sees Zabbix 7.0 packages:

apt-cache policy zabbix-server-mysql
zabbix-server-mysql:
  Installed: (none)
  Candidate: 1:7.0.31-1+ubuntu24.04
  Version table:
     1:7.0.31-1+ubuntu24.04 500
        500 https://repo.zabbix.com/zabbix/7.0/ubuntu noble/main amd64 Packages

The patch version will differ; what matters is that the candidate is 7.0.x from repo.zabbix.com.

Step 2 - Installing Zabbix server, frontend and agent

Install the server with MySQL support, the PHP frontend, its Nginx configuration, the database schema scripts and Zabbix agent 2 (so the Zabbix server can monitor itself), together with MySQL server:

sudo apt install zabbix-server-mysql zabbix-frontend-php zabbix-nginx-conf zabbix-sql-scripts zabbix-agent2 mysql-server

This pulls in Nginx and PHP-FPM 8.3 as dependencies. Check that MySQL is running:

systemctl status mysql --no-pager
● mysql.service - MySQL Community Server
     Loaded: loaded (/usr/lib/systemd/system/mysql.service; enabled; preset: enabled)
     Active: active (running) since Thu 2026-09-25 12:02:31 UTC; 1min ago

Step 3 - Creating the database

On Ubuntu, the MySQL root account authenticates through the Unix socket, so sudo mysql logs you in without a password. Open a MySQL shell:

sudo mysql

Create the database with the utf8mb4_bin collation that Zabbix requires, a dedicated user, and temporarily allow the schema import to create stored functions. Replace your_db_password with a strong password:

CREATE DATABASE zabbix CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
CREATE USER 'zabbix'@'localhost' IDENTIFIED BY 'your_db_password';
GRANT ALL PRIVILEGES ON zabbix.* TO 'zabbix'@'localhost';
SET GLOBAL log_bin_trust_function_creators = 1;
EXIT;

Import the initial schema and data. The command asks for the zabbix user's password and takes a minute or two without printing anything:

zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix

Turn the stored function setting back off, now that the import is done:

sudo mysql -e "SET GLOBAL log_bin_trust_function_creators = 0;"

Verify the import by counting the tables:

sudo mysql -e "SELECT COUNT(*) AS tables FROM information_schema.tables WHERE table_schema = 'zabbix';"
+--------+
| tables |
+--------+
|    203 |
+--------+

The exact number depends on the patch release; it should be around 200, not 0.

Step 4 - Configuring and starting Zabbix server

Tell Zabbix server how to reach the database. Open its configuration file:

sudo nano /etc/zabbix/zabbix_server.conf

Find the commented # DBPassword= line and add the password below it. DBName=zabbix and DBUser=zabbix are already set by default:

DBPassword=your_db_password

The file contains a database password, so check that it is not world-readable:

ls -l /etc/zabbix/zabbix_server.conf
-rw-r----- 1 root zabbix 26614 Sep 25 12:05 /etc/zabbix/zabbix_server.conf

Start the server and the local agent, and enable them at boot:

sudo systemctl enable --now zabbix-server zabbix-agent2

Check the server log. A healthy start lists the database version check and the started processes, without cannot connect errors:

sudo tail -n 20 /var/log/zabbix/zabbix_server.log
  4213:20260925:120712.418 current database version (mandatory/optional): 07000000/07000000
  4213:20260925:120712.418 required mandatory version: 07000000
  4213:20260925:120712.520 server #0 started [main process]
  ...

Confirm the server listens on port 10051, where agents in active mode connect:

sudo ss -ltnp | grep 10051

Step 5 - Configuring Nginx for the frontend

The zabbix-nginx-conf package installs a server block in /etc/zabbix/nginx.conf and links it into Nginx's conf.d directory, but its listen and server_name lines are commented out. Edit it:

sudo nano /etc/zabbix/nginx.conf

Uncomment the first two lines of the server block and set them like this:

server {
        listen          80;
        server_name     your_domain;

Leave the rest of the file unchanged. Because Ubuntu's default Nginx site also listens on port 80, disable it so requests for your_domain reach Zabbix:

sudo rm /etc/nginx/sites-enabled/default
sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Restart Nginx and PHP-FPM so both pick up the Zabbix configuration (the frontend package ships its own PHP-FPM pool with the required PHP settings):

sudo systemctl restart nginx php8.3-fpm
sudo systemctl enable nginx php8.3-fpm

Open HTTP and HTTPS, and port 10051 for agents that will run in active mode:

sudo ufw allow 'Nginx Full'
sudo ufw allow 10051/tcp

Step 6 - Enabling HTTPS

The frontend login form must not travel over plain HTTP. Install Certbot and request a Let's Encrypt certificate; the Nginx plugin adds TLS to the Zabbix server block and redirects HTTP to HTTPS:

sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d your_domain

When Certbot prints Successfully deployed certificate, check automatic renewal:

sudo certbot renew --dry-run

Step 7 - Completing the web installer

Open https://your_domain in your browser. The Zabbix installer walks you through a few screens:

  1. Welcome: choose the default language and click Next step.
  2. Check of pre-requisites: every line should show OK. If something fails, the fix is almost always a PHP setting in /etc/zabbix/php-fpm.conf followed by sudo systemctl restart php8.3-fpm.
  3. Configure DB connection: leave Database type as MySQL, Database host as localhost and Database port as 0 (default). Enter zabbix as database name and user, and your_db_password as the password. Leave Database TLS encryption off, since the connection is local.
  4. Settings: set a Zabbix server name (shown in the page title) and your Default time zone.
  5. Pre-installation summary: review and click Next step. The installer writes /etc/zabbix/web/zabbix.conf.php.

Click Finish and log in with the default credentials: user Admin, password zabbix.

Change that password immediately: go to User settings > Profile (the user icon at the bottom of the left menu), click Change password, and set a strong one.

Go to Reports > System information. Zabbix server is running must show Yes, and the host Zabbix server appears under Monitoring > Hosts with a green ZBX availability icon after a minute, thanks to the local agent.

Step 8 - Installing Zabbix agent 2 on a monitored host

Run these commands on each server you want to monitor. Add the same Zabbix repository and install only the agent:

cd /tmp
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 zabbix-agent2

On Debian 12, download the package for Debian instead: https://repo.zabbix.com/zabbix/7.0/debian/pool/main/z/zabbix-release/zabbix-release_latest_7.0+debian12_all.deb.

Edit the agent configuration:

sudo nano /etc/zabbix/zabbix_agent2.conf

Set these three parameters, replacing your_zabbix_server_ip with the Zabbix server's IP address and web-01 with a unique name for this host:

Server=your_zabbix_server_ip
ServerActive=your_zabbix_server_ip
Hostname=web-01
  • Server lists the IPs allowed to query the agent in passive mode (the server connects to the agent on port 10050).
  • ServerActive is where the agent sends data in active mode (the agent connects to the server on port 10051).
  • Hostname must match the host name you create in the frontend exactly, or active checks are rejected.

Allow the Zabbix server to reach the agent, then restart and enable it:

sudo ufw allow from your_zabbix_server_ip to any port 10050 proto tcp
sudo systemctl restart zabbix-agent2
sudo systemctl enable zabbix-agent2

From the Zabbix server, test the connection with zabbix_get:

sudo apt install zabbix-get
zabbix_get -s web01_ip -k agent.ping
1

A 1 means the server can query the agent. A timeout means the firewall blocks port 10050; an error that mentions access restrictions means the server's IP is missing from Server= on the agent.

Step 9 - Adding the host with the Linux template

In the frontend, go to Data collection > Hosts and click Create host:

  1. Host name: web-01, identical to Hostname in the agent configuration.
  2. Templates: click Select, open the Templates/Operating systems group and choose Linux by Zabbix agent.
  3. Host groups: select Linux servers.
  4. Interfaces: click Add > Agent and enter the host's IP address, port 10050.
  5. Click Add.

The template brings in about a hundred items (CPU, memory, filesystems, network interfaces discovered automatically), triggers such as High CPU utilization and Filesystem space is critically low, and graphs. After a minute the ZBX icon turns green. Go to Monitoring > Latest data, filter by host web-01, and you should see values arriving.

Step 10 - Creating a custom item and trigger

Templates cover the basics; for anything else, you can add your own metric with a UserParameter, which maps an item key to a shell command on the agent. As an example, monitor the number of logged-in users.

On the monitored host, check that the agent includes the zabbix_agent2.d directory:

grep '^Include' /etc/zabbix/zabbix_agent2.conf
Include=/etc/zabbix/zabbix_agent2.d/*.conf
Include=./zabbix_agent2.d/plugins.d/*.conf

If the first line is missing, add it to the end of the file. Then create a file for your parameters:

sudo nano /etc/zabbix/zabbix_agent2.d/custom.conf
UserParameter=custom.users.logged_in,who | wc -l

Test the key locally, then restart the agent so it loads the new parameter:

sudo zabbix_agent2 -t custom.users.logged_in
sudo systemctl restart zabbix-agent2
custom.users.logged_in                        [s|1]

In the frontend, go to Data collection > Hosts, click Items next to web-01, then Create item:

  • Name: Logged-in users
  • Type: Zabbix agent
  • Key: custom.users.logged_in
  • Type of information: Numeric (unsigned)
  • Update interval: 1m

Click Add, and use Test in the item form or Monitoring > Latest data to see the value.

Now create a trigger on it. From the same host, open Triggers > Create trigger:

  • Name: Too many users logged in on {HOST.NAME}
  • Severity: Warning
  • Expression:
last(/web-01/custom.users.logged_in)>5

Click Add. The expression reads the last value of the item on host web-01 and opens a problem when it exceeds 5. To reuse the item and trigger on many hosts, create them in a template instead of on the host and link that template to every server.

Step 11 - Sending problem notifications by email

Notifications need three things: a configured media type, a media address on a user, and an action that decides which problems are sent.

Configure the email media type:

  1. Go to Alerts > Media types and open Email.
  2. Set SMTP server, SMTP server port (usually 587), SMTP helo (your domain) and SMTP email (the sender address).
  3. Set Connection security to STARTTLS and Authentication to Username and password, and enter your SMTP credentials.
  4. Make sure Enabled is checked, click Update, then use Test on the media type list to send a test message.

Give a user an address to receive alerts:

  1. Go to Users > Users and open Admin (or your own user).
  2. On the Media tab click Add, choose Email, enter the address, keep Use if severity at the severities you care about, and click Add, then Update.

Enable an action that sends problems:

  1. Go to Alerts > Actions > Trigger actions.
  2. Open the built-in Report problems to Zabbix administrators action, which sends to the Zabbix administrators user group that Admin belongs to.
  3. On the Action tab, check Enabled and click Update.

To test the whole chain, stop the agent on the monitored host:

sudo systemctl stop zabbix-agent2

After a few minutes, Monitoring > Problems shows Linux: Zabbix agent is not available for web-01, and an email arrives. Start the agent again and a recovery email follows:

sudo systemctl start zabbix-agent2

Troubleshooting

The frontend shows "Zabbix server is not running". Check sudo systemctl status zabbix-server and /var/log/zabbix/zabbix_server.log. The usual cause is a wrong DBPassword in /etc/zabbix/zabbix_server.conf.

The host's ZBX icon is red with "Get value from agent failed: cannot connect". The server cannot reach port 10050 on the host. Test with zabbix_get -s web01_ip -k agent.ping and check UFW on the host.

Active checks fail with "host not found". The Hostname in zabbix_agent2.conf does not match the host name in the frontend. They are case-sensitive.

Items show "Not supported". Hover over the red icon in the item list to see the reason. For a UserParameter, run sudo zabbix_agent2 -t <key> on the host; the command runs as the zabbix user, so it must not need root privileges.

Conclusion

You installed Zabbix 7.0 LTS with MySQL and Nginx on Ubuntu 24.04, protected the frontend with HTTPS, added a Linux host with Zabbix agent 2 and the built-in template, extended monitoring with a custom item and trigger, and enabled email notifications. Next, use network discovery or agent autoregistration (Alerts > Actions > Autoregistration actions) to add hosts automatically, monitor switches and routers with the SNMP templates, and tune data retention under Administration > Housekeeping as your database grows.