LoginSignup
2
5

More than 5 years have passed since last update.

[Zabbix 4.0][Ubuntu 18.04] Zabbix環境構築手順

Last updated at Posted at 2019-04-04

TL;DR

以下の記事を参考にZabbix環境を構築しようとしたところ、
バージョンの違いによりコピペできなかった部分があったため、読み替えポイントをメモ。
[Zabbix 3.2][Ubuntu 16.04] Zabbix環境構築手順まとめ

元記事との環境比較

Reference_env my_env
OS Ubuntu 16.04 LTS / 64bit Ubuntu 18.04 LTS / 64bit
Zabbix 3.2 4.0
PostgreSQL 9.5 10.6
  • 元記事の公開後にリリースされたUbuntu 18.04 LTSを採用
  • zabbix3系が既にサポート切れのためzabbix 4.0 LTSを採用
  • パッケージの依存関係によりPostgreSQL 9.5 -> 10.6

元記事から具体的に読み替えた箇所

Zabbixのリポジトリの設定

  • パッケージをwgetするリポジトリ先を変更
$ wget http://repo.zabbix.com/zabbix/4.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_4.0-2+bionic_all.deb

※ Ubuntu 18.04のコードネームがBionic Beaver( cf.https://ja.wikipedia.org/wiki/Ubuntu )なので対応するファイルをリストから選択する。

参考画像

image.png

依存パッケージのインストール

$ apt-get install php7.2-bcmath php7.2-xml php7.2-mbstring php7.2-pgsql

失敗例

$ sudo apt-get install php7.0-bcmath php7.0-xml php7.0-mbstring php7.0-pgsql
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php7.0-bcmath
E: Couldn't find any package by glob 'php7.0-bcmath'
E: Couldn't find any package by regex 'php7.0-bcmath'
E: Unable to locate package php7.0-xml
E: Couldn't find any package by glob 'php7.0-xml'
E: Couldn't find any package by regex 'php7.0-xml'
E: Unable to locate package php7.0-mbstring
E: Couldn't find any package by glob 'php7.0-mbstring'
E: Couldn't find any package by regex 'php7.0-mbstring'
E: Unable to locate package php7.0-pgsql
E: Couldn't find any package by glob 'php7.0-pgsql'
E: Couldn't find any package by regex 'php7.0-pgsql'

zabbix 用のDBの作成

  • PostgreSQLのインストール時は特に意識する必要は無いが、10系になったことでpg_hba.confのパスが変わっており、設定時に元記事の例をコピペできないので注意
$ sudo sed -i -e '/^local.*all.*all.*/s/peer/trust/' /etc/postgresql/10/main/pg_hba.conf

結果

image.png
<中略>
image.png


Appendix.

作成したDBの初期化

  • 元記事のコマンドをそのまま実行するとパーミッションエラーとなるので直前の設定に倣って次のように実行
$ zcat /usr/share/doc/zabbix-server-pgsql/create.sql.gz | sudo -u postgres psql -U postgres zabbix
2
5
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
2
5