Home / How To / How to install Zabbix Monitoring Tool on CentOS 8

How to install Zabbix Monitoring Tool on CentOS 8



Zabbix is ​​an open source monitoring tool for network services, network hardware, servers and applications. Designed to track and monitor the status of your system and servers. Zabbix offers support for many database systems – including MySQL, PostgreSQL, SQLite and IBM DB2 – to store data. Zabbix backend is written in C, and frontend is written in PHP.

In this tutorial we will show you step by step how to install and configure an open source monitoring system Zabbix 4.0 LTS on the CentOS 8 system. This guide will cover some topics, including the installation and configuration of the LAMP Stack for our Zabbix installation, and how to change the default password for the Zabbix admin web UI.

Prerequisites

  • CentOS 8 Server
  • Root privileges
  • Basic knowledge of Linux CentOS commands

What we will do:

  • Install Apache Httpd
  • Install and configure PHP
  • Install and configure MariaDB
  • Install and configure Zabbix 4.0 LTS
  • Configure firewall
  • Configure SELinux
  • Zabbix after installation
  • Change default administrator for Zabbix

Step H ̵
1; Install App ] For this guide, we will use Apache / httpd for our web server. The Zabbix server will run under the Apache web server.

You can install the Apache / httpd package with the dnf command below.

  dnf install httpd 

When the installation is complete, add the httpd service to the system startup and start the service using the following commands.

  systemctl enable httpd 
systemctl start httpd

Now check the httpd service with the netstat command below and make sure the "80" HTTP port is in "LISTEN" mode.

  netstat -plntu 

Below is the result.

 Enable Apache Web Server

As a result, the httpd service is running on the default HTTP port & # 39; 80 & # 39; on the CentOS 8 server.

Step 2 – Install PHP

After installing the Apache / httpd web server, we will install PHP packages and their add-ons needed for the Zabbix installation. We will install and configure PHP as Zabbix installation requirements.

Install PHP package with the dnf command below.

  dnf install php-cli php-common php-devel php-pear php-gd php-mbstring php -mysqlnd php-xml php-bcmath 

Once the installation is complete, configure the PHP configuration & # 39; / etc /php.ini' with the vim editor.

  vim /etc/php.inivud19659020vud Change the values ​​of the configuration shown below. 

  date.timezone = Asia / Jakarta 
max_execution_time = 600
max_input_time = 600
memory_limit = 256M
post_max_size = 32M
upload_max_filesize20 = 16M

Now restart the Apache / httpd service.

  systemctl reboot httpd 

And the PHP installation and configuration on the CentOS 8 server is complete.

 Installing PHP

Step 3 - Installing and configuring MariaDB

By default, Zabbix provides support for many databases for installation on, including MySQL, PostgreSQL, SQLite and Oracle database. For this guide, we will use MariaDB as a database for our Zabbix installation.

Install mariadb server with the dnf command below.

  dnf install mariadb server 

When the installation is complete add MariaDB service to system startup and start the service with the following command.

  systemctl enable mariadb 
systemctl start mariadb

The MariaDB server is running.

Then we will configure MariaDB root password. Run the & # 39; mysql_secure_installation command & # 39; below to configure the root password.

  mysql_secure_installation 

Type your root password and press Enter.

  Set a root password? [Y/n] Y 
Remove root login remotely? [Y/n] Y
Delete the test database and access it? [Y/n] Y
Reload privilege tables now? [Y/n] Y

And the MariaDB root password has been configured.

 Install MariaDB

Then we create a new database and user for the Zabbix installation. We will create a new database and users named & # 39; zabbix & # 39; with the password & # 39; [email protected] & # 39 ;.

Log in to the MariaDB / mysql shell using the mysql command below.

  mysql -u root -p 
TYPE YOUR ROOT PASSWORD:

And run the following MariaDB questions below on the shell.

  create database zabbix; 
grant all privileges on zabbix. * To [email protected] "localhost" identified with "[email protected]";
grant all privileges on zabbix. * To [email protected] "%" identified with "[email protected]";
flush privileges;

And as a result, the new database and user for Zabbix installation have been created.

 Creating zabbix database

Step 4 - Installing and configuring Zabbix 4.0 LTS

In this step we will install Zabbix 4.0 LTS. We will install the Zabbix LTS version from the official Zabbix archive.

- Add archive and install package

First we need to add the Zabbix 4.0 LTS archive to the system with the rpm command below.

  rpm - Uvh https://repo.zabbix.com/zabbix/4.0/rhel/8/x86_64/zabbix-release-4.0-2.el8.noarch.rpmebrit19659020₂When removing the system package cache and checking all available archives at system. 

  dnf clean all 
dnf repolist

Now you get the result as below.

 Installing Zabbix RPM file

As a result, the Zabbix archive has been added to the CentOS 8 system.

Now run the dnf command below to install Zabbix Server and Agent.

  dnf -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent 

Please wait for the Zabbix installation to finish.

Gambar

- Import MySQL Database Schema

When the Zabbix installation is complete, we will import the MariaDB database ase schema for Zabbix.

Go to directory & # 39; / usr / share / doc / zabbix-server-mysql & # 39; and extract the database schema.

  cd / usr / share / doc / zabbix-server-mysql 
gunzip create.sql.gz

Now import the database schema to our "zabbix" database using the MySQL command below.

  mysql -u root -p zabbix <create.sql 

Enter your MariaDB root password and the database schema has been imported.

 Importing MySQL database schema

- Configuring Zabbix Server and Zabbix Agent

Zabbix server is the central process of the Zabbix software system. We will configure the Zabbix server by editing the & # 39; /etc/zabbix/zabbix_server.conf&#39;. Vintage19659002achteChange configuration file & # 39; /etc/zabbix/zabbix_server.conf with the vim editor.

  vim / etc / zabbix / zabbix_server.conf 

Enter the configuration according to the database bar below and change the value & # 39; DBPassword & # 39; with your own database password.

  DBHost = localhost 
[email protected]

Save and close.

Then add the zabbix server to the system boot.

  systemctl enable zabbix server 

And the zabbix server configuration is complete.

Then we show you zabbix agent configuration. The Zabbix agent must be installed on all machines that will be monitored.

Edit zabbix agent configuration & # 39; /etc/zabbix/zabbix_agentd.conf&#39; with the vim editor.

  vim /etc/zabbix/zabbix_agentd.conf 

Now change the value "Server" and "ServerActive" with the IP address of the zabbix server as below.

  Server = 10.5.5.50 
ServerActive = 10.5.5.50

Save and close.

Now add the zabbix agent service to the system boot.

  systemctl enable zabbix agent 

And the zabbix agent configuration is complete.

 Configure Zabbix Server

Step 5 - Configure Firewall

For the firewall configuration, we will add new services including HTTP, HTTPS and the port used by the Zabbix server and agent.

Add the HTTP, HTTP, and Zabbix ports & # 39; 10050-10051 & # 39; to the firewall with the following commands.

  firewall-cmd --add-service = {http, https} --permanent 
firewall-cmd --add-port = {1005 1 / tcp, 10050 / tcp} --permanent

Then load about the firewall and check all available services and ports on it.

  firewall-cmd - load 
firewall-cmd - list-all

And you will see the result as below.

 Configure Firewall

As a result, the HTTP, HTTPS, and Zabbix ports have & # 39; 10050-10051 & # 39; added to the firewall.

Step 6 - Configure SELinux

If you run Zabbix on CentOS 8 with SELinux enabled on it, you must execute all commands in this section.

Install SELinux utility with the dnf command below.

  dnf install policycoreutil's checkpolicy setroubleshoot server 

When the installation is complete, create a new directory & # 39; ~ / zabbix-linux & # 39; and goes into it.

  mkdir -p ~ / zabbix-selinux 
cd ~ / zabbix-selinux /

Now create a new SELinux policy module file & # 39; zabbix_server_add.te & # 39; with the vim editor.

  vim zabbix_server_add.te 

Paste in full wing configuration.

  module zabbix_server_add 1.1; 

require {
type zabbix_var_run_t;
type tmp_t;
type zabbix_t;
class sock_file {create unlink write};
class connectix to_ 1945 connect01];
class process set limit;
class capacity dac_override;
}

# ============= zabbix_t ============= =

# !!!! This avc is allowed in the current policy
to allow zabbix_t self: process setrlimit;

# !!!! This avc is allowed in the current policy
to allow zabbix_t self: unix_stream_socket connectto;

# !!!! This avc is allowed in the current policy
allow zabbix_t tmp_t: sock_file {create unlink write};

# !!!! This avc is allowed in the current policy
allow zabbix_t zabbix_var_run_t: sock_file {create unlink write};

# !!!! This avc is allowed in the current policy
allow zabbix_t self: capability dac_override;

Save and close.

Convert now & # 39; zabbix_server_add.te & # 39; to the policy module using the check module command below. [19659019] check module -M -m -o zabbix_server_add.mod zabbix_server_add.te

Now compile the policy module & # 39; zabbix_server_add.mod & # 39; with the semodule_package command.

  semodule_package -m zabbix_server_add_server_add.sero Then load the compiled policy module & # 39; zabbix_server_add.pp & # 39; to the system. 

  semodule -i zabbix_server_add.pp 

The local custom policy module for Zabbix has been loaded.

 Configure SELinux

Next for additional SELinux configuration. Run the setbool command below.

  setsebool -P httpd_can_network_connect 1 
setsebool -P httpd_can_connect_zabbix 1
setsebool zabbix_can_network on

And the SELinux configuration for Zabbix has been completed.

First, start the zabbix server with the following commands.

  systemctl start zabbix server 
systemctl status zabbix server

Now start the zabbix agent service.

  systemctl start zabbix agent 
systemctl status zabbix agent

And then restart the httpd service.

  systemctl restart httpd 

Then open your browser and type the server's IP address as follows.

http://10.5.5.50/zabbix/

And you get the welcome message from Zabbix.

 Zabbix Web Installer

Click "Next Step & # 39; Button.

Zabbix will now check all system requirements for its installation. Make sure there is no error.

 Check Prerequisites

Click the "Next Step" button.

For database information, enter all your database settings.

 Configure database

And click the "Next Step" button.

Now comes the Zabbix server configuration. Enter your own server IP address in the "Host" field and change the name with your own domain name or host name.

 Zabbix- server information

Click the "Next Step" button again.

Make sure all these configurations are correct and then click "Next button" to install Zabbix.

 installation

And when the installation is complete you get the page shown below.

 Installation succeeded

Click the "Finish" button and you will be redirected to the Zabbix login page.

Login with default user & # 39; admin & # 39; and password & # 39; zabbix ".

 Zabbix login

And you get the standard Zabbix dashboard.

 Zabbix Dashboard

And the Zabbix installation is ready.

Step 8 - Change Default Administrator Password

For the last step, we will change the default Administrator password for zabbix.

On the Zabbix admin dashboard, click the user icon in the upper right corner.

 password

Click the "Change password" button and enter your new password.

 Confirm password

Now click on the "update" button and the default administrator password has been changed.

And Zabbix's installation and configuration on the CentOS 8 system has been completed.

Reference [19659179]

Source link