基於LNMP的Zabbbix之Zabbix Server源碼詳細安裝,但不給圖

            Zabbix Server安裝php

看到那裏有錯或者有什麼問題的話,求指點html

郵箱:losbyday@163.com前端

上一篇PHP源碼安裝參見基於LNMP的Zabbbix之PHP源碼安裝:https://i.cnblogs.com/EditPosts.aspx?postid=5828058java

關於zabbix詳細:http://www.iyunv.com/thread-179791-1-1.htmlmysql


              Beginlinux

#創建一個用於zabbix的用戶nginx

    useradd zabbix
    passwd zabbix
#個人密碼123看我的

#到官網找到Zabbix Server源碼安裝包web

   wget  http://120.52.73.49/tenet.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.0.3/zabbix-3.0.3.tar.gz
   tar -zxvf zabbix-3.0.3.tar.gz
   cd zabbix-3.0.3
   ./configure --prefix=/usr/local/zabbix/ --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2 --enable-java
   make && make install

#MySQL導入SQL語句sql

    mysql -uroot -e"create database zabbix character set utf8 collate utf8_bin;"
    mysql -uroot -e"grant all privileges on zabbix.* to zabbix@'%' identified by 'losnau';"
    mysql -uroot -e"flush privileges;"

#按照SQL語句順序導入SQL:數據庫

    mysql -uzabbix -plosnau zabbix <  /usr/local/setup/zabbix-3.0.3/database/mysql/schema.sql
    mysql -uzabbix -plosnau zabbix < /usr/local/setup/zabbix-3.0.3/database/mysql/images.sql
    mysql -uzabbix -plosnau zabbix < /usr/local/setup/zabbix-3.0.3/database/mysql/data.sql

#修改/usr/local/zabbix/etc/zabbix_server.conf

    DBName=zabbix #數據庫名稱
    DBUser=zabbix #數據庫用戶名
    DBPassword=losnau #數據庫密碼
    ListenIP=192.168.1.5 #數據庫ip地址
    AlertScriptsPath=${datadir}/zabbix/alertscripts #zabbix運行腳本存放目錄

#修改php.ini                ------PHP option

    post_max_size 16M
    max_execution_time 300
    max_input_time = 300
#    zone Asia/Shanghai

#重啓php-fpm服務

  ps aux |grep php    #查看php-fpm是否開啓
  #若是開啓就
  ps aux |grep php-fpm |xargs kill -9    # 關閉啦
  cp /usr/local/php/sbin/php-fpm /usr/bin    #^_^
  php-fmp                            #啓動php-fpm服務

#zabbix提供init.d腳本

cp misc/init.d/tru64/zabbix_* /etc/init.d/


chmod +x /etc/init.d/zabbix_*

 

#將前端文件拷貝到nginx站點目錄下

    cd /usr/local/setup/zabbix-3.0.3/frontends   #進入zabbix解壓縮目錄 
    cp -rf php /www                    #將解壓縮的zabbix裏面php文件拷貝到nginx的root目錄下

#修改Nginx的配置文件

個人nginx.conf以下

user  daemon;
worker_processes  1;
error_log  logs/error.log;
pid        logs/nginx.pid;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    #access_log  logs/access.log  main;
    sendfile        on;
    keepalive_timeout  65;
    server {
        listen       80;
        server_name  localhost;
    root /www;
        location / {
            index  index.html index.htm index.php;
        }
        error_page  404              /404.html;
        # redirect server error pages to the static page /50x.html
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
        }
#解決open() 「/usr/local/nginx/html/favicon.ico」 failed (2: No such file or directory)
        location = /favicon.ico {
            log_not_found off;
            access_log off;
        } 
        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ \.php$ {
        fastcgi_pass unix:/tmp/phpfpm.sock;
            fastcgi_index  index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;         
        include        fastcgi_params;
        }
    location /zabbix {
            alias /www/zabbix;
        }
    }
}
nginx.conf

 # 重啓Nginx

cp /usr/local/nginx/nginx /usr/bin
nginx -t             #檢查nginx配置文件是否有錯誤    
nginx -s stop    #中止nginx服務        
nginx                 #啓動nginx服務
nginx

 #啓動服務

    /usr/local/zabbix/sbin/zabbix_server
    /usr/local/zabbix/sbin/zabbix_agentd 
或者service zabbix_server start
service zabbix_agentd start

 #在web 192.168.1.5,看你怎麼配置的了

  zabbix初始登陸賬號:Admin   #A必須大寫

  密碼:zabbix

               End


 

#碰到的錯誤及解決:

------------------------check-error 1-------------------------------------------------

   #checking for net-snmp-config... no
    #configure: error: Invalid Net-SNMP directory - unable to find net-snmp-config
    #提示unable to find net-snmp-config,說明缺乏相關的依賴性,找出net-snmp-config屬於哪一個軟件包,而後安裝便可。
    #yum search net-snmp-config,發現net-snmp-config屬於軟件包net-snmp-devel,安裝該軟件包,解決該問題。

yum install net-snmp*

------------------------check-error 2--------------------------------------------------
    #checking for javac... no
    #configure: error: Unable to find "javac" executable in path,沒裝java-jdk

#解決

   wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u20-b26/jdk-8u20-linux-x64.tar.gz
    mkdir /usr/local/java
    tar zxvf jdk-8u20-linux-x64.tar.gz -C /usr/local/java/
    echo "JAVA_HOME=/usr/local/java/jdk1.8.0_20/
    JRE_HOME=/usr/local/java/jre
    PATH=\$JAVA_HOME/bin:\$PATH:\$JRE_HOME/bin
    CLASSPATH=.:\$JAVA_HOME/lib/dt.jar:\$JAVA_HOME/lib/tools.jar:\$JRE_HOME/lib
    export JAVA_HOME JRE_HOME PATH CLASSPATH" >> /etc/profile
    source /etc/profile
    java -version
install java-jdk for linux

 

------------------------MySQL導入SQL語句錯誤 3----------------------------------------

#Warning: Using a password on the command line interface can be insecure.
#ERROR 1045 (28000): Access denied for user 'zabbix'@'localhost' (using password: YES)

    mysql -uroot -e"delete from user where user=' ';"
    mysql -uroot -e"flush privileges;"

------------------------打開網頁出現403錯誤  4----------------------------------------

403有不少緣由,查看logs有( FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream)

錯誤解決方法:在Nginx配置文件中找到定義調用腳本文件的地方

  #fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;    #註釋
  fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;  #添加

提示:$document_root 表明當前請求在root指令中指定的值。

------------------------nginx日誌中還看到下面那個錯誤 5-------------------------------

open() 「/usr/local/nginx/html/favicon.ico」 failed (2: No such file or directory)
只須要關閉 favicon.ico 的 log:

    location = /favicon.ico {
        log_not_found off;
        access_log off;
    } 

-----------------------nginx日誌中還看到下面那個錯誤 6-------------------------------

-2016/09/01 11:05:15 [error] 118206#118206: *1 FastCGI sent in stderr: "PHP message: PHP Warning:  phpinfo(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /www/index.php on line 2" while reading response header from upstream, client: 192.168.1.209, server: localhost, request: "GET /index.php HTTP/1.1", upstream: "fastcgi://unix:/tmp/phpfpm.sock:", host: "192.168.1.5"

解決方法:
在php.ini里加上
date.timezone = "Asia/Shanghai"(去掉前面的;)

-----------------------zabbix 服務啓動錯誤  7-------------------------------

[root@localhost mysql]# /usr/local/zabbix/sbin/zabbix_server                    
/usr/local/zabbix/sbin/zabbix_server: error while loading shared libraries:
libmysqlclient.so.18: cannot open shared object file: No such file or directory

  ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib64/  
  # 若是是32位系統須要作鏈接到/usr/lib/下 64位放到lib64

------------------------Nginx 錯誤彙總:http://blog.csdn.net/cjfeii/article/details/49511829

------------------------zabbix密碼修改:http://www.361way.com/zabbix-change-passord/3652.html

------------------------本文參考:

記錄一次基於LNMP環境下的Zabbix3.0部署:http://www.tuicool.com/articles/ZJfYzyF

Zabbix安裝圖解教程:http://www.osyunwei.com/archives/7984.html

相關文章
相關標籤/搜索