Zabbixをインストールする

最近Zabbixも使うので、インストール方法の備忘メモ。

環境は以下の通りです。

  • CentOS6.5(64bit版)
  • Apache 2.2.15
  • PHP 5.3.3
  • MySQL 5.1.71
  • Zabbix 2.2.1

インストールの準備


Apache, PHP, MySQLを先にインストールしておきます。

# yum install httpd mod_ssl
# yum install php-common php-bcmath php-mysql php php-xml php-pdo php-cli php-mbstring php-gd
# yum install mysql mysql-server mysql-libs


続いてライブラリ関係をインストール。

# yum install http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# yum install --enablerepo=epel fping iksemel curl openldap OpenIPMI net-snmp unixODBC


Apache/MySQLは起動しておきます。

# chkconfig httpd on
# service httpd start
# chkconfig mysqld on
# service mysqld start

Zabbixのインストール


Zabbixの公式リポジトリからRPMパッケージをダウンロードします。

# yum install http://repo.zabbix.com/zabbix/2.2/rhel/6/x86_64/zabbix-release-2.2-1.el6.noarch.rpm


Zabbixをインストールします。

# yum install --enablerepo=zabbix zabbix zabbix-server-mysql zabbix-web zabbix-web-mysql zabbix-web-japanese zabbix-agent zabbix-get

セットアップ


データベースをセットアップします。

 mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3187
Server version: 5.1.71 Source distribution

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> CREATE DATABASE zabbix CHARACTER SET utf8;
mysql> GRANT ALL PRIVILEGES ON zabbix.* TO zabbix@localhost IDENTIFIED BY '<your password>';


テーブル定義を行います。

# cd /usr/share/doc/zabbix-server-mysql-2.2.1/create/
# mysql -uroot zabbix < schema.sql
# mysql -uroot zabbix < images.sql
# mysql -uroot zabbix < data.sql


PHPタイムゾーン設定をします。Apacheを再起動しておきます。

# vi /etc/php.ini
date.timezone='Asia/Tokyo'


DBのパスワードを「/etc/zabbix/zabbix_server.conf」に記述しておきます。

# vi /etc/zabbix/zabbix_server.conf
DBPassword=<your password>


以降はGUIで初期設定を行います。ウィザードに従って進めるだけなので、難しくはないと思います。
「http:///zabbix/」 にブラウザでアクセスします。









Zabbixを起動すれば、セットアップはOK。

# service zabbix-agent start
# service zabbix-server start


今日はこんなところで。