Complete Beginner’s Guide to Installing Zabbix 7 with PostgreSQL and Nginx on Rocky/Alma Linux 9
Monitoring the health and performance of servers, services, and network infrastructure is a crucial part of systems administration. Zabbix is a powerful open-source monitoring tool that allows you to collect metrics, visualize them, trigger alerts, and automate remediation steps.
In this guide, we’ll walk through how to install and set up Zabbix 7 with a PostgreSQL database backend and Nginx web server on Rocky Linux 9 or AlmaLinux 9. This guide assumes a fresh server and walks you through every step, making it beginner-friendly.
Step 1: Update System Packages
Before installing anything, it’s good practice to ensure your system is up to date:
|
|
Install Common Utilities
We’ll install vim
(a text editor) and other tools we may need later.
|
|
Step 2: Configure the Zabbix Repository
Zabbix provides its own official repository. However, EPEL (Extra Packages for Enterprise Linux) can also include older versions of Zabbix which may conflict.
(Optional) Check or Enable EPEL
If EPEL is not enabled, see our guide: How to Install and Enable EPEL Repo on Rocky/Alma Linux 9
Exclude Zabbix from EPEL
To prevent EPEL from interfering with the installation:
|
|
In the [epel]
section, add or modify the following:
|
|
Add Zabbix Official Repository
Install the Zabbix 7.2 repository RPM:
|
|
Then clean up the dnf
cache:
|
|
Step 3: Install Zabbix Components
We will now install:
zabbix-server-pgsql
: the core server package configured for PostgreSQLzabbix-web-pgsql
: the web frontendzabbix-nginx-conf
: Nginx-based web configurationzabbix-sql-scripts
: SQL schemaszabbix-agent
: the monitoring agent that runs on the hostzabbix-selinux-policy
: SELinux rules for Zabbix
Run:
|
|
Step 4: Set Up the PostgreSQL Database
Zabbix needs a backend database. We’ll use PostgreSQL. You must have it installed and running already. If not, follow: How to Install and Configure PostgreSQL 17 on Rocky/Alma Linux 9
Create a PostgreSQL User for Zabbix
|
|
When prompted, enter a secure password and remember it.
Create the Zabbix Database
|
|
This creates a database named zabbix
owned by the user zabbix
.
Import Initial Schema and Data
Now load the initial schema into the database. You’ll be prompted for the password you created above:
|
|
Step 5: Configure Zabbix Server
We now tell the Zabbix server where to find the database and how to connect.
Edit the configuration file:
|
|
Find the line for DBPassword
and set it to the PostgreSQL password you used earlier:
|
|
Save and close the file.
Step 6: Configure Nginx for Zabbix Frontend
Edit the Nginx configuration provided by Zabbix:
|
|
Uncomment and edit these lines:
|
|
Make sure the domain (zabbix.citizix.com
) resolves to your server’s IP address. You can use your local /etc/hosts
file or DNS.
Step 7: Start and Enable Services
Start the Zabbix server and agent processes, Nginx, and PHP-FPM:
|
|
Enable these services to start on boot:
|
|
Step 8: Complete the Setup in the Web UI
Visit the Zabbix frontend in your browser:
|
|
You’ll be guided through a web-based setup wizard:
- Pre-requisites Check: Ensure all PHP modules and settings are correct.
- Database Connection: Enter PostgreSQL DB name (
zabbix
), username (zabbix
), and the password you created. - Zabbix Server Details: Name your monitoring server and set a timezone.
- Configuration File Creation: Zabbix will generate
/etc/zabbix/web/zabbix.conf.php
.
Once successful, you’ll see:
|
|
Click the Finish button.
Login Credentials
Use the default login:
- Username:
Admin
- Password:
zabbix
⚠️ You should change this password immediately after logging in for security purposes.
🎉 Success! You Now Have Zabbix 7 Monitoring Set Up
You now have a fully functional monitoring solution with:
- Zabbix Server and Agent
- PostgreSQL database backend
- Nginx + PHP frontend
From here, you can begin:
- Adding monitored hosts
- Setting up dashboards
- Creating triggers and actions
- Monitoring system health, services, and network performance
Zabbix is highly extensible and has a large community. Don’t hesitate to explore the official documentation for advanced features.
✅ What’s Next?
- Set up HTTPS with Let’s Encrypt
- Add email or Telegram notifications
- Configure user roles and security
- Explore low-level discovery and template linking
Happy monitoring!