How to install Zabbix server on CentOS - RHEL 9

5 feb 2024 3 min di lettura
How to install Zabbix server on CentOS - RHEL 9
Indice dei contenuti

Introduction

In the field of network management and monitoring, Zabbix stands out as one of the leading open source solutions. It offers a full suite of features for monitoring network services, servers, and other network hardware. This guide will help you install Zabbix Server on CentOS/RHEL 9, a popular choice for enterprise-level server environments, using a MySQL database backend. Zabbix's compatibility with CentOS/RHEL 9 ensures stability and performance, making it an excellent choice for reliable network monitoring.

The tutorial includes steps to set up a LAMP (Linux, Apache, MySQL, PHP) stack, configure the Zabbix server, and finalize the configuration via its web interface.

Prerequisites

  • A CentOS/RHEL 9 system: This guide assumes a clean install of CentOS/RHEL 9.
  • Root or Sudo privileges: Essential for installing packages and making changes to the system.
  • Familiarity with terminal commands: Basic knowledge of Linux command line operations is helpful.
  • Internet Connectivity: Required to download packages and updates.

Step 1: Prepare your system

Update System Packages: Keeping your system updated is crucial for security and compatibility.

sudo dnf update -y
sudo dnf upgrade -y

Install Essential Tools: Tools like wget and vim will be useful during installation.

sudo dnf install wget vim -y

Step 2: Configure the LAMP stack

In this step we will install and configure the LAMP stack on our system. This is necessary to run the Zabbix server and frontend application on any system.

Install Packages:

sudo dnf install httpd mariadb-server mariadb php php-cli php-common php-mysqlnd -y

Start and enable service:

sudo systemctl start httpd mariadb
sudo systemctl enable httpd mariadb

Step 3: Install Zabbix server

Zabbix officially provides an RPM package to configure the DNF repository for RHEL-based systems. In this step we will setup the repository on our system and install the required Zabbix server packages:

Import Zabbix repository:

sudo rpm -Uvh https://repo.zabbix.com/zabbix/6.4/rhel/9/x86_64/zabbix-release-6.4-1.el9.noarch.rpm

Install Zabbix server with MySQL support:

sudo dnf install --disablerepo=epel zabbix-server-mysql zabbix-web-mysql \
 zabbix-apache-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent -y

Step 4: Create MySQL database for Zabbix

Now create a MySQL database and user for the Zabbix server.

Log in to MySQL:

mysql -u root -p

Create a Zabbix database and user:

CREATE DATABASE zabbix CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
CREATE USER zabbix@localhost IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON zabbix.* TO zabbix@localhost;
SET GLOBAL log_bin_trust_function_creators = 1;
EXIT;

Import schema and initial data. You will be asked for the password you just created:

zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql -uzabbixuser -p zabbixdb

Log in to the MySQL console again and reset the log_bin_trust_function_creators setting:

SET global log_bin_trust_function_creators = 0;
EXIT;

Step 5: Set up the Zabbix server

Edit the Zabbix server configuration file:

sudo nano /etc/zabbix/zabbix_server.conf

Set the database name, user and password.

Restart the Apache and Zabbix server:

sudo systemctl restart httpd zabbix-server

Enable Zabbix server to start on startup:

sudo systemctl enable zabbix-server

Step 6: Log in to the Zabbix web interface

If your system has firealld active, you need to open port 80. To open the HTTP port, type:

sudo firewall-cmd --permanent --add-port=80/tcp

Then reload the changes with the command:

sudo firewall-cmd --reload

Step 7: Log in to the Zabbix web interface

Open your web browser and go to your server's IP address or domain name followed by /zabbix. For example, http://your_server_ip/zabbix.

Follow the on-screen instructions to complete the Zabbix setup. Once the wizard is complete, the login page will appear. Use the following login details:

Username: administrator Password: zabbix

Conclusion

With Zabbix installed on your CentOS/RHEL 9 system, you are now able to monitor your network and server environments effectively. This guide has walked you through each step in detail, ensuring a complete setup process. Regular maintenance, such as updating Zabbix and backing up your configuration, will ensure long-term stability and performance of your monitoring system.

Buy me a coffeeBuy me a coffee

Supportaci se ti piacciono i nostri contenuti. Grazie.

Successivamente, completa il checkout per l'accesso completo a Noviello.it.
Bentornato! Accesso eseguito correttamente.
Ti sei abbonato con successo a Noviello.it.
Successo! Il tuo account è completamente attivato, ora hai accesso a tutti i contenuti.
Operazione riuscita. Le tue informazioni di fatturazione sono state aggiornate.
La tua fatturazione non è stata aggiornata.