LoginSignup
25
30

More than 5 years have passed since last update.

ZABBIX 3.0 を CentOS6.7にインストール

Last updated at Posted at 2016-02-18

はじめに

2016/2/16 にZABBIX 3.0 がリリースされました。RPMパッケージは CentOS7 用となっていましたので、CentOS6 (64bit)にソースファイルからインストールしました。
CentOS6 はminimal インストールを行っています。

PHP5.6 のインストール

Zabbix-3.0はPHPのバージョンが 5.6以上となっているため、epel,remi からインストールを行います。

# rpm -ivh http://ftp-srv2.kddilabs.jp/Linux/distributions/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
# yum --enablerepo=remi,remi-php56 install php php-mysql php-gd php-bcmath php-common php-mbstring php-xml

※epelのミラーサーバが機能していないようですので、レポジトリを修正します。

# vi /etc/yum.repos.d/epel.repo
[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearchfailovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

Apache、MYSQLのインストール

# yum install httpd mysql-server

・ Apache、MYSQLの起動

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

・データベースの作成

パスワードは password としていますので、設定する必要があります。

# mysql -uroot
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'password';
mysql> quit

zabbix-3.0.0 ソースの取得

# yum install wget
# cd /usr/local/src
# wget https://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/3.0.0/zabbix-3.0.0.tar.gz
# tar xfz zabbix-3.0.0.tar.gz

・スキーマの作成

# cd /usr/local/src/zabbix-3.0.0
# mysql -uroot zabbix < database/mysql/schema.sql
# mysql -uroot zabbix < database/mysql/images.sql
# mysql -uroot zabbix < database/mysql/data.sql

zabbix ユーザの作成

# groupadd zabbix
# useradd -g zabbix zabbix

開発環境のインストール

# yum install gcc mysql-devel net-snmp-devel libcurl-devel libxml2-devel

コンパイル

# cd zabbix-3.0.0
# ./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2
# make install

設定

DB名、ユーザ名、パスワードの設定

# vi /usr/local/etc/zabbix_server.conf
DBPassword=password    ←記述

PHPの設定

$ sed -i -e "s/memory_limit = 128M/memory_limit = 256M/g" /etc/php.ini
$ sed -i -e "s/post_max_size = 8M/post_max_size = 16M/g" /etc/php.ini
$ sed -i -e "s/max_execution_time = 30/max_execution_time = 300/g" /etc/php.ini
$ sed -i -e "s/max_input_time = 60/max_input_time = 300/g" /etc/php.ini
$ sed -i -e "s/;date.timezone =/date.timezone = Asia\/Tokyo/g" /etc/php.ini
$ sed -i -e "s/;always_populate_raw_post_data = On/always_populate_raw_post_data = -1/g" /etc/php.ini

Apache の再起動

# service httpd restart

フロントエンドのコピー

# mkdir /var/www/html/zabbix
# cd /usr/local/src/zabbix-3.0.0
# cp -a ./frontends/php/* /var/www/html/zabbix
# cd /var/www/html
# chown -R apache:apache zabbix

Zabbixサーバの起動

# /usr/local/sbin/zabbix_server

その他

iptables の設定

# vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT   ←追加
# service iptables restart

SELINUXを disabled

# vi /etc/sysconfig/selinux
SELINUX=disabled
# setenforce 0

フロントエンドの初期パスワードは、ユーザ名:Admin パスワード:zabbix となります。

ZABBIX 文字化け対策

日本語表示にするとグラフが豆腐になってしまいますので、以下の手順が必要となります。

# cd /var/www/html/zabbix/fonts/
# ln -s /usr/share/fonts/ipa-pgothic/ipagp.ttf ipagp.ttf

もし、ipagp.ttfが無ければ

# yum install ipa-pgothic-fonts
vi /var/www/html/zabbix/include/defines.inc.php
define('ZBX_GRAPH_FONT_NAME',         'DejaVuSans'); // font file name
            ↓ 変更
define('ZBX_GRAPH_FONT_NAME',           'ipagp'); // font file name

参考:Zabbix 2.5(3.0のα版)をソースからAmazon Linuxにインストールしてみた
   http://dev.classmethod.jp/etc/zabbix-2-5-3-0-source-install/

25
30
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
25
30