Skip to main content
monitoring Intermediate Level 9 min read

How to Install and Configure Zabbix to Monitor Linux Servers

Step-by-step guide to installing and configuring Zabbix 7.0 LTS / 6.0 LTS on Linux servers with database setup, web frontend, agent deployment, and automated alerts.

SC
ServerCare360 Systems Team
Linux & Infrastructure Engineering
Published: Sep 6, 2026

Infrastructure monitoring is critical for maintaining high availability across production server fleets. Zabbix is an enterprise-grade, open-source monitoring platform that collects telemetry metrics, evaluates trigger thresholds, and dispatches real-time alerts when hardware or application services degrade.

Production Note: Monitoring becomes truly useful when it alerts you to disk space exhaustion, CPU core saturation, and flapping services before your end customers notice an outage. This guide covers deploying Zabbix Server with PostgreSQL or MySQL and configuring Zabbix Agent on monitored Linux nodes.

At a Glance

  1. Configure the official Zabbix repository on your Linux server.
  2. Install Zabbix Server, web frontend, and database backend packages.
  3. Create the database, database user, and import initial schema.
  4. Configure database credentials in zabbix_server.conf.
  5. Start Zabbix Server, web server (Nginx/Apache), and PHP-FPM services.
  6. Complete the initial web setup wizard at http://your-server-ip/zabbix.
  7. Install and configure zabbix-agent2 on client Linux servers.
  8. Add client hosts in Zabbix and assign the Linux by Zabbix Agent template.
  9. Verify telemetry data in the Latest Data view.

Zabbix Architecture Overview

A standard Zabbix deployment consists of four core components:

  • Zabbix Server: The central polling and metric processing engine that evaluates alert triggers.
  • Database Storage: Relational database (PostgreSQL with TimescaleDB or MySQL/MariaDB) storing configuration and time-series historical data.
  • Web Frontend: PHP-based graphical dashboard for managing hosts, viewing graphs, and configuring triggers.
  • Zabbix Agent (or Agent 2): Lightweight daemon installed on monitored Linux nodes to report CPU, memory, disk, network, and process metrics.
Monitored Linux Node                     Zabbix Core Server
+------------------------+              +------------------------+
|  Zabbix Agent 2        |  TCP 10050   |  Zabbix Server         |
|  (CPU, RAM, Disk, Net) | <----------> |  (Polling & Triggers)  |
+------------------------+              +-----------+------------+
                                                    |
                                        +-----------v------------+
                                        | Database (MySQL/PgSQL) |
                                        +-----------+------------+
                                                    |
                                        +-----------v------------+
                                        | Web UI (Nginx/PHP-FPM) |
                                        +------------------------+

Prerequisites

Before starting, ensure you have:

  • A dedicated Linux server for the Zabbix Server (minimum 2 vCPUs, 4GB RAM, 40GB SSD).
  • Root or sudo administrative privileges.
  • Static public IP address with DNS record configured.
  • Firewall access to open TCP port 10051 (Zabbix Server trapper) and TCP port 10050 (Zabbix Agent).

Step 1: Add Official Zabbix Repositories

Configure the official Zabbix 7.0 LTS repository for your specific Linux distribution:

For Ubuntu 24.04 / 22.04 LTS:

# Download and install Zabbix repository package
wget https://repo.zabbix.com/zabbix/7.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_latest_7.0+ubuntu24.04_all.deb
dpkg -i zabbix-release_latest_7.0+ubuntu24.04_all.deb
apt update

For AlmaLinux 9 / Rocky Linux 9 / RHEL 9:

# Install Zabbix RPM repository
rpm -Uvh https://repo.zabbix.com/zabbix/7.0/rhel/9/x86_64/zabbix-release-latest-7.0.el9.noarch.rpm
dnf clean all

Step 2: Install Zabbix Server, Frontend, and Agent Packages

Install Zabbix Server with PostgreSQL or MySQL backend support:

For Ubuntu / Debian (PostgreSQL + Nginx):

apt install -y zabbix-server-pgsql zabbix-frontend-php php8.3-pgsql zabbix-nginx-conf zabbix-sql-scripts zabbix-agent2 postgresql postgresql-contrib

For AlmaLinux / RHEL 9 (MariaDB + Nginx):

dnf install -y zabbix-server-mysql zabbix-web-mysql zabbix-nginx-conf zabbix-sql-scripts zabbix-agent2 mariadb-server

Step 3: Create and Initialize the Database

Option A: Configuring PostgreSQL Backend (Ubuntu/Debian)

# Start and enable PostgreSQL
systemctl enable --now postgresql

# Create zabbix database user and database
sudo -u postgres createuser --pwprompt zabbix
sudo -u postgres createdb -O zabbix zabbix

# Import initial Zabbix database schema
zcat /usr/share/zabbix-sql-scripts/postgresql/server.sql.gz | sudo -u zabbix psql zabbix

Option B: Configuring MariaDB Backend (RHEL/AlmaLinux)

# Start and enable MariaDB
systemctl enable --now mariadb

# Create database and grant privileges
mysql -u root -e "create database zabbix character set utf8mb4 collate utf8mb4_bin;"
mysql -u root -e "create user 'zabbix'@'localhost' identified by 'StrongZabbixPassword123!';"
mysql -u root -e "grant all privileges on zabbix.* to 'zabbix'@'localhost';"
mysql -u root -e "set global log_bin_trust_function_creators = 1;"

# Import initial database schema
zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -pStrongZabbixPassword123! zabbix

# Reset trust function setting
mysql -u root -e "set global log_bin_trust_function_creators = 0;"

Step 4: Configure Zabbix Server Daemon

Edit /etc/zabbix/zabbix_server.conf to set your database password:

nano /etc/zabbix/zabbix_server.conf

Locate the DBPassword directive and configure your database password:

DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=StrongZabbixPassword123!

Save the file and exit.


Step 5: Configure Nginx / Apache Web Server Configuration

Edit /etc/zabbix/nginx.conf (or /etc/nginx/conf.d/zabbix.conf) to configure the listening port and server name:

nano /etc/zabbix/nginx.conf

Uncomment and configure:

listen 80;
server_name zabbix.yourdomain.com;

Step 6: Start Services and Configure Firewall Rules

Start and enable the Zabbix Server, web server, and PHP-FPM daemons:

# On Ubuntu/Debian:
systemctl restart zabbix-server zabbix-agent2 nginx php8.3-fpm
systemctl enable zabbix-server zabbix-agent2 nginx php8.3-fpm

# On AlmaLinux/RHEL:
systemctl restart zabbix-server zabbix-agent2 nginx php-fpm
systemctl enable zabbix-server zabbix-agent2 nginx php-fpm

Open required firewall ports:

# For Firewalld (AlmaLinux/RHEL):
firewall-cmd --permanent --add-port=10051/tcp  # Zabbix Server Trapper
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --reload

# For UFW (Ubuntu/Debian):
ufw allow 10051/tcp
ufw allow 80/tcp
ufw allow 443/tcp
ufw reload

Step 7: Complete Web Setup Wizard & Secure Default Credentials

  1. Open your web browser and navigate to http://zabbix.yourdomain.com (or http://YOUR_SERVER_IP).
  2. Verify that all PHP prerequisite checks display OK.
  3. Enter your database connection details (Database Host: localhost, Name: zabbix, User: zabbix, Password: configured password).
  4. Complete the installation steps.
  5. Log in with the default credentials:
    • Username: Admin
    • Password: zabbix
  6. Immediately Change Default Password: Navigate to User settings >> Profile >> Password and update the Admin password to a strong secret.

Step 8: Install and Configure Zabbix Agent on Monitored Linux Hosts

On each remote Linux server you want to monitor:

# On the remote server (Ubuntu/Debian):
wget https://repo.zabbix.com/zabbix/7.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_latest_7.0+ubuntu24.04_all.deb
dpkg -i zabbix-release_latest_7.0+ubuntu24.04_all.deb
apt update && apt install -y zabbix-agent2

# On the remote server (AlmaLinux/RHEL):
rpm -Uvh https://repo.zabbix.com/zabbix/7.0/rhel/9/x86_64/zabbix-release-latest-7.0.el9.noarch.rpm
dnf install -y zabbix-agent2

Edit /etc/zabbix/zabbix_agent2.conf on the remote host:

Server=ZABBIX_SERVER_IP
ServerActive=ZABBIX_SERVER_IP
Hostname=web-server-01.yourdomain.com

Start the agent and allow port 10050:

systemctl enable --now zabbix-agent2

# Allow Zabbix Server IP on port 10050:
# Firewalld:
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="ZABBIX_SERVER_IP" port port="10050" protocol="tcp" accept'
firewall-cmd --reload

Step 9: Add Monitored Host in Zabbix Web UI

  1. In the Zabbix dashboard, navigate to Data collection >> Hosts.
  2. Click Create host in the top right corner.
  3. Fill in the host details:
    • Host name: web-server-01.yourdomain.com (must match Hostname in zabbix_agent2.conf).
    • Templates: Select Linux by Zabbix agent.
    • Host groups: Select Linux servers.
    • Interfaces: Click Add >> Agent, enter the remote server IP and Port 10050.
  4. Click Add.

Within 60 seconds, the ZBX availability icon will turn green.


Troubleshooting

Problem: “ZBX icon is red: Get value from agent failed: Connection refused”

Possible cause: Zabbix Agent service is not running on the target machine, or host firewall blocks port 10050.

Check:

# On the monitored client:
systemctl status zabbix-agent2
ss -tulpn | grep :10050

Solution: Start zabbix-agent2 and verify the firewall rule permits the Zabbix Server IP.

Problem: “Zabbix Server daemon is not running: Refusing connection on /tmp/zabbix_server.sock”

Possible cause: Zabbix server cannot connect to the database backend due to incorrect credentials or missing database permissions.

Check:

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

Solution: Verify that DBPassword in /etc/zabbix/zabbix_server.conf matches the database password tested via command line:

psql -h localhost -U zabbix -d zabbix
# or
mysql -u zabbix -p -h localhost zabbix

Problem: “SELinux is preventing zabbix_server from connecting to the network”

Possible cause: On RHEL/AlmaLinux, default SELinux booleans prevent Zabbix from establishing outbound TCP and database connections.

Check:

getenforce

Solution: Enable required SELinux booleans:

setsebool -P zabbix_can_network on
setsebool -P httpd_can_network_connect on
setsebool -P httpd_can_network_connect_db on

Verify the Configuration

Test connectivity directly from the Zabbix Server CLI using zabbix_get:

# Query agent ping from the Zabbix server
zabbix_get -s TARGET_SERVER_IP -p 10050 -k agent.ping

Expected output:

1

A return value of 1 confirms that the agent daemon is communicating and sending telemetry data.

In the Web UI, go to Monitoring >> Latest data, filter by your host, and verify live CPU, memory, filesystem, and network interface values.


Production Checklist

  • Official Zabbix repository installed on server and client nodes.
  • Database created with UTF-8 encoding and schema imported cleanly.
  • Configured database credentials in zabbix_server.conf.
  • Nginx/Apache and PHP-FPM running with valid timezone settings.
  • Default Admin password changed immediately after first login.
  • Firewall ports 10051 (Server) and 10050 (Agent) restricted to authorized IPs.
  • Zabbix Agent 2 installed and enabled on remote client hosts.
  • Verified green ZBX indicator and checked live metrics in Latest Data.

Frequently Asked Questions

What is the difference between Zabbix Agent and Zabbix Agent 2?

Zabbix Agent 2 is written in Go, supports asynchronous concurrent polling, and features a flexible plugin architecture with lower memory overhead than the legacy C-based Zabbix Agent.

Can Zabbix monitor servers across different cloud providers?

Yes. You can monitor servers across AWS, Hetzner, DigitalOcean, and on-premise environments using passive agent polling or active agent mode (where agents push metrics outbound to Zabbix Server port 10051).

Does Zabbix require a dedicated agent on every server?

No. Zabbix can also monitor network devices, hypervisors, and services agentlessly using SNMP, ICMP ping, IPMI, and HTTP synthetic endpoint checks.



Need 24/7 Monitoring & Incident Response?

Setting up monitoring is only the first step. If you need senior Linux engineers watching over your Zabbix alerts 24/7/365 with rapid incident resolution, contact ServerCare360.

Contact Us

Was this technical guide helpful?
Infrastructure Support

Require Proactive Infrastructure Monitoring & Support?

Prevent recurring outages, high load spikes, and backup failures with our 24/7 remote server administration.