1080*80 ad

Installing Zabbix on Rocky Linux 10

Master Your Monitoring: A Step-by-Step Guide to Installing Zabbix on Rocky Linux 10

In today’s complex IT environments, robust monitoring is not a luxury—it’s a necessity. Proactively tracking the health and performance of your servers, applications, and network devices can be the difference between smooth operations and a catastrophic failure. Zabbix stands out as a powerful, enterprise-grade, and open-source monitoring solution, and pairing it with the stability of Rocky Linux 10 creates a formidable platform for overseeing your entire infrastructure.

This comprehensive guide will walk you through every step of installing the Zabbix server, web frontend, and agent on a fresh Rocky Linux 10 system using the reliable Nginx web server and MariaDB database.

Prerequisites

Before we begin, ensure you have the following in place:

  • A server running a fresh installation of Rocky Linux 10.
  • Root or sudo access to execute administrative commands.
  • A stable internet connection to download packages.
  • A static IP address configured for your server.

Step 1: System Preparation and Updates

First, it’s crucial to start with a fully updated system. This ensures all existing packages are on their latest versions, preventing potential dependency conflicts.

Open your terminal and run the following command:

sudo dnf update -y

Next, for the Zabbix web interface to function correctly, you may need to adjust SELinux. While disabling it is an option for testing, a more secure approach for production is to set it to permissive mode. This logs warnings instead of enforcing policies, allowing you to troubleshoot without completely disabling a key security feature.

sudo sed -i 's/SELINUX=enforcing/SELINUX=permissive/' /etc/selinux/config

A reboot is required for this change to take effect.

sudo reboot

Step 2: Install Zabbix and Nginx Repositories

Zabbix is not included in the default Rocky Linux repositories. We need to add the official Zabbix repository to our system to install the necessary packages.

sudo rpm -Uvh https://repo.zabbix.com/zabbix/7.0/rhel/10/x86_64/zabbix-release-7.0-1.el10.noarch.rpm
sudo dnf clean all

Now, we can install the core Zabbix components, along with Nginx, PHP, and the MariaDB database server.

sudo dnf install zabbix-server-mysql zabbix-web-mysql zabbix-nginx-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent mariadb-server -y

Step 3: Database Initialization and Configuration

With the packages installed, we need to create and configure a database for Zabbix to store its data.

First, start and enable the MariaDB service:

sudo systemctl start mariadb
sudo systemctl enable mariadb

Next, run the mandatory security script to harden your MariaDB installation. This will prompt you to set a root password, remove anonymous users, and secure the database.

sudo mysql_secure_installation

Now, log in to MariaDB as the root user and create the Zabbix database, user, and grant the necessary permissions. Replace 'your-strong-password' with a secure password of your own.

sudo mysql -u root -p

Inside the MySQL shell, execute the following commands:

create database zabbix character set utf8mb4 collate utf8mb4_bin;
create user 'zabbix'@'localhost' identified by 'your-strong-password';
grant all privileges on zabbix.* to 'zabbix'@'localhost';
set global log_bin_trust_function_creators = 1;
quit;

Security Tip: The log_bin_trust_function_creators setting is required by Zabbix. It is recommended to disable it after the initial schema import is complete for enhanced security.

With the database and user created, import the initial Zabbix schema. You will be prompted for the Zabbix user password you just created.

sudo zcat /usr/share/doc/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix

After the import is complete, log back into the database and disable the log_bin_trust_function_creators setting:

sudo mysql -u root -p
set global log_bin_trust_function_creators = 0;
quit;

Step 4: Configure the Zabbix Server

Now we must tell the Zabbix server how to connect to the database we just created. Edit the main configuration file:

sudo nano /etc/zabbix/zabbix_server.conf

Find the DBPassword line, uncomment it, and add the secure password you created for the zabbix database user.

### Option: DBPassword
#       Database password.
#       Comment this line if no password is used.
#
# Mandatory: no
# Default:
DBPassword=your-strong-password

Save and close the file.

Step 5: Configure Nginx and PHP-FPM

The Zabbix Nginx configuration file is ready but may need a minor adjustment. Open it to review the settings:

sudo nano /etc/nginx/conf.d/zabbix.conf

By default, it listens on port 8080. If you wish to use the standard port 80, find and change the listen directive:

# listen 8080;
listen 80;

Save and close the file.

Step 6: Start and Enable Services

With all configurations in place, it’s time to start the Zabbix server, agent, Nginx, and PHP-FPM services. We will also enable them to start automatically on boot.

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

Step 7: Configure the Firewall

To allow access to the Zabbix web interface and enable communication with Zabbix agents, we need to add rules to the system’s firewall.

sudo firewall-cmd --add-service=http --permanent
sudo firewall-cmd --add-port=10051/tcp --permanent
sudo firewall-cmd --reload
  • HTTP (port 80): Allows access to the web frontend.
  • Port 10051/tcp: The default port for the Zabbix server to listen for agent connections.

Step 8: Finalize Installation via the Web Interface

The command-line work is done! Open your web browser and navigate to your server’s IP address: http://your-server-ip.

You will be greeted by the Zabbix setup wizard.

  1. Welcome Screen: Click “Next step.”
  2. Check of pre-requisites: The wizard will verify that all PHP extensions and settings are correct. All items should show “OK.” Click “Next step.”
  3. Configure DB connection: Enter the database details.
    • Database type: MySQL
    • Database host: localhost
    • Database port: 0 (for default)
    • Database name: zabbix
    • User: zabbix
    • Password: Enter the secure password you created.
    • Click “Next step.”
  4. Zabbix server details: You can give your server a name or leave the defaults. Click “Next step.”
  5. Pre-installation summary: Review the details and click “Next step.”
  6. Finish: Congratulations! The installation is complete. Click “Finish.”

You will be redirected to the Zabbix login screen. The default credentials are:

  • Username: Admin
  • Password: zabbix

Actionable Advice: Your very first action should be to log in and immediately change the default Admin user’s password to a strong, unique one. This is a critical security step.

You now have a fully operational Zabbix monitoring server running on Rocky Linux 10. Your next steps are to begin adding hosts, configuring monitoring templates, and setting up notifications to build a comprehensive view of your infrastructure’s health.

Source: https://centlinux.com/install-zabbix-on-rocky-linux-10/

900*80 ad

      1080*80 ad