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.0 LTS repository RPM. 7.0 is the long-term support release (full support until June 2027, security fixes until June 2029), so it is the right choice for a server you want to leave running:
sudo rpm -Uvh https://repo.zabbix.com/zabbix/7.0/rocky/9/x86_64/zabbix-release-latest-7.0.el9.noarch.rpm
On AlmaLinux, swap rocky for alma in the URL.
An earlier version of this guide used the Zabbix 7.2 repository. 7.2 was a short-lived standard release and is no longer supported; check the Zabbix life cycle page before picking a newer version.
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. This runs as the zabbix system user (created by the zabbix-server-pgsql package), so PostgreSQL’s local peer authentication lets it in without a password prompt:
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.
Open the Firewall and Set SELinux Booleans
Rocky and AlmaLinux run firewalld by default, so open port 8080 (the server and agent ports are only needed if other hosts will report to this server):
sudo firewall-cmd --permanent --add-port=8080/tcp
sudo firewall-cmd --permanent --add-port={10050,10051}/tcp
sudo firewall-cmd --reload
With SELinux in enforcing mode, allow the web frontend to talk to the Zabbix server and to PostgreSQL (the frontend connects to PostgreSQL over localhost, which counts as a network connection):
sudo setsebool -P httpd_can_connect_zabbix on
sudo setsebool -P httpd_can_network_connect_db on
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 (see How to Add a Host in Zabbix Server to Monitor)
- 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 (see How to Secure Nginx With Let’s Encrypt on Rocky Linux/Alma Linux 9)
- Add email or Telegram notifications
- Configure user roles and security
- Explore low-level discovery and template linking
Happy monitoring!