Zabbix 2.0.4をCentOS6.3にインストールした際の備忘録

環境 :AmazonWebServices(AWS)
AMI  :suz-lab_centos-core-6.3.8 (ami-2b9d192a)
OS   :CentOS release 6.3 (Final)

素人の自分でもインストールできます。Zabbix2.0.Xのインストール備忘録が少なかったので参考程度にアップします。インストール先はAWS-EC2初期セットアップ済みのCentOS release 6.3です足りないパッケージなどがあるかと思いますので、そこは皆さんの環境に合わせて下さい。

■httpdとMysqlをインストールします。
#yum -y install httpd mysql-server php php-mysql

■Zabbix20をキーワードに検索するとパッケージが出てきました。
ちなみにZabbixとだけ入力すると 1.8.X=古い版 2.0.X=最新版がそれぞれ出てきます

# yum list | grep zabbix20
zabbix20.x86_64                                 2.0.4-3.el6                 @epel
zabbix20-server.x86_64                      2.0.4-3.el6                 @epel
zabbix20-server-mysql.x86_64            2.0.4-3.el6                 @epel
zabbix20-agent.x86_64                       2.0.4-3.el6                 epel
zabbix20-proxy.x86_64                       2.0.4-3.el6                 epel
zabbix20-proxy-mysql.x86_64             2.0.4-3.el6                 epel
zabbix20-proxy-pgsql.x86_64              2.0.4-3.el6                 epel
zabbix20-proxy-sqlite3.x86_64            2.0.4-3.el6                 epel
zabbix20-server-pgsql.x86_64             2.0.4-3.el6                 epel
zabbix20-web.noarch                           2.0.4-3.el6                 epel
zabbix20-web-mysql.noarch                 2.0.4-3.el6                 epel
zabbix20-web-pgsql.noarch                  2.0.4-3.el6                 epel

# yum list installed zabbix  ←最終的には下記のパッケージをインストールしました。
zabbix20.x86_64                  2.0.4-3.el6                @epel
zabbix20-agent.x86_64            2.0.4-3.el6                @epel
zabbix20-server.x86_64           2.0.4-3.el6                @epel
zabbix20-server-mysql.x86_64     2.0.4-3.el6                @epel
zabbix20-web.noarch              2.0.4-3.el6                @epel
zabbix20-web-mysql.noarch        2.0.4-3.el6                @epel

# vi /etc/my.cnf            ←Mysqlの設定ファイルを編集

# Disabling symbolic-links is recommended to prevent assorted security risks

symbolic-links=0

↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
skip-character-set-client-handshake
character-set-server = utf8
collation-server = utf8_general_ci
init-connect = SET NAMES utf8
innodb_file_per_table
※上記5行を追加しました

# /etc/rc.d/init.d/mysqld start   ←Mysqlを起動
MySQL データベースを初期化中:  Installing MySQL system tables…

# mysql_secure_installation    ←Mysql初期インストールを行う
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we’ll need the current
password for the root user.  If you’ve just installed MySQL, and
you haven’t set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on…

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n]
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
… Success!

By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n]
… Success!

Normally, root should only be allowed to connect from ‘localhost’.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n]
… Success!

By default, MySQL comes with a database named ‘test’ that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n]
– Dropping test database…
… Success!
– Removing privileges on test database…
… Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n]
… Success!

Cleaning up…

All done!  If you’ve completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!

# mysql -u root -p          ←Mysqlにログインし、ユーザ(zabbix)とDB(zabbix)を作成する
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 12
Server version: 5.5.30-cll MySQL Community Server (GPL) by Atomicorp

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> grant all privileges on zabbix.* to zabbix@localhost identified by ‘XXXXXXX’;
Query OK, 0 rows affected (0.00 sec)

mysql> create database zabbix character set utf8;
Query OK, 1 row affected (0.00 sec)

mysql> exit
Bye

# cd /usr/share/zabbix-mysql/           ←初期DBをインポートする
# mysql -u zabbix -p zabbix  < schema.sql
# mysql -u zabbix -p zabbix  < schema.sqlimages.sql
# mysql -u zabbix -p zabbix  < images.sql  data.sql

# vi /etc/zabbix/zabbix_server.conf        ←zabbixの設定ファイルを編集
### Option: DBName
#       Database name.
#       For SQLite3 path to database file must be provided. DBUser and DBPassword are ignored.
#
# Mandatory: yes
# Default:
# DBName=

DBName=zabbix

### Option: DBUser
#       Database user. Ignored for SQLite.
#
# Mandatory: no
# Default:
# DBUser=

DBUser=zabbix

### Option: DBPassword
#       Database password. Ignored for SQLite.
#       Comment this line if no password is used.
#
# Mandatory: no
# Default:
# DBPassword=

DBPassword= XXXXXXXXX

# /etc/rc.d/init.d/zabbix-server start         ←zabbix-serverを起動させる
Starting Zabbix server: [  OK  ]
# tail -f /bavar/lozag/zabbix/zabbix_server.log
16166:20130208:122339.935 server #0 started [main process]
16215:20130208:122339.953 server #26 started [self-monitoring #1]
16180:20130208:122340.139 server #7 started [poller #5]
16174:20130208:122340.145 server #3 started [poller #1]
16177:20130208:122340.147 server #5 started [poller #3]
16181:20130208:122340.148 server #8 started [unreachable poller #1]
16179:20130208:122340.151 server #6 started [poller #4]
16175:20130208:122340.154 server #4 started [poller #2]
16201:20130208:122340.175 server #19 started [discoverer #1]
16194:20130208:122340.186 housekeeper deleted: 0 records from history and trends, 0 records of deleted items, 0 events, 0 alerts, 0 sessions

# /etc/rc.d/init.d/hrttpd start         ←httpも起動させる
httpd を起動中: [  OK  ]

Webブラウザでインストールしたインスタンスへ接続、パブリックDNS名でもプライベートIPでもOk!!

ウィザードを進めたら、PHP関係のパラメータが要件を満たしていないと怒られた。

PHPパラメータを変更します

# vi /etc/php.ini                 ←PHPの設定ファイルを編集

; Maximum size of POST data that PHP will accept.
; Its value may be 0 to disable the limit. It is ignored if POST data reading
; is disabled through enable_post_data_reading.
; http://php.net/post-max-size
post_max_size = 8M

; Maximum execution time of each script, in seconds
; http://php.net/max-execution-time
; Note: This directive is hardcoded to 0 for the CLI SAPI
max_execution_time = 30

; Maximum amount of time each script may spend parsing request data. It’s a good
; idea to limit this time on productions servers in order to eliminate unexpectedly
; long running scripts.
; Note: This directive is hardcoded to -1 for the CLI SAPI
; Default Value: -1 (Unlimited)
; Development Value: 60 (60 seconds)
; Production Value: 60 (60 seconds)
; http://php.net/max-input-time
max_input_time = 60

# /etc/rc.d/init.d/httpd restart

httpdを再起動してみる

先ほど要件を満たしていなかった項目が緑色になった 次はDBの情報を入力

zabbixの画面に表示するホスト名を入力する

設定内容を確認して次へ進む

ログイン画面をキャプチャするのを忘れました。

http://XXXXXXXXXX/zabbix を開いて ID:admin PASS:zabbixでログインして下さい。

言語を日本語 目に優しい? 黒と青の画面に変更してみました。

zabbix-serverをインストールしたが、agentをインストールしていなかった。ログや状態が取得できないと5分ほど悩んだことは内緒です

# yum liist | grep zabbix20-agent.x86_64
# yum -y install zabbix20-agent.x86_64

追記:画像が喪失したので再度UPしました

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