Help us understand the problem. What is going on with this article?

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

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

https://www.zabbix.com/documentation/4.2/manual/installation/install_from_packages/rhel_centos

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のインストール

https://dev.mysql.com/downloads/repo/yum/

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

参考:

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした