java多线程    Java入门    vsftp    ftp    linux配置    centos    FRP教程    HBase    Html5缓存    webp    zabbix    分布式    neo4j图数据库    

zabbix yum安装

说明:国内服务器可能无法安装,解决方案看上一篇源码安装,这个是在国外服务器安装的,遇到了一些不同的问题
问题1. 网页无法访问
aaa.com is currently unable to handle this request.

出来500错误

vi /usr/local/php/etc/php.ini

修改error_reporting 无效
php 设置error_reporting 无效

display_errors = Off
改成 
display_errors = On

出来错误了

Warning: require_once(/etc/zabbix/web/maintenance.inc.php): failed to open stream: Permission denied in /usr/share/zabbix/include/classes/core/ZBase.php on line 280

Fatal error: require_once(): Failed opening required '/etc/zabbix/web/maintenance.inc.php' (include_path='.:/usr/local/php/lib/php') in /usr/share/zabbix/include/classes/core/ZBase.php on line 280

设置nginx主目录为
/usr/share/zabbix

但是代码在调用/etc/zabbix/web/ 下的文件(月小升源码安装zabbix的时候没有这个问题)

给一个全局权限
chmod -R 777 /etc/zabbix/web

刷新页面好了

问题2.子目录无效问题

改成子目录,配置nginx 的conf文件

location /zabbix {
            alias /usr/share/zabbix;
            index index.html index.htm;
            try_files $uri $uri/ =404;
        }

403 Forbidden

这个办法没有走通,看来对nginx的子目录的理解不够深刻。

粗暴的把/usr/share/zabbix 所有文件拷贝到目前网站根目录下,反而有效。

问题3.遇到LDAP问题

PHP LDAP	off		Warning

php --ini
查看php配置文件

find / -name ldap.so
/usr/lib64/php/modules/ldap.so

看看ldap 是安装
which ldapsearch

安装命令

yum install openldap openldap-* -y


cp -frp /usr/lib64/libldap* /usr/lib/

yum install php-ldap

强制修改/usr/local/php/etc/php.ini增加so

extension=/usr/lib64/php/modules/ldap.so
改成
extension=ldap.so

Gracefully shutting down php-fpm . done
Starting php-fpm [15-Mar-2020 10:43:26] NOTICE: PHP message: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/ldap.so' - /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/ldap.so: cannot open shared object file: No such file or directory in Unknown on line 0
done

重启动报错。

服务器的文件test.php 出现的php.ini加载位置
/usr/local/php/etc/php.ini

服务器直接php --ini

# php --ini 
Configuration File (php.ini) Path: /etc
Loaded Configuration File:         /etc/php.ini
Scan for additional .ini files in: /etc/php.d
Additional .ini files parsed:      /etc/php.d/bcmath.ini,
/etc/php.d/curl.ini,
/etc/php.d/dom.ini,
/etc/php.d/fileinfo.ini,
/etc/php.d/gd.ini,
/etc/php.d/json.ini,
/etc/php.d/ldap.ini,
/etc/php.d/mbstring.ini,
/etc/php.d/mysql.ini,
/etc/php.d/mysqli.ini,
/etc/php.d/pdo.ini,
/etc/php.d/pdo_mysql.ini,
/etc/php.d/pdo_sqlite.ini,
/etc/php.d/phar.ini,
/etc/php.d/sqlite3.ini,
/etc/php.d/wddx.ini,
/etc/php.d/xmlreader.ini,
/etc/php.d/xmlwriter.ini,
/etc/php.d/xsl.ini,
/etc/php.d/zip.ini

明显不是一个位置

#whereis php.ini
php: /usr/bin/php /usr/lib64/php /etc/php.d /etc/php.ini /usr/local/php /usr/share/php /usr/share/man/man1/php.1.gz

找到了一堆php.ini文件。

默认的ldap安装到了/etc/php.d/ 下面了。

目前最大的冲突网页的位置和服务器直接执行php 用的文件不同。

# php -v
PHP 5.4.16 (cli) (built: Nov  1 2019 16:04:20) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
# php -i | grep php.ini
# whereis php
php: /usr/bin/php /usr/lib64/php /etc/php.d /etc/php.ini /usr/local/php /usr/share/php /usr/share/man/man1/php.1.gz
# /usr/local/php/bin/php -v

PHP 5.6.36 (cli) (built: Oct 19 2018 22:38:38) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend Guard Loader v3.3, Copyright (c) 1998-2014, by Zend Technologies

说明fpm 加载的php是这个目录下的。

# php-fpm -t
[15-Mar-2020 11:02:39] NOTICE: configuration file /etc/php-fpm.conf test is successful
# ps -aux | grep php-fpm 

/usr/local/php/bin/pecl install ldap
No releases available for package "pecl.php.net/ldap"
install failed

find / -name ldap
/lnmp1.5/src/php-5.6.36/ext/ldap
cd /usr/local/src/php-7.0.21/ext/ldap/  (源码包路径)
/usr/local/php/bin/phpize         (php安装路径)
./configure –with-php-config=/usr/local/php/bin/php-config  (php安装路径)
make
make install
# cd /lnmp1.5/src/php-5.6.36/ext/ldap
# /usr/local/php/bin/phpize
# ./configure --with-php-config=/usr/local/php/bin/php-config
make
make install

Installing shared extensions:     /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/
vi /usr/local/php/etc/php.ini 

再加上

extension=ldap.so

重启动,好了。

ldap.png

Congratulations! You have successfully installed Zabbix frontend.

默认zabbix账户 Admin zabbix

服务器上查看zabbix_server 在,但是网页显示没有启动服务
去看日志
/var/log/zabbix/zabbix_server.log

32057:20200315:114228.713 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

查询mysql 的文件启动

ps aux|grep mysql
root 21743 0.0 0.0 11772 1556 ? S 2019 0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/var --pid-file=/usr/local/mysql/var/leon01.pid
root 22081 0.0 0.0 112640 992 pts/2 S+ 11:50 0:00 grep --color=auto mysql
mysql 22322 5.9 15.6 4076096 2546372 ? Sl 2019 8151:10 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/var --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=leon01.err --open-files-limit=65535 --pid-file=/usr/local/mysql/var/leon01.pid --socket=/tmp/mysql.sock --port=3306

zabbix_server.conf

DBSocket=/tmp/mysql.sock

重启zabbix_server
# killall zabbix_server
# zabbix_server

zabbix 找不到
yum list all |grep zabbix

表里出现zabbix-get.x86_64
yum install zabbix-get.x86_64

zabbix_get 安装成功

vfs.fs.size[/backup] 发现可以用了。


This entry was posted in Linux and tagged . Bookmark the permalink.
月小升QQ 2651044202, 技术交流QQ群 178491360
首发地址:月小升博客https://java-er.com/blog/zabbix-yum-install/
无特殊说明,文章均为月小升原创,欢迎转载,转载请注明本文地址,谢谢
您的评论是我写作的动力.

2 Responses to zabbix yum安装

  1. 酷特尔 says:

    官方的教程也挺全面的,还有各个系统平台都打包好的包,
    添加好源执行安装命令就可以。

Leave a Reply