LoginSignup
6
7

More than 5 years have passed since last update.

Zabbix 4.0をインストールしてみた(Cent7 + PostgreSQL)

Posted at

ひとまずzabbix4を触ってみたかったので、最小限の設定で行いました。

※参考:公式ドキュメント
https://www.zabbix.com/documentation/4.0/manual/installation/install_from_packages/rhel_centos

構成

OS : CentOS Linux release 7.5.1804
DB : psql (PostgreSQL) 9.2.24
Zabbix : zabbix 4.0.0

OS設定

まずは最新化

yum update

適用させるために再起動

reboot

今回はセキュリティ面は全て無視するために、firewallとSELinuxをOFF

systemctl stop firewalld
systemctl disable firewalld
vi /etc/selinux/config
 SELINUX=enforcing ⇒ SELINUX=disable

設定を反映させるために再起動

reboot

Zabbixインストール

リポジトリの登録

rpm -ivh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm

パッケージインストール

yum install zabbix-server-pgsql zabbix-web-japanese

PostgreSQL

インストール

yum install postgresql-server 

データベースの初期化

postgresql-setup initdb

PostgreSQLの起動

systemctl start postgresql
systemctl enable postgresql

ZabbixからDBアクセスするためのユーザーを作成

sudo -u postgres createuser --pwprompt zabbix

DBを作成

sudo -u postgres createdb -O zabbix -E Unicode -T template0 zabbix

PostgreSQLへのアクセス設定を行う

vi /var/lib/pgsql/data/pg_hba.conf

コメントアウトされていない箇所のpeerとidentをtrustに修正し、以下のようにする

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                    trust
# IPv4 local connections:
host    all             all             127.0.0.1/32           trust
# IPv6 local connections:
host    all             all             ::1/128                trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local   replication     postgres                                peer
#host    replication     postgres        127.0.0.1/32            ident
#host    replication     postgres        ::1/128                 ident

設定反映のために再起動

systemctl restart postgresql

初期スキーマ、データをインポート

zcat /usr/share/doc/zabbix-server-pgsql*/create.sql.gz | sudo -u zabbix psql zabbix

Zabbix設定ファイル更新

vi /etc/zabbix/zabbix_server.conf

以下2つを設定
DBPassword=password(DBユーザーのパスワード)
DBPort=5432

PHP timezone設定

Zabbixインストール時に、timezoneが設定されていないとNGとなってしまうため、設定する

vi /etc/php.ini

;date.timezone =
⇒date.timezone = Asia/Tokyo

起動設定されていないものを設定

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

Webコンソールにアクセス

http://IPアドレス/zabbix/
にアクセス

設定項目は、上記で設定した内容を入力すればよい
Database port : 5432
Database name : zabbix
Database schema : 空欄
User : zabbix
Password : zabbixユーザーのパスワード

Admin/zabbixでログイン可能に

6
7
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
6
7