CentOS Stream 10

Zabbix 7.4 : インストール2025/07/18

 

統合監視システム Zabbix 7.4 をインストールして設定します。

[1]

こちらを参考に Apache httpd をインストールして起動しておきます

[2]

こちらを参考に Apache httpd に SSL/TLS の設定を適用しておきます。(必須ではないが推奨)

[3]

こちらを参考に Apache httpd で PHP スクリプトが実行できるよう設定しておきます

[4]

こちらを参考に MariaDB サーバーをインストールして起動しておきます

[5] その他必要なパッケージ、および Zabbix のリポジトリを追加しておきます。
[root@dlp ~]#
dnf -y install php-mysqlnd php-gd php-xml php-bcmath php-ldap

[root@dlp ~]#
dnf -y install https://repo.zabbix.com/zabbix/7.4/release/centos/10/noarch/zabbix-release-latest-7.4.el10.noarch.rpm
[6] Zabbix サーバーをインストールします。
[root@dlp ~]#
dnf --disablerepo=epel -y install zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent2

[7] データベースの設定をしておきます。
[root@dlp ~]#
mysql

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 9
Server version: 10.11.11-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database zabbix character set utf8mb4 collate utf8mb4_bin; 
Query OK, 1 row affected (0.00 sec)

# [password] は任意のパスワードに置き換え
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@'localhost' identified by 'password'; 
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> set global log_bin_trust_function_creators = 1; 
Query OK, 0 rows affected (0.000 sec)

MariaDB [(none)]> exit 
Bye

[root@dlp ~]#
zcat /usr/share/zabbix/sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix

Enter password:  
# 上で設定した MariaDB zabbix ユーザーのパスワード

[root@dlp ~]#
mysql -e "set global log_bin_trust_function_creators = 0;"

[8] Zabbix サーバーを設定して起動します。
[root@dlp ~]#
vi /etc/zabbix/zabbix_server.conf
# 92行目 : 追記

DBHost=localhost
# 125行目 : Zabbix DB のパスワード追記

DBPassword=password
[root@dlp ~]#
systemctl enable --now zabbix-server

[9] SELinux を有効にしている場合は、ポリシーの変更が必要です。
[root@dlp ~]#
setsebool -P httpd_can_connect_zabbix on

[root@dlp ~]#
setsebool -P domain_can_mmap_files on

[root@dlp ~]#
setsebool -P daemons_enable_cluster_mode on

[10] Firewalld を有効にしている場合は、Zabbix 関連ポートの許可が必要です。
[root@dlp ~]#
firewall-cmd --add-service={http,https}

success
[root@dlp ~]#
firewall-cmd --add-port={10051/tcp,10050/tcp}

success
[root@dlp ~]#
firewall-cmd --runtime-to-permanent

success
[11] Zabbix サーバー自身も監視できるよう Zabbix Agent を設定して起動します。
[root@dlp ~]#
vi /etc/zabbix/zabbix_agent2.conf
# 82行目 : Zabbix サーバーを指定

Server=
127.0.0.1
# 135行目 : Zabbix サーバーを指定

ServerActive=
127.0.0.1
# 146行目 : 自身のホスト名に変更

Hostname=
dlp.srv.world
[root@dlp ~]#
systemctl enable --now zabbix-agent2

[12] httpd の設定を変更しておきます。以上で Zabbix サーバーの基本設定は完了です。
[root@dlp ~]#
vi /etc/httpd/conf.d/zabbix.conf
# 12行目 : Web フロントエンドにアクセス許可する範囲
# デフォルトは All 許可のため 必要に応じて変更

#
Require all granted
Require ip 127.0.0.1 10.0.0.0/24
[root@dlp ~]#
systemctl reload httpd php-fpm

関連コンテンツ