dotlinux blog

How to Install Zabbix on RHEL/CentOS and Debian/Ubuntu

Zabbix is a powerful, open-source monitoring solution that tracks the performance of servers, networks, applications, and other IT infrastructure components. It offers real-time monitoring, alerting, visualization (via graphs/dashboards), and reporting capabilities. This guide walks you through installing Zabbix (Server + Agent + Frontend) on two popular Linux families: RHEL/CentOS (Red Hat Enterprise Linux/CentOS Stream) and Debian/Ubuntu (Debian 11+/Ubuntu 20.04+).

2026-03

Table of Contents#

Prerequisites#

Before starting, ensure:

  • A server with RHEL 8/9, CentOS Stream 8/9, Debian 11+, or Ubuntu 20.04/22.04 (64-bit).
  • root or sudo privileges.
  • A working internet connection.
  • A database (MySQL/MariaDB) (we’ll install it if needed).

Installing Zabbix on RHEL/CentOS#

We’ll use Zabbix 6.4 (latest LTS at the time of writing) with a MySQL/MariaDB backend and Nginx + PHP-FPM for the frontend.

Step 1: Configure Zabbix Repository#

Zabbix provides official YUM repositories. Run these commands (replace rhel/9 with rhel/8 for CentOS 8/RHEL 8):

# Install Zabbix repository
sudo rpm -Uvh https://repo.zabbix.com/zabbix/6.4/rhel/9/x86_64/zabbix-release-6.4-1.el9.noarch.rpm
 
# Clear yum/dnf cache
sudo dnf clean all

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

Install the core components (Server, Web Frontend, Agent, and database tools):

sudo dnf install -y zabbix-server-mysql zabbix-web-mysql zabbix-nginx-conf zabbix-sql-scripts zabbix-agent

Step 3: Configure Database (MySQL/MariaDB)#

Zabbix requires a database to store monitoring data.

3.1 Install MariaDB (if not already installed)#

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

3.2 Secure the Database#

Run the mysql_secure_installation script to set a root password and harden security:

sudo mysql_secure_installation

3.3 Create a Zabbix Database and User#

Log into the MariaDB shell:

sudo mysql -u root -p

Run these SQL commands (replace password with a strong password):

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

3.4 Import Initial Schema and Data#

Use the Zabbix SQL scripts to populate the database:

sudo zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql -u zabbix -p zabbix

Step 4: Configure Zabbix Server#

Edit the Zabbix Server configuration file to point to the database:

sudo nano /etc/zabbix/zabbix_server.conf

Find and update these lines (replace password with your Zabbix database user’s password):

DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=password

Step 5: Configure Zabbix Frontend (Nginx + PHP-FPM)#

Zabbix uses Nginx to serve the web interface and PHP-FPM to process PHP scripts.

5.1 Configure Nginx for Zabbix#

The package zabbix-nginx-conf provides a default config. Link it to Nginx’s config directory:

sudo ln -s /etc/zabbix/nginx.conf /etc/nginx/conf.d/zabbix.conf

5.2 Configure PHP-FPM for Zabbix#

Edit the PHP-FPM configuration to set the correct timezone (replace Asia/Kolkata with your timezone, e.g., Europe/London, America/New_York):

sudo nano /etc/php-fpm.d/zabbix.conf

Update the php_value[date.timezone] line:

php_value[date.timezone] = Asia/Kolkata

Step 6: Start and Enable Zabbix Services#

Start the services and enable them to start at boot:

sudo systemctl enable --now zabbix-server zabbix-agent nginx php-fpm

Installing Zabbix on Debian/Ubuntu#

We’ll use Zabbix 6.4 with a MySQL/MariaDB backend and Apache + PHP-FPM for the frontend.

Step 1: Configure Zabbix Repository#

Add the official Zabbix repository (replace ubuntu22.04 with debian11 for Debian 11):

# Download Zabbix repo package
wget https://repo.zabbix.com/zabbix/6.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.4-1+ubuntu22.04_all.deb
 
# Install the repo
sudo dpkg -i zabbix-release_6.4-1+ubuntu22.04_all.deb
 
# Update package lists
sudo apt update

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

Install the core components (Server, Web Frontend, Agent, and database tools):

sudo apt install -y zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent

Step 3: Configure Database (MySQL/MariaDB)#

3.1 Install MySQL (if not already installed)#

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

3.2 Secure the Database#

Run the mysql_secure_installation script:

sudo mysql_secure_installation

3.3 Create a Zabbix Database and User#

Log into the MySQL shell:

sudo mysql -u root -p

Run these SQL commands (replace password with a strong password):

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

3.4 Import Initial Schema and Data#

Use the Zabbix SQL scripts to populate the database:

sudo zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql -u zabbix -p zabbix

Step 4: Configure Zabbix Server#

Edit the Zabbix Server configuration file to point to the database:

sudo nano /etc/zabbix/zabbix_server.conf

Update these lines (replace password with your Zabbix database user’s password):

DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=password

Step 5: Configure Zabbix Frontend (Apache + PHP)#

Zabbix uses Apache to serve the web interface and PHP-FPM to process PHP scripts.

5.1 Configure PHP Timezone#

Edit the PHP configuration for Zabbix:

sudo nano /etc/zabbix/apache.conf

Uncomment and update the php_value[date.timezone] line (replace Asia/Kolkata with your timezone):

php_value[date.timezone] = Asia/Kolkata

Step 6: Start and Enable Zabbix Services#

Start the services and enable them to start at boot:

sudo systemctl enable --now zabbix-server zabbix-agent apache2 php8.1-fpm  # Use php7.4-fpm for Ubuntu 20.04

Post-Installation: Access Zabbix Web Interface#

Open a web browser and navigate to:

  • RHEL/CentOS: http://<server-ip>/zabbix
  • Debian/Ubuntu: http://<server-ip>/zabbix

Follow the Zabbix setup wizard:

  1. Prerequisites Check: Verify PHP/MySQL/Nginx/Apache configurations.
  2. Database Connection: Enter the Zabbix database credentials (user: zabbix, password: password).
  3. Server Details: Set the Zabbix Server name (optional).
  4. Finish: Confirm settings and access the Zabbix dashboard.

Troubleshooting Tips#

  • Log Files: Check Zabbix Server logs (/var/log/zabbix/zabbix_server.log), web server logs (Nginx: /var/log/nginx/error.log; Apache: /var/log/apache2/error.log), or PHP-FPM logs.
  • Database Connection: Ensure the zabbix user can connect to the database (test with mysql -u zabbix -p zabbix).
  • SELinux (RHEL/CentOS): If SELinux blocks access, run sudo setsebool -P httpd_can_connect_zabbix on (for Nginx, adjust SELinux policies for Nginx).
  • Firewall: Open port 80 (HTTP) or 443 (HTTPS) for web access, and port 10051 (Zabbix Server) if monitoring remote agents.

Conclusion#

You’ve successfully installed Zabbix Server, Agent, and Frontend on RHEL/CentOS or Debian/Ubuntu! Zabbix is now ready to monitor your infrastructure. Next steps:

  • Install Zabbix Agents on target servers (Linux/Windows) to start monitoring.
  • Create hosts, templates, and triggers in the Zabbix frontend.

References#

This guide should help you deploy Zabbix quickly. For advanced configurations (e.g., high availability, SSL, or monitoring Windows servers), refer to Zabbix’s official docs.