Zabbix7.0を構築する

# １．はじめに
Zabbixを構築する機会があったので、ここに構築手順、
困ったこと、解決方法をまとめていこうと思います。

基本的に忘備録になります。

## １．１．環境構成

| 項目   | 構成内容                      |
|:-------|:-----------------------------|
| OS     | RedHat Enterprise Linux 9.4  |
| Web    | Apache                       | 
| DB     | MySQL                        |
| Zabbix | Zabbix 7.0                   |

# ２．構築
## ２．1．事前作業

OSの構築

ホスト名の設定

IPアドレスの固定
---
最近ifconf？やnmcliで設定するらしい？
ifcfgでファイルいじるの好きだったんだけどなぁ

/etc/NetworkManager/system-connections/
eth0.nmconnection
ここに移ったみたい

```:
# cat eth0.nmconnection
[connection]
id=<接続名っぽい？>
uuid=6469c234-d3fb-3cdf-bb3d-5f360ae84369
type=ethernet
autoconnect-priority=-999
interface-name=eth0

[ethernet]

[ipv4]
address1=<IPアドレス>/MAC,GW
dns=<DNSサーバ1>;<DNSサーバ2>
method=manual　←手動か自動か無効が選べるっぽい

[ipv6]
addr-gen-mode=eui64
method=disabled

[proxy]
←プロキシサーバの情報（あれば記載）
```

hostsの中身を変更する
---
※IPv6に関する記載を無効化する
```:
vi /etc/hosts 

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
#::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
```

SELinuxの無効化
---
ここの項目を無効化しないと不具合が起きるらしい？
（ちょっとわからないので？）
```:
vi /etc/selinux/config

SELINUX=Enforcing → disabled
```

MySQLの導入
---
MySQLのインストール -RedHat-

MySQLの初期設定
```:
mysql_s
mysql_secure_installation  mysql_ssl_rsa_setup
# mysql_secure_installation

Securing the MySQL server deployment.

Connecting to MySQL using a blank password.

VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component?

Press y|Y for Yes, any other key for No: y

There are three levels of password validation policy:

LOW    Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0
Please set the password for root here.

New password:

Re-enter new password:

Estimated strength of the password: 50
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.


Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Success.

By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.


Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
 - Dropping test database...
Success.

 - Removing privileges on test database...
Success.

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.

All done!
#

```


Zabbixの導入
---

https://docs.redhat.com/ja/documentation/red_hat_enterprise_linux/9/html/configuring_and_using_database_servers/assembly_using-mysql_configuring-and-using-database-servers#installing-mysql_assembly_using-mysql