Zabbix 2.4 を yumでインストール(Zabbix2.4.5 + CentOS7.1.1503)

Zabbix
Zabbix
スポンサーリンク

Zabbixサーバを、CentOS 7.1 (1503) にインストールした時のメモです。サクッと終わるかと思いきや、Zabbixサーバを起動しようとすると「Job for zabbix-server.service failed. See 'systemctl status zabbix-server.service' and 'journalctl -xn' for details.」のエラーが表示されて、起動ができません、、(^^;) 調べてみると GnuTLS のコンパイルオプションに「--without-tpm」を加えて、リビルドする必要があるようです。今回はそちらの手順も合わせてメモしておきました。

Zabbix2.4のインストール

まず始めに、CentOS7.1.1503 に LAMP環境をインストールしておきます。

・Zabbixのyumリポジトリの登録
rpm -ivh http://repo.zabbix.com/zabbix/2.4/rhel/7/x86_64/zabbix-release-2.4-1.el7.noarch.rpm

・インストール(2015/5/4時点のバージョンは 2.4.5-1)
yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-web-japanese
yum -y install zabbix-agent
yum -y install zabbix-get

※ PHP を remi リポジトリからインストールしている場合は「--enablerepo=remi」も指定します。
yum -y install --enablerepo=remi zabbix-server-mysql zabbix-web-mysql zabbix-web-japanese

・Zabbixのyumリポジトリの無効化
vi /etc/yum.repos.d/zabbix.repo
---(下記を変更)---------------------------
[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=http://repo.zabbix.com/zabbix/2.4/rhel/7/$basearch/
enabled=1
 ↓
enabled=0

[zabbix-non-supported]
name=Zabbix Official Repository non-supported - $basearch
baseurl=http://repo.zabbix.com/non-supported/rhel/7/$basearch/
enabled=1
 ↓
enabled=0
------------------------------

GnuTLS 3.3.8 のリビルド「--without-tpm」

冒頭にも書きましたが、Zabbixサーバを起動しようとすると、下記のようなエラーが発生して起動ができません。

# systemctl start zabbix-server
Job for zabbix-server.service failed. See 'systemctl status zabbix-server.service' and 'journalctl -xn' for details.
 

ZABBIX BUGS AND ISSUES サイトによると、この問題は GnuTLS を以下の条件でリビルドすると解決するようです。

It's not a packaging artefact. A manual and stripped down build suffers from the same problems.
A rebuild of gnutls 3.1.18 with everything else left at 7.1 versions works
A hackish build of gnutls 3.1.28 works as well
A 3.3.8 rebuild works, if built --without-tpm (trousers)

GnuTLS の古いバージョンには、脆弱性があるようなので、今回は、GnuTLS3.3.8に「--without-tpm」を加えてビルドしました。

・GnuTLS のビルドに必要なライブラリのインストール
yum -y install nettle-devel
yum -y install p11-kit-devel
yum -y install readline-devel
yum -y install libtasn1-devel
yum -y install texinfo
yum -y install autogen-libopts-devel
yum -y install libidn-devel
yum -y install gperf
yum -y install unbound-devel

・GnuTLS のソースのダウンロードと解凍
wget ftp://ftp.gnutls.org/gcrypt/gnutls/v3.3/gnutls-3.3.8.tar.xz
tar Jxvf gnutls-3.3.8.tar.xz

・GnuTLS のコンパイルオプションに「--without-tpm」を加えて、インストール
cd gnutls-3.3.8/
./configure --without-tpm \
--build=x86_64-redhat-linux-gnu \
--host=x86_64-redhat-linux-gnu \
--prefix=/usr \
--exec-prefix=/usr \
--bindir=/usr/bin \
--sbindir=/usr/sbin \
--sysconfdir=/etc \
--datadir=/usr/share \
--includedir=/usr/include \
--libdir=/usr/lib64 \
--libexecdir=/usr/libexec \
--localstatedir=/var \
--sharedstatedir=/var/lib \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--disable-static \
--disable-openssl-compatibility \
--disable-srp-authentication \
--disable-non-suiteb-curves \
--enable-fips140-mode \
--disable-guile \
--with-unbound-root-key-file=/var/lib/unbound/root.key \
--disable-rpath

make
sudo make install

・yum で GnuTLS を更新しないように設定しておきます。
vi /etc/yum.conf
---(下記を追加)---------------------------
[main]
(略)
exclude=gnutls
------------------------------

・OSを再起動します
shutdown -r now

今回は、オリジナルのソースファイルから GnuTLS をビルドしてインストールしましたが、RPMのコンパイルオプションを変更してインストールする方法もあります。よければご参照ください。

Zabbix用のデータベースの作成

・MySQLにZabbix用のDBとユーザを作成
mysql -u root -p
---(下記を実行)---------------------------
・Zabbix用DBの作成
create database zabbix character set utf8;

・Zabbix用ユーザの作成
grant all privileges on zabbix.* to zabbix@localhost identified by '<パスワード>';

・設定を反映
FLUSH PRIVILEGES;
exit
------------------------------

・Zabbix用のDBスキーマとデータをインポート
mysql -uroot -p zabbix < /usr/share/doc/zabbix-server-mysql-2.4.5/create/schema.sql mysql -uroot -p zabbix < /usr/share/doc/zabbix-server-mysql-2.4.5/create/images.sql mysql -uroot -p zabbix < /usr/share/doc/zabbix-server-mysql-2.4.5/create/data.sql

Zabbix2.4の設定

・Zabbixサーバの設定
vi /etc/zabbix/zabbix_server.conf
---(下記を変更)---------------------------
# DBPassword=

DBPassword=<パスワード>
------------------------------

・Zabbixサーバの起動
systemctl start zabbix-server

・Zabbixサーバの自動起動を設定
systemctl enable zabbix-server

また、動作を確認するため、Zabbixエージェントも起動しておきます
systemctl start zabbix-agent
systemctl enable zabbix-agent

・Zabbixエージェントの動作確認
zabbix_get -s 127.0.0.1 -p 10050 -k agent.version
------------------------------
2.4.5
------------------------------
上のように、Zabbixのバージョンが表示されれば、起動しています

初期設定

ブラウザで下記URLを開き、初期設定を開始します(ホスト名はご自分の環境に読替えてください)
http://centos71/zabbix/

「Next」をクリックします
1-Welcome

すべて「OK」であれば「Next」をクリックします
2-Checkofpre-requisites

「User」に「zabbix」を 「Password」に、MySQLで設定したパスワードを入力し、
「Test connection」をクリックします
3-ConfigureDBconnection

「OK」と表示されれば、正しくMySQLと接続できています。続けて「Next」をクリックします
3-ConfigureDBconnection

そのまま「Next」をクリックします
4-ZabbixServerDetails

そのまま「Next」をクリックします
5-Pre-InstallationSummary

「Finish」をクリックすれば、初期設定完了です
6-Install

設定が終了すると、Zabbixのログイン画面が表示されますので、初期ユーザでログインします
Username:admin
Password:zabbix
zabbix24-login

パスワードと言語の変更

[Administration]→[Users] をクリックします
Administration-Users

Members列の「Admin (Zabbix Administrator)」をクリックします
Admin (Zabbix Administrator)

Userタブを選択し、「Change password」をクリックします
ClickChangePassword

パスワードの入力欄が表示されますので、パスワードを入力し、
「Language」を「Japanese(ja_JP)」に変更したら「Update」をクリックします
chengeLanguageAndPassword

一度ブラウザをリロードすると日本語表示になります
JapaneseDisplay

終わりに

Zabbixの基本的な設定や、監視テンプレートの設定などは下記をご参照ください。

▽ ZabbixでLAMPサーバを監視設定メモ(Zabbix 2.4 CentOS6.6)
https://blog.apar.jp/zabbix/1046/

コメント

  1. xJoker より:

    どうもありがとうございます!
    問題が解決 !

タイトルとURLをコピーしました