zabbix3.0安裝註意: 1、PHP要5.4版本以上 2、防火牆關閉 3、selinux關閉 操作步驟 一、安裝PHP 添加 epel 源 # rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6- ...
zabbix3.0安裝註意:
1、PHP要5.4版本以上 2、防火牆關閉 3、selinux關閉 操作步驟 一、安裝PHP添加 epel 源
# rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
添加 remi 源
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
安裝 PHP資料庫及其他插件
# yum --enablerepo=remi,remi-php55 install php-fpm php-common php-devel php-mysqlnd php-mbstring php-mcrypt httpd php mysql mysql-server php-mysql php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc php-bcmath mysql-connector-odbc mysql-devel libdbi-dbd-mysql net-snmp-devel curl-devel mod_ssl mod_perl mod_auth_mysql net-snmp
查看 PHP 版本
# php -v PHP 5.5.9 (cli) (built: Feb 11 2014 08:25:33) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
二、mysql配置
創建zabbix庫
create database zabbix
創建用戶並授權
grant all on zabbix.* to zabbix@“%” identified by ‘zabbix’;
flush privileges;
三、安裝zabbix
安裝插件
yum --enablerepo=remi,remi-php55 install mysql-devel libxml2-devel net-snmp-devel libcurl-devel
1、下載zabbix 3.0包
wget https://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/3.0.1/zabbix-3.0.1.tar.gz/download --no-check-certificate
tar xf zabbix-3.0.1.tar.gz
cd zabbix-3.0.1
groupadd zabbix
useradd -g zabbix zabbix
./configure --prefix=/usr/local/zabbix-server --enable-server --with-mysql --with-net-snmp --with-libcurl --with-libxml2
make install
導入數據文件
cd /opt/zabbix-3.0.1/database/mysql
/usr/local/mysql/bin/mysql -uzabbix -p zabbix < schema.sql //導入順序不能錯
/usr/local/mysql/bin/mysql -uzabbix -p zabbix < images.sql
/usr/local/mysql/bin/mysql -uzabbix -p zabbix < data.sql
2.編輯配置文件並啟動:
日誌預設在/tmp目錄下
vim /usr/local/zabbix-server/etc/zabbix_server.conf
------------------------------------------------------------->
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
ListenIP=127.0.0.1
<-------------------------------------------------------------
/usr/local/zabbix-server/sbin/zabbix_server -c /usr/local/zabbix-server/etc/zabbix_server.conf //啟動服務
查看埠,已經開始監聽了:
3、拷貝zabbix應用到WEB根目錄下
cd zabbix-3.0.1/frontends/php/
cp -a . /var/www/html/zabbix/
chown -R apache.apache /var/www/html/zabbix/*
4、配置php並啟動httpd:
vim /etc/php.ini
----------------------------------------->
date.timezone = Asia/Shanghai
post_max_size = 16M
max_execution_time = 300
max_input_time = 300
----------------------------------------->
service httpd start
用瀏覽器訪問http://192.168.19.76/zabbix,並按照提示安裝:
在操作連接資料庫時可能會出現
The frontend does not match Zabbix database. Current database version (mandatory/optional): 2050061/2050061. Required mandatory version: 3000000. Contact your system administrator.
遇到這種問題需要刪除一下創建的zabbix庫,然後在從新導入zabbix庫文件。
這裡出現許可權報錯,將配置文件下載下來保存到/var/www/html/zabbix/conf/zabbix.conf.php文件中。如果手動寫入配置文件之後如果還報錯,可以忽略,將瀏覽器關閉並重新打開連接即可。登錄賬號admin,登錄密碼zabbix:
vim /var/www/html/zabbix/conf/zabbix.conf.php //手動寫入配置
---------------------------------------------------------->
<?php
// Zabbix GUI configuration file.
global $DB;
$DB['TYPE'] = 'MYSQL';
$DB['SERVER'] = ‘127.0.0.1';
$DB['PORT'] = '0';
$DB['DATABASE'] = 'zabbix';
$DB['USER'] = 'zabbix';
$DB['PASSWORD'] = ‘zabbix';
// Schema name. Used for IBM DB2 and PostgreSQL.
$DB['SCHEMA'] = '';
$ZBX_SERVER = ‘127.0.0.1';
$ZBX_SERVER_PORT = '10051';
$ZBX_SERVER_NAME = '';
$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
?>
四、開啟zabbix對中文的支持
原來zabbix預設把對中文的支持給關閉了,我們需要修改zabbix的php源文件. 修改站點根目錄下include/locales.inc.php文件.
- # vim include/locales.inc.php
- function getLocales() {
- return array(
- 'en_GB' => array('name' => _('English (en_GB)'), 'display' => true),
- 'en_US' => array('name' => _('English (en_US)'), 'display' => true),
- 'bg_BG' => array('name' => _('Bulgarian (bg_BG)'), 'display' => true),
- 'zh_CN' => array('name' => _('Chinese (zh_CN)'), 'display' => true),
- //原本這裡為false,請改為true
- ...........代碼省略掉........
- );
- }