Zabbix is a powerful open-source monitoring solution for IT infrastructure—networks, servers, virtual machines, and cloud services. It collects metrics such as network utilization, CPU load, and disk usage, and gives administrators flexibility to monitor exactly what matters. The backend is written in C; the web frontend uses PHP. Zabbix can send alerts when metrics cross thresholds you define, and it supports both agent-based and agentless monitoring. Installing Zabbix agents on hosts gives you detailed metrics (CPU, network, disk) for more accurate monitoring.
This guide walks you through installing and configuring Zabbix Server 6 (6.2) on Rocky Linux 9 and Alma Linux 9, using MariaDB, PHP 8.2, and Apache. The same steps apply to other RHEL 9–based systems such as Oracle Linux 9.
Prerequisites
- A fresh Rocky Linux 9 or Alma Linux 9 server (or equivalent RHEL 9 clone) with root or sudo access
- At least 2 GB RAM and 2 CPU cores recommended for a small deployment
- Network access to install packages and to reach the Zabbix web interface from your browser
Related Articles
- How to Install and Configure Zabbix Server 6 on Ubuntu 22.04
- How to Install and Configure Zabbix Server 5 on Rocky Linux/Alma Linux 8
- How to Install and Configure Zabbix Server 6 on Ubuntu 20.04
- How to Install Zabbix Agent on Rocky Linux/Alma Linux 8
- How to Install and Configure Zabbix Agent on Ubuntu 20.04
- How to Add Host in Zabbix Server to Monitor
- How to Install and Configure Zabbix Agent on OpenSUSE Leap 15.3
Update System Packages
Update the system and install any useful utilities:
| |
Install MariaDB
Zabbix requires a MySQL-compatible database. We use MariaDB, an open-source drop-in replacement for MySQL, available in the default repositories as mariadb-server.
Install it with this command:
| |
Verify the installed package:
| |
The Service will not be started by default. Start with this command:
| |
Confirm the status with this command:
| |
To ensure that mariadb starts on boot, enable it with this systemd command:
| |
Once MariaDB is running, secure it using the provided script:
| |
The script will prompt you to set a root password, remove anonymous users, disallow root login remotely, and remove the test database. Accept the recommended options for a production setup.
To confirm the version of MariaDB installed, run the command:
| |
For more on MariaDB installation and configuration, see How to Install and Configure MariaDB 10 in Rocky Linux/Alma Linux 8.
Create Database and User for Zabbix
Create a dedicated database and user for Zabbix (see MySQL permissions guide for more on managing users). Connect to the server:
| |
After supplying the root password, run the following at the MySQL prompt (replace the password with a strong one):
| |
Use a strong password and note the database name, username, and password for the Zabbix server configuration later. Using 'zabbix_user'@'localhost' instead of '%' is more secure when the database is on the same host as Zabbix.
Install PHP and Required Modules
The default PHP in Rocky Linux 9 may be older than Zabbix 6 requires. Install the Remi repository to get PHP 8.2:
| |
Enable version 8.2 of php
| |
Confirm the module is enabled with sudo dnf module list php, then install PHP and the extensions required by Zabbix:
| |
Check php version
| |
For more on the LAMP stack, see How to Install Apache and PHP (LAMP stack) on Rocky Linux/CentOS 8.
Install Apache Web Server
Install and start the Apache httpd service:
| |
Enable httpd to start at boot, then verify it is running:
| |
Configure PHP and PHP-FPM for Zabbix
Tune PHP for Zabbix by editing the main PHP configuration:
| |
Set or adjust the following (use your own timezone):
| |
Edit the PHP-FPM pool configuration:
| |
Ensure these values are set:
| |
Save and exit. Then start and enable PHP-FPM:
Start and Enable PHP-FPM
The php-fpm service is not started by default. Start using this command:
| |
Confirm by checking the status:
| |
Enable the service to start on boot
| |
At this point, we have successfully installed the LAMP stack. We can now install Zabbix
Install Zabbix
If you use EPEL, disable its Zabbix packages so the official Zabbix repo is used. Edit /etc/yum.repos.d/epel.repo and under the [epel] section add:
| |
Install the zabbix repository
| |
Once the repository is installed, install the Zabbix server, Zabbix agent, and the associated Zabbix packages.
| |
Import the Zabbix database schema (use the password you set for zabbix_user):
| |
When prompted for a password, provide the Zabbix user’s password.
Edit Zabbix configuration file and update the db credentials
| |
Set DBHost, DBName, DBUser, and DBPassword to match the database and user you created:
| |
Save and exit. Optionally set the PHP timezone for the Zabbix frontend (the file is created when you install the Zabbix packages):
| |
Use your own timezone (e.g. America/New_York, Europe/London). If the file does not exist yet, create it and add the line, or skip and set the timezone in the web wizard. Then restart all services:
| |
Additionally, consider enabling them on startup.
| |
Configure SELinux & Firewall
If you have firewalld installed and enabled, enable web and Zabbix ports
| |
For the Zabbix web interface to work under the default Apache and PHP-FPM setup, SELinux may block access. You can set SELinux to permissive temporarily (requires reboot for permanent change):
| |
For production, consider keeping SELinux enforcing and configuring the correct contexts for Zabbix (e.g. with semanage and restorecon) instead of disabling it.
Complete Zabbix Installation via Web Wizard
To complete the installation, launch your browser, and go to this URL: http://server-ip/zabbix
The first page that greets you is the Zabbix welcome page that boldly displays the version you are installing. Select the installation language and click on the Next step button.
In the next page you get a list of prerequisites, scroll all the way down and ensure all the prerequisites get the ‘OK’ label in the last column. It’s mandatory that all the requirements are satisfied. Then hit the ‘Next step’ button.
On the Configure DB connection page, enter your database name, user, and password. Leave the database port at 0 (default). Click Next step.
Then specify your server’s name, confirm your time zone and feel free to select your preferred theme. Then press ‘Next step’.
Confirm all the settings and if all looks well, press on ‘Next step’ to finalize the installation.
If all the settings you provided are correct, you will get a congratulatory message notifying you of the successful setup of Zabbix’s front end. Press on the ‘Finish’ button.
You will be taken to the Zabbix login page. Use the default credentials:
- Username:
Admin - Password:
zabbix
Click Sign in to open the dashboard. Change the default password immediately from Administration → Users → Admin for security.
Summary
You have installed Zabbix Server 6 on Rocky Linux 9 or Alma Linux 9 with:
- MariaDB as the database
- PHP 8.2 and PHP-FPM
- Apache (httpd) serving the Zabbix web frontend
- Firewall rules for HTTP and Zabbix (80, 10050, 10051)
- Optional SELinux adjustment for the web UI
Troubleshooting
- 502 Bad Gateway or blank page at /zabbix: Ensure PHP-FPM is running (
sudo systemctl status php-fpm) and that Apache can talk to the PHP-FPM socket. Restarthttpdandphp-fpmafter config changes. - Database connection errors in the wizard: Check that MariaDB is running, the
zabbixdatabase exists, and the credentials in/etc/zabbix/zabbix_server.confmatch the user you created. Test withmysql -u zabbix_user -p zabbix -e 'SELECT 1'. - Cannot access /zabbix from browser: Open firewall ports 80, 10050, and 10051; if SELinux is enforcing, use
setenforce 0temporarily or set the proper Zabbix SELinux context.
Next Steps
- Add hosts to Zabbix and install Zabbix agents on servers you want to monitor
- Create triggers, dashboards, and alerting (email, Slack, etc.) from the Zabbix UI
- Harden the server: use HTTPS (e.g. with Nginx or Apache TLS), restrict database access, and keep Zabbix and the OS updated