*Cube-Host– full cloud services!!

Installation and initial configuration of the Zabbix monitoring server on Ubuntu Server

Server monitoring and alerting concept

Prepare Ubuntu for reliable monitoring

Zabbix is a full-featured monitoring platform that can track servers, network devices, applications, logs, and business metrics, then alert you when something is wrong (before users notice). In this guide, you’ll deploy a production-ready Zabbix stack on Ubuntu Server with a database + web interface, then do the “first 30 minutes” of hardening and initial setup.

What this tutorial covers: installing the latest Zabbix packages on Ubuntu Server (recommended: Ubuntu 24.04 LTS), configuring MariaDB, configuring NGINX/PHP-FPM for the frontend, starting services, opening the right ports, and connecting your first host with encrypted agent traffic. If you’re deploying on a fresh Linux VPS, this flow is especially smooth because you control firewall, PHP version, and server resources end-to-end.

Before you start: versions, sizing, and a quick checklist

  • OS: Ubuntu Server 24.04 LTS is the most convenient baseline for current Zabbix releases.
  • CPU/RAM: for a small environment (up to ~50 hosts) start with 2 vCPU / 2–4 GB RAM; grow as you add items, history, and dashboards.
  • Disk: SSD strongly recommended. Monitoring databases grow fast; plan for 20–50 GB minimum and revisit after a week of real data.
  • Network: stable connectivity to monitored hosts; decide whether checks are passive (server → agent) or active (agent → server).
  • Access: sudo privileges, and (ideally) a DNS name like monitor.your-domain.com for HTTPS later.
PortWho listensWhy it’s neededTypical firewall rule
80/tcpNGINXWeb UI (HTTP)Allow from your IPs (or everyone if public)
443/tcpNGINXWeb UI (HTTPS)Allow from your IPs (recommended)
10051/tcpZabbix serverTrappers, proxies, active agentsAllow from proxies/agents that use active checks
10050/tcpZabbix agent (on monitored hosts)Passive checks (server polls agent)Allow on monitored hosts, not necessarily on the Zabbix server

Step 1: base server preparation

Start with updates, correct time, and a clean baseline. Accurate time matters because Zabbix correlates events, trends, and alerts by timestamps.

sudo apt update
sudo apt -y upgrade

# Set timezone (example: Europe/Berlin)
sudo timedatectl set-timezone Europe/Berlin

# Time sync (Chrony is a solid default on servers)
sudo apt -y install chrony
sudo systemctl enable --now chrony

# Optional but recommended: basic tools
sudo apt -y install curl wget gnupg lsb-release unzip

Tip for VPS: if you’re running Zabbix on VPS hosting, use provider-side monitoring too (CPU/RAM/Disk graphs in the control panel). It helps you understand whether Zabbix alerts are caused by the host itself or by the application inside the VPS.

Step 2: install and secure the database (MariaDB)

Zabbix stores configuration + metrics in a database. MariaDB is a popular choice for Linux monitoring stacks. For small/medium installations it’s fast, predictable, and easy to maintain.

sudo apt -y install mariadb-server
sudo systemctl enable --now mariadb

# Basic hardening wizard (set root password, remove test DB, etc.)
sudo mysql_secure_installation

Create the Zabbix database and a dedicated user. Use a strong password (treat it like a production secret).

sudo mysql -uroot -p

CREATE DATABASE zabbix CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
CREATE USER 'zabbix'@'localhost' IDENTIFIED BY 'REPLACE_WITH_STRONG_PASSWORD';
GRANT ALL PRIVILEGES ON zabbix.* TO 'zabbix'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Step 3: install NGINX + PHP-FPM for the web interface

Zabbix frontend is a PHP application. The easiest approach on Ubuntu is NGINX + PHP-FPM. We’ll also install Certbot later (optional) to enable HTTPS.

sudo apt -y install nginx php-fpm
sudo systemctl enable --now nginx

Now tune a few PHP parameters that often cause “requirements not met” warnings in the Zabbix installer (timezone and input limits). Your PHP version may differ (Ubuntu 24.04 usually uses PHP 8.3).

# Find your installed PHP-FPM version directory
ls /etc/php/

# Example for PHP 8.3:
sudo nano /etc/php/8.3/fpm/php.ini

# Set/verify:
# date.timezone = Europe/Berlin
# max_execution_time = 300
# max_input_time = 300
# post_max_size = 16M
# max_input_vars = 10000

sudo systemctl restart php8.3-fpm

Step 4: install the latest Zabbix server packages

Zabbix provides official repositories for Ubuntu. The standard pattern is: install the zabbix-release package, refresh APT, then install server + frontend + SQL scripts + agent.

Note: if your company prefers long-term stability, choose the latest LTS branch. If you prefer the newest features and improvements, choose the latest stable branch. The installation flow is the same — the repository link changes.

# Example: Zabbix 7.4 repository for Ubuntu 24.04 (adjust version if needed)
cd /tmp
wget https://repo.zabbix.com/zabbix/7.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_7.4-1+ubuntu24.04_all.deb
sudo dpkg -i zabbix-release_7.4-1+ubuntu24.04_all.deb

sudo apt update

# Install Zabbix server + frontend + NGINX config + SQL scripts + Agent 2
sudo apt -y install zabbix-server-mysql zabbix-frontend-php zabbix-nginx-conf zabbix-sql-scripts zabbix-agent2

Step 5: import the initial schema into the Zabbix database

This step creates tables and baseline data Zabbix needs. It can take a few minutes depending on disk speed.

# Import schema (recommended: use zcat to avoid manual unpacking)
zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql -uzabbix -p zabbix

If import fails, check the error message. Common causes: wrong password, not enough disk space, or MySQL/MariaDB settings that are too strict for your environment.

Step 6: configure Zabbix server connection to the database

Open the server config and set the DB password you created earlier.

sudo nano /etc/zabbix/zabbix_server.conf

# Set:
# DBPassword=REPLACE_WITH_STRONG_PASSWORD

Performance tip: once you monitor more hosts, you’ll likely tune values like CacheSize and StartPollers. Don’t optimize blindly on day one — measure first (CPU, DB load, queue size), then adjust.

Step 7: configure NGINX for the Zabbix frontend

With zabbix-nginx-conf, Zabbix ships an NGINX site template. Update the server name (your domain) and ensure the PHP-FPM socket/version matches your system.

sudo nano /etc/zabbix/nginx.conf

# Common edits:
# listen 80;
# server_name monitor.your-domain.com;
# (and verify the PHP-FPM socket path if your distro differs)

Then restart NGINX:

sudo systemctl restart nginx

Step 8: start services and verify the stack

sudo systemctl enable --now zabbix-server zabbix-agent2
sudo systemctl status zabbix-server --no-pager
sudo systemctl status zabbix-agent2 --no-pager

If Zabbix server does not start, immediately check logs:

sudo tail -n 200 /var/log/zabbix/zabbix_server.log

Step 9: open firewall ports the safe way

On Ubuntu, UFW is often the simplest option. Ideally, limit the web interface to your office/VPN IPs and limit port 10051 to known proxies/agents.

sudo apt -y install ufw
sudo ufw allow OpenSSH
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp

# Zabbix server port (only if you use proxies/active agents from outside)
sudo ufw allow 10051/tcp

sudo ufw enable
sudo ufw status

Step 10: finish setup in the web installer and secure the admin account

Open in a browser:

http://SERVER_IP/
# or
http://monitor.your-domain.com/

Follow the Zabbix installer steps, point it to your MariaDB database, then log in. Immediately change the default admin password, create a separate admin user for yourself, and keep the original “Admin” account as an emergency account (or disable it if your policy requires).

Step 11: connect your first host (Agent 2) with encryption

Zabbix Agent 2 is the modern agent with plugin support and better extensibility. On the same server, you can enable PSK encryption so metrics are not sent in plain text.

On the agent (this server): generate a PSK file and update agent settings.

sudo openssl rand -hex 32 | sudo tee /etc/zabbix/agent2.psk > /dev/null
sudo chmod 600 /etc/zabbix/agent2.psk

sudo nano /etc/zabbix/zabbix_agent2.conf

# Set/verify:
# Server=127.0.0.1
# ServerActive=127.0.0.1
# TLSConnect=psk
# TLSAccept=psk
# TLSPSKIdentity=PSK-LOCAL-001
# TLSPSKFile=/etc/zabbix/agent2.psk

sudo systemctl restart zabbix-agent2

In the Zabbix UI: go to Data collection → Hosts, open your host, then set the interface to Agent and configure Encryption with the same PSK identity and the PSK value (contents of /etc/zabbix/agent2.psk). Attach a Linux template (for example, “Linux by Zabbix agent”) and confirm data starts flowing.

Optional: enable HTTPS with a free SSL certificate

Even for internal monitoring, HTTPS is worth it (credentials and dashboards should not travel unencrypted). If your Zabbix UI is reachable via a domain name, you can issue a certificate with Let’s Encrypt.

sudo apt -y install certbot python3-certbot-nginx
sudo certbot --nginx -d monitor.your-domain.com

If you’re still choosing server software for your monitoring stack, also read about Linux VPS options and consider whether your environment needs Windows-specific tooling (in that case, a Windows VPS may be a better fit).

Troubleshooting checklist (fast fixes for common failures)

  • Zabbix server won’t start: verify DB password in /etc/zabbix/zabbix_server.conf, verify schema import completed, check /var/log/zabbix/zabbix_server.log.
  • Web UI shows 502 Bad Gateway: mismatch between NGINX config and PHP-FPM socket/version. Confirm running service (systemctl status php8.3-fpm) and update socket path.
  • Installer complains about PHP settings: set timezone and increase limits in php.ini, then restart PHP-FPM.
  • No data from agent: check firewall direction (passive vs active checks), confirm agent is running, verify host interface IP/DNS in Zabbix UI.
  • Disk fills up quickly: tune history/trends retention, enable housekeeping strategy, consider partitioning or moving DB to a separate disk.

What to do next to make monitoring truly “production-grade”

  • Set up database backups (daily) and test restores.
  • Limit UI access with firewall rules or VPN.
  • Enable alerting routes (email/Telegram/etc.) and test a full incident flow.
  • Add a Zabbix Proxy for remote sites to reduce WAN dependency.
  • Monitor the monitoring: CPU/RAM/IO on the Zabbix VPS itself.
Prev
Menu