Skip to content
Tutorials Center
My learning

Topics

Lesson 3 of 37 ยท Getting Started

Installing the Zabbix Server on Linux: Packages, Database and Frontend

Step-by-step Zabbix 7.0 LTS server installation on Ubuntu or Debian: repository, MySQL database, schema import, zabbix_server.conf, nginx frontend and a setup checklist.

This lesson walks through a complete installation of the Zabbix server on a single Linux machine, using Ubuntu or Debian packages, MySQL and nginx. The same steps work for other databases and distributions with different package names. Use the official Zabbix download page to get the exact repository package URL for your distribution and version, because it changes with every release.

Zabbix cannot be installed on this site. The commands below are shown read-only and were written from the official installation procedure for the 7.0 LTS line; check them against the current documentation before you run them on a production machine. The TryIt blocks are stand-ins that check your plan, not the installer.

Requirements

  • A 64-bit Linux server. For a lab, 2 CPU cores, 4 GB RAM and 20 GB of disk are plenty. Real sizing depends on NVPS (see what is monitoring).
  • A supported database: MySQL 8.0+, MariaDB 10.5+, PostgreSQL 13+.
  • Root access (or sudo), correct time (NTP), and a resolvable hostname.
  • Ports 80/443 (frontend), 10051 (server) open as needed.

Step 1: add the Zabbix repository

Download the zabbix-release package for your OS from the official site, then install it and refresh the package list. The package adds the Zabbix apt repository.

Terminal
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

The file name encodes the Zabbix version (7.0) and the distribution (ubuntu24.04). Pick the one that matches your system.

Step 2: install the packages

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

Each package has one job:

Package Purpose
zabbix-server-mysql The server, built for MySQL/MariaDB
zabbix-frontend-php The PHP web interface
zabbix-nginx-conf A ready nginx configuration for the frontend
zabbix-sql-scripts The initial schema and data
zabbix-agent2 An agent to monitor the Zabbix server itself

Apache users install zabbix-apache-conf instead of the nginx one.

Step 3: create the database

Install MySQL or MariaDB (sudo apt install mysql-server), then:

SQL
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;

Two details matter. The character set must be utf8mb4 with the utf8mb4_bin collation, because Zabbix compares strings case-sensitively. And log_bin_trust_function_creators must be on while importing the schema if binary logging is enabled; turn it off again afterwards.

Step 4: import the initial schema

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

The import takes a minute or two. It creates about 180 tables and the default objects: the user Admin, templates, host groups and media types. Then disable the temporary setting:

SQL
SET GLOBAL log_bin_trust_function_creators = 0;

Step 5: configure the server

Edit /etc/zabbix/zabbix_server.conf and set at least the database password:

INI
DBName=zabbix
DBUser=zabbix
DBPassword=choose-a-strong-password
# DBHost=localhost  (default, uses the Unix socket)

Other useful settings: LogFile, StartPollers, CacheSize. Lines starting with # are comments. Each setting is one Name=value per line.

For nginx, edit /etc/zabbix/nginx.conf and uncomment listen 8080; and server_name example.com; (or keep the defaults and remove the default nginx site).

Step 6: start the services

Terminal
sudo systemctl restart zabbix-server zabbix-agent2 nginx php8.3-fpm
sudo systemctl enable zabbix-server zabbix-agent2 nginx php8.3-fpm

Check the log if the server does not start:

Terminal
sudo tail -n 50 /var/log/zabbix/zabbix_server.log

A healthy start ends with lines such as server #1 started [main process] and a list of started pollers.

Step 7: finish in the web installer

Open http://your-server/ (or the port you configured). The setup wizard shows:

  1. Welcome: choose the language.
  2. Check of pre-requisites: all rows must say OK (PHP version, memory limit, post_max_size, extensions).
  3. Configure DB connection: database type, host, port, name, user, password. Test the connection.
  4. Settings: the Zabbix server name (shown in the page header), default time zone and theme.
  5. Pre-installation summary: review, then Next step.
  6. Install: the wizard writes /etc/zabbix/web/zabbix.conf.php.

Then log in with the default account Admin and password zabbix. Change that password immediately.

Common installation problems

  • PHP time zone not set: set date.timezone in the PHP-FPM pool configuration.
  • "Cannot connect to database": wrong password, wrong host, or SELinux blocking the connection (setsebool -P httpd_can_network_connect_db on).
  • Schema import error "You do not have the SUPER privilege and binary logging is enabled": set log_bin_trust_function_creators as shown above.
  • Frontend shows "Zabbix server is not running": the server is stopped, DBPassword is wrong, or port 10051 is blocked. Read the server log.

A pre-flight checklist stand-in

The stand-in below checks an installation plan the way you would check it by eye. It is only Python logic, but it captures the rules of this lesson.

Python Stand-in: installation plan checker

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Installing with containers

Zabbix publishes container images (zabbix/zabbix-server-mysql, zabbix/zabbix-web-nginx-mysql, zabbix/zabbix-agent2). A Compose file wires them together with a MySQL container. It is the fastest way to build a lab, while packages are common in production. The configuration options become environment variables, for example DB_SERVER_HOST and MYSQL_PASSWORD.

Upgrades and backups

To upgrade, install the new repository package, upgrade the packages, and restart the server. The server upgrades the database schema on first start (it can take a long time on big databases, so read the release notes). Always back up the database first with mysqldump or a snapshot, plus /etc/zabbix.

Python Stand-in: size of the first backup

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The 90 bytes per value is a rough planning figure, not a guarantee; real size depends on the database and value types.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which collation does Zabbix require for the database?

    utf8mb4_bin makes comparisons case-sensitive, which Zabbix expects.
  2. 2. What are the default frontend credentials after installation?

    The built-in user is Admin with password zabbix. Change it at once.
  3. 3. Where do you put the database password for the server?

    The server reads DBName, DBUser and DBPassword from zabbix_server.conf.
  4. 4. The frontend says the server is not running. Where do you look first?

    The server log states why the server could not start or connect to the database.

Summary

  • Install the repository package, then server, frontend, web server conf, SQL scripts and an agent.
  • Create the database as utf8mb4 / utf8mb4_bin, import server.sql.gz, set DBPassword.
  • Start services, then finish the setup wizard; log in as Admin / zabbix and change the password.
  • Logs live in /var/log/zabbix/.
  • Containers are a quick way to get a lab.

Next: Frontend tour and first login