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:
sudo dnf -y update
Install Common Utilities
We’ll install vim (a text editor) and other tools we may need later.
sudo dnf install -y vim
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:
sudo vim /etc/yum.repos.d/epel.repo
In the [epel] section, add or modify the following:
[epel]
...
excludepkgs=zabbix*
Add Zabbix Official Repository
Install the Zabbix 7.2 repository RPM:
sudo rpm -Uvh https://repo.zabbix.com/zabbix/7.2/release/alma/9/noarch/zabbix-release-latest-7.2.el9.noarch.rpm
Then clean up the dnf cache:
sudo dnf clean all
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:
sudo dnf install zabbix-server-pgsql zabbix-web-pgsql zabbix-nginx-conf \
zabbix-sql-scripts zabbix-selinux-policy zabbix-agent
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
sudo -u postgres createuser --pwprompt zabbix
When prompted, enter a secure password and remember it.
Create the Zabbix Database
sudo -u postgres createdb -O zabbix zabbix
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:
zcat /usr/share/zabbix/sql-scripts/postgresql/server.sql.gz | sudo -u zabbix psql zabbix
Step 5: Configure Zabbix Server
We now tell the Zabbix server where to find the database and how to connect.
Edit the configuration file:
sudo vim /etc/zabbix/zabbix_server.conf
Find the line for DBPassword and set it to the PostgreSQL password you used earlier:
DBPassword=your_password_here
Save and close the file.
Step 6: Configure Nginx for Zabbix Frontend
Edit the Nginx configuration provided by Zabbix:
sudo vim /etc/nginx/conf.d/zabbix.conf
Uncomment and edit these lines:
listen 8080;
server_name zabbix.citizix.com;
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:
sudo systemctl restart zabbix-server zabbix-agent nginx php-fpm
Enable these services to start on boot:
sudo systemctl enable zabbix-server zabbix-agent nginx php-fpm
Step 8: Complete the Setup in the Web UI
Visit the Zabbix frontend in your browser:
http://zabbix.citizix.com:8080
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:
Congratulations! You have successfully installed Zabbix frontend.
Configuration file "etc/zabbix/web/zabbix.conf.php" created.
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!