Search

How to install zabbix on rocky linux 9

 

How to Install Zabbix on Rocky Linux 9

Zabbix is an open-source monitoring tool that helps track the status of various network services, servers, and other hardware. This guide will walk you through the steps to install Zabbix on Rocky Linux 9.

Step 1: Update Your System

Before installing any new packages, it’s always good practice to update your system. Open a terminal and run the following commands:

sudo dnf update -y

Step 2: Add Zabbix Repository

Zabbix provides its own repositories. To add the Zabbix repository, execute:

sudo rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/9/x86_64/zabbix-release-5.0-1.el9.noarch.rpm
sudo dnf clean all

Step 3: Install Zabbix Server, Web Interface, and Agent

Now, install the Zabbix server, frontend, and agent using:

sudo dnf install zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf zabbix-agent

Step 4: Install and Configure Database

Zabbix requires a database to store information. Here, we'll use MariaDB. Install MariaDB with:

sudo dnf install mariadb-server

Start the MariaDB service and enable it to start on boot:

sudo systemctl start mariadb
sudo systemctl enable mariadb

Now, secure your MariaDB installation:

sudo mysql_secure_installation

Next, log into MariaDB to create the initial database and user:

sudo mysql -u root -p
CREATE DATABASE zabbix CHARACTER SET utf8 COLLATE utf8_bin;
CREATE USER 'zabbix'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON zabbix.* TO 'zabbix'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Step 5: Configure Zabbix Server

Import the initial schema and data for the Zabbix server:

zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql -uzabbix -p zabbix

Edit the Zabbix server configuration file to set the database connection details:

sudo nano /etc/zabbix/zabbix_server.conf
DBName=zabbix
DBUser=zabbix
DBPassword=your_password

Step 6: Configure PHP for Zabbix Frontend

Edit the php.ini file to configure PHP for Zabbix:

sudo nano /etc/php-fpm.d/zabbix.conf

Set the timezone (for example, America/New_York):

php_value[date.timezone] = America/New_York

Step 7: Start and Enable Services

Start and enable the Zabbix server, agent, and Apache services:

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

Step 8: Configure Firewall

If you have a firewall enabled, you need to allow traffic on the web and agent ports:

sudo firewall-cmd --permanent --add-port=10051/tcp
sudo firewall-cmd --permanent --add-port=10050/tcp
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --reload

Step 9: Complete Zabbix Setup in Web Browser

Open your web browser and navigate to http://your_server_ip/zabbix. Follow the setup wizard to complete the installation.

Login with the default credentials:

Username: Admin
Password: zabbix

Conclusion

You should now have Zabbix successfully installed on your Rocky Linux 9 server. From here, you can start configuring hosts, setting up monitoring, and creating alerts.

Sys Admin

Sys Admin

I am a Red Hat Certified Engineer (RHCE) and working as an IT Professional since 2012...