How to Install and Configure Zabbix 7 With Postgresql and Nginx on Rocky/Alma Linux 9

Step-by-step guide on How to Install and Configure Zabbix 7 With Postgresql and Nginx on Rocky Alma Linux 9

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:

1
sudo dnf -y update

Install Common Utilities

We’ll install vim (a text editor) and other tools we may need later.

1
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:

1
sudo vim /etc/yum.repos.d/epel.repo

In the [epel] section, add or modify the following:

1
2
3
[epel]
...
excludepkgs=zabbix*

Add Zabbix Official Repository

Install the Zabbix 7.2 repository RPM:

1
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:

1
sudo dnf clean all

Step 3: Install Zabbix Components

We will now install:

  • zabbix-server-pgsql: the core server package configured for PostgreSQL
  • zabbix-web-pgsql: the web frontend
  • zabbix-nginx-conf: Nginx-based web configuration
  • zabbix-sql-scripts: SQL schemas
  • zabbix-agent: the monitoring agent that runs on the host
  • zabbix-selinux-policy: SELinux rules for Zabbix

Run:

1
2
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

1
sudo -u postgres createuser --pwprompt zabbix

When prompted, enter a secure password and remember it.

Create the Zabbix Database

1
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:

1
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:

1
sudo vim /etc/zabbix/zabbix_server.conf

Find the line for DBPassword and set it to the PostgreSQL password you used earlier:

1
DBPassword=your_password_here

Save and close the file.


Step 6: Configure Nginx for Zabbix Frontend

Edit the Nginx configuration provided by Zabbix:

1
sudo vim /etc/nginx/conf.d/zabbix.conf

Uncomment and edit these lines:

1
2
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:

1
sudo systemctl restart zabbix-server zabbix-agent nginx php-fpm

Enable these services to start on boot:

1
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:

1
http://zabbix.citizix.com:8080

You’ll be guided through a web-based setup wizard:

  1. Pre-requisites Check: Ensure all PHP modules and settings are correct.
  2. Database Connection: Enter PostgreSQL DB name (zabbix), username (zabbix), and the password you created.
  3. Zabbix Server Details: Name your monitoring server and set a timezone.
  4. Configuration File Creation: Zabbix will generate /etc/zabbix/web/zabbix.conf.php.

Once successful, you’ll see:

1
2
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!

comments powered by Disqus
Citizix Ltd
Built with Hugo
Theme Stack designed by Jimmy