LoginSignup
0
1

More than 3 years have passed since last update.

CentOS 7でZabbix Server 4.2 + MySQL 8.0の構築

Last updated at Posted at 2019-09-05

公式のWikiを読んでやるだけ。

Zabbixのインストール

rpm -ivh https://repo.zabbix.com/zabbix/4.2/rhel/7/x86_64/zabbix-release-4.2-1.el7.no
arch.rpm
yum-config-manager --enable rhel-7-server-optional-rpms
yum install zabbix-server-mysql zabbix-agent

MySQLのインストール

rpm -ivh https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
yum install mysql

/etc/my.cnf に以下の設定を追記

my.cnf
default_authentication_plugin= mysql_native_password

PHPのタイムゾーンを設定

/etc/php.ini
[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = "Asia/Tokyo"

MySQLの設定

/var/log/mysqld.log にrootの初期パスワードが出力されているので以下で確認

$ grep -i password /var/log/mysqld.log
2019-09-05T09:29:23.076431Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: u30^$3f%2#f7

MySQLを起動

systemctl start mysqld
systemctl enable mysqld

MySQLのセットアップ

msyql_secure_installation

MySQLにデータベースとユーザを作成

$ mysql -u root -p
> create user ゆーざ@localhost identified with mysql_native_password by 'ぱすわーど';
> grant all on でーたべーすめい.* to 'ゆーざ'@'localhost';

ここで mysql_native_password がないとZabbix-Serverから接続できず怒られる。

データベースダンプを流し込み

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

日本語化

$ yum install -y vlgothic-p-fonts

$ ls /usr/share/fonts/vlgothic
VL-Gothic-Regular.ttf  VL-PGothic-Regular.ttf

$ cd /etc/alternatives
$ ls -alF zabbix*
lrwxrwxrwx 1 root root 29  9月  4 21:15 zabbix-server -> /usr/sbin/zabbix_server_mysql*
lrwxrwxrwx 1 root root 38  9月  4 21:16 zabbix-web-font -> /usr/share/fonts/dejavu/DejaVuSans.ttf

$ ln -sf /usr/share/fonts/vlgothic/VL-PGothic-Regular.ttf ./zabbix-web-font

$ ls -laF zabbix*
lrwxrwxrwx 1 root root 29  9月  4 21:15 zabbix-server -> /usr/sbin/zabbix_server_mysql*
lrwxrwxrwx 1 root root 48  9月  8 14:51 zabbix-web-font -> /usr/share/fonts/vlgothic/VL-PGothic-Regular.ttf

Firewalldの設定を投げ込む

firewall-cmd --add-service=httpd --zone=public --permanent
firewall-cmd --add-port=10051/tcp --zone=public --permanent
firewall-cmd --add-port=10050/tcp --zone=public --permanent
firewall-cmd --reload

Zabbixを起動

systemctl start httpd zabbix-server zabbix-agent
systemctl enable httpd zabbix-server zabbix-agent

ブラウザからZabbixへアクセス

Agentの導入(CentOS 7)

rpm -ivh https://repo.zabbix.com/zabbix/4.2/rhel/7/x86_64/zabbix-release-4.2-1.el7.noarch.rpm
yum install -y zabbix-agent

cp /etc/zabbix/zabbix_agentd.conf{,.org}
sed -i 's/Server=127.0.0.1/Server=(Zabbix Server Address)/g' /etc/zabbix/zabbix_agentd.conf

systemctl restart zabbix-agent
systemctl enable zabbix-agent

firewall-cmd --add-port=10050/tcp --zone=public --permanent
firewall-cmd --reload

Agentの導入(Ubuntu 18.04)

wget https://repo.zabbix.com/zabbix/4.2/ubuntu/pool/main/z/zabbix-release/zabbix-release_4.2-1+bionic_all.deb
sudo dpkg -i zabbix-release_4.2-1+bionic_all.deb
sudo apt update
sudo apt install zabbix-agent

sudo cp /etc/zabbix/zabbix_agentd.conf{,.org}
sudo sed -i 's/Server=127.0.0.1/Server=(Zabbix Server Address)/g' /etc/zabbix/zabbix_agentd.conf

sudo systemctl restart zabbix-agent
sudo systemctl enable zabbix-agent

参考:

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1