Zabbix3.0LTS安裝

基礎環境:

Nginx:1.8.1

Mysql:5.6.29

PHP:5.5.30(zabbix_3.0要求PHP版本在5.4以上)


一、安裝LNMP

1、安裝過程在此不再敘述,請參考其他文章

2、注意:PHP編譯時,須帶上--with-mysqli=mysqlnd和--with-gettext支持Zabbix


二、安裝Zabbix

1、提示:官方安裝文檔:https://www.zabbix.com/documentation/3.0/manual/installation/install

2、下載源碼包:

shell>wget http://www.zabbix.com/download.php


3、yum安裝基礎環境

shell>yum install mysql-dev gcc net-snmp-devel curl-devel perl-DBI php-gd php-mysql php-bcmath php-mbstring php-xm


4、添加zabbix用戶

shell>useradd zabbix -s /sbin/nologin


5、編譯安裝

shell>tar xf zabbix-3.0.1.tar.gz;cd zabbix-3.0.1

shell>./configure --prefix=/opt/app/zabbix --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2

shell>make install

參數說明

―prefix=爲指定安裝目錄

―enable-server爲安裝zabbix服務端程序

―enable-agent爲安裝agent程序

―with-mysql爲使用mysql數據庫

―enable-ipv6爲啓用ipv6支持

―with-net-snmp爲啓用snmp支持

―with-libcurl爲啓用curl

―with-libxml2編譯xml模塊,主要用於監控vm虛擬機


6、創建MySQL庫和zabbix讀寫賬戶

mysql>create database zabbix character set utf8 collate utf8_bin;

mysql>grant all privileges on zabbix.* to zabbix@'%' identified by '<password>';

mysql>flush privileges;


7、進入到MySQL數據目錄,按照順序導入數據到zabbix庫

shell>cd /opt/src/zabbix-3.0.1/database/mysql/

mysql>mysql -uroot -p  zabbix < schema.sql

mysql>mysql -uroot -p  zabbix < images.sql

mysql>mysql -uroot -p  zabbix < data.sql


8、增加和修改zabbix配置文件

shell>vim /opt/app/zabbix/etc/zabbix_server.conf

DBName=zabbix #數據庫名稱 

DBUser=zabbix #數據庫用戶名 

DBPassword= #數據庫密碼 

DBPort= #數據庫端口

ListenIP=0.0.0.0

AlertScriptsPath=/opt/app/zabbix/alertscripts #zabbix運行腳本存放目錄


9、啓動zabbix server

shell>/opt/app/zabbix/sbin/zabbix_server

如有報錯,查找zabbix錯誤日誌


10、設置PHP.ini參數

shell>vim $PHP_PATH/php.ini 主要爲下面幾個參數

PHP option post_max_size 16M

PHP option max_execution_time 300

PHP option max_input_time 300

PHP time zone Asia/Shanghai


11、啓動PHP

shell>service php-fpm start


12、配置Zabbix Web環境

shell>cd zabbix-3.0.1/frontends/

shell>cp -rf php /data/wwwroot/zabbix.xxx.com

shell>cd /data/wwwroot/zabbix.xxx.com/conf/

shell>chown www.www -R zabbix.xxx.com; chmod 755 -R zabbix.xxx.com



13、配置Zabbix的Nginx虛擬主機

server
{
        listen 80;
        server_name zabbix.XXX.com;
        index index.php index.html;
        root /data/wwwroot/zabbix.XXX.com;
                location ~ .*\.(php|php5)?$
                {      
                  fastcgi_pass  unix:/tmp/php-cgi.sock;
                  #fastcgi_pass  127.0.0.1:9000;
                  fastcgi_index index.php;
                  include fcgi.conf;
                }
}


14、確認php、nginx、mysql,已經啓動。瀏覽器中打開zabbix.xxx.com頁面,根據提示,一步步配置Zabbix


15、設置中文支持

A> 找到/data/wwwroot/zabbix.xxx.com/include/locales.inc.php文件,找到55行,將flase改爲true,如:'zh_CN' => ['name' => _('Chinese (zh_CN)'), 'display' => true], 

B> 登錄進去,點擊右上角人形圖標設置中文。


16、因修改了語言,圖形會出現亂碼,做如下修改

A:下載微軟雅黑字體,將wryh.ttf上傳至/data/wwwroot/zabbix.xxx.com/fonts/目錄下

B>找到:/data/wwwroot/zabbix.xxx.com/include/defines.inc.php

C>define('ZBX_FONT_NAME', 'wryh'); #第45行

D>define('ZBX_FONT_NAME', 'wryh'); #第93行


17、安裝完成

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章