Table of Contents#
- Prerequisites
- Installing Zabbix on RHEL/CentOS
- Installing Zabbix on Debian/Ubuntu
- Post-Installation: Access Zabbix Web Interface
- Troubleshooting Tips
- Conclusion
- References
Prerequisites#
Before starting, ensure:
- A server with RHEL 8/9, CentOS Stream 8/9, Debian 11+, or Ubuntu 20.04/22.04 (64-bit).
rootorsudoprivileges.- 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 allStep 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-agentStep 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 mariadb3.2 Secure the Database#
Run the mysql_secure_installation script to set a root password and harden security:
sudo mysql_secure_installation3.3 Create a Zabbix Database and User#
Log into the MariaDB shell:
sudo mysql -u root -pRun 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 zabbixStep 4: Configure Zabbix Server#
Edit the Zabbix Server configuration file to point to the database:
sudo nano /etc/zabbix/zabbix_server.confFind and update these lines (replace password with your Zabbix database user’s password):
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=passwordStep 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.conf5.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.confUpdate the php_value[date.timezone] line:
php_value[date.timezone] = Asia/KolkataStep 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-fpmInstalling 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 updateStep 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-agentStep 3: Configure Database (MySQL/MariaDB)#
3.1 Install MySQL (if not already installed)#
sudo apt install -y mysql-server
sudo systemctl enable --now mysql3.2 Secure the Database#
Run the mysql_secure_installation script:
sudo mysql_secure_installation3.3 Create a Zabbix Database and User#
Log into the MySQL shell:
sudo mysql -u root -pRun 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 zabbixStep 4: Configure Zabbix Server#
Edit the Zabbix Server configuration file to point to the database:
sudo nano /etc/zabbix/zabbix_server.confUpdate these lines (replace password with your Zabbix database user’s password):
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=passwordStep 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.confUncomment and update the php_value[date.timezone] line (replace Asia/Kolkata with your timezone):
php_value[date.timezone] = Asia/KolkataStep 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.04Post-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:
- Prerequisites Check: Verify PHP/MySQL/Nginx/Apache configurations.
- Database Connection: Enter the Zabbix database credentials (user:
zabbix, password:password). - Server Details: Set the Zabbix Server name (optional).
- 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
zabbixuser can connect to the database (test withmysql -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) or443(HTTPS) for web access, and port10051(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#
- Zabbix Official Documentation
- MySQL/MariaDB Documentation
- RHEL/CentOS Documentation
- [Debian/Ubuntu Documentation](https://www.debian.org/doc/ / https://ubuntu.com/docs)
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.