LoginSignup
0
2

More than 5 years have passed since last update.

Zabbix3.0をインストールしてみる

Last updated at Posted at 2017-07-30

環境

AWSのEC2に作ってみる。
LAMP環境を構築、Zabbixサーバをインストールしていく。
L:RHEL7.3
A:Apache #バージョン未指定
M:MariaDB10.2 #MySQLから変えてみる
P:PHP5.6 #最新7.はZabbix未対応のようなので
バージョンは以下を参考に。
http://www.zabbix.jp/documents/requirements
yumを使っていく。

やってみる

1.リポジトリを登録

・準備
sudo su -
yum -y update
・Zabbix
rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
・EPEL
rpm -ivh http://ftp-srv2.kddilabs.jp/Linux/distributions/fedora/epel/7/x86_64/e/epel-release-7-9.noarch.rpm
・IUS
rpm -ivh http://dl.iuscommunity.org/pub/ius/stable/Redhat/7/x86_64/ius-release-1.0-15.ius.el7.noarch.rpm
・MariaDB

/etc/yum.repos.d/MariaDB.repo
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.2/rhel7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

2.パッケージインストール

・PHP5.6で(Apacheも)
yum install -y php56u

・Zabbixサーバ
yum install -y zabbix-web-mysql zabbix-web-japanese zabbix-agent zabbix-get
※以前のバージョンから必要なパッケージが変更されている。zabbix zabbix-serverパッケージは指定不要。

・MariaDB
yum -y install MariaDB-server MariaDB-client

3.初期設定

・MariaDB
MySQLサンプル設定ファイルをMariaDB設定ファイルへコピーして編集する
ls -l /etc/my.cnf
ls -l /usr/share/mysql/my-*.cnf
cp -p /usr/share/mysql/my-large.cnf /etc/my.cnf.d/server.cnf

/etc/my.cnf.d/server.cnf
[client]
default-character-set = utf8    ###### 追加 
[mysqld]
character-set-server = utf8     ###### 追加

4.MariaDB起動

・MariaDB
systemctl enable mariadb
systemctl start mariadb
systemctl status mariadb

5.MariaDB初期設定

対話型ツールを使い、ルートユーザパスワード設定、デフォルトのテストDBの削除などを実行する
mysql_secure_installation

Enter current password for root (enter for none):   ###### Enter
Set root password? [Y/n] y   ###### y
New password: ###### パスワード入力
Re-enter new password: ###### パスワード入力
Remove anonymous users? [Y/n] y  ###### y
Disallow root login remotely? [Y/n] y ###### y
Remove test database and access to it? [Y/n] y ###### y
Reload privilege tables now? [Y/n] y ###### y

6.データベース作成

mysql -u root -p
mysql> CREATE USER zabbix;
mysql> CREATE DATABASE zabbix;
mysql> GRANT ALL PRIVILEGES ON zabbix.* TO zabbix@localhost IDENTIFIED BY 'DBパスワード';
mysql> FLUSH PRIVILEGES;
mysql> exit

7.テーブル作成と初期データを投入

cd /usr/share/doc/zabbix-server-mysql-3.0.10/
zcat create.sql.gz | mysql -u root -p zabbix

8.設定ファイル編集いろいろ

・Zabbixサーバ

/etc/zabbix/zabbix_server.conf
DBパスワードを設定
 DBName=zabbix
 DBUser=zabbix
 DBPassword=DBパスワード

・PHP設定ファイル
タイムゾーンを日本へ
sed -i -e "s/;date.timezone =/date.timezone = Asia\/Tokyo/g" /etc/php.ini

・Apache設定ファイル
タイムゾーンを日本へ

/etc/httpd/conf.d/zabbix.conf
php_value date.timezone Asia/Tokyo   ###### 追記

・SELinuxを無効化
getenforce
setenforce 0

/etc/selinux/config
SELINUX=permissive

9.起動

Apache
systemctl enable httpd
systemctl start httpd
Zabbix agent
systemctl enable zabbix-agent
systemctl start zabbix-agent
Zabbix server
systemctl enable zabbix-server
systemctl start zabbix-server

10.完了!

http:// zabbixサーバアドレス /zabbix
で初期セットアップGUIへログインできます
ID:Admin
PW:zabbix

参考:
MariaDB
https://downloads.mariadb.org/mariadb/repositories/

0
2
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
0
2