[关闭]
@hai046 2015-11-04T08:24:32.000000Z 字数 3558 阅读 974

zabbix

下面安装是通过yum 安装的, php必须大于5.3,否则请通过后面的 make source code 安装

1,安装依赖组件

yum -y install net-snmp net-snmp-devel perl-DBI php-gd php-xml php-bcmath fping OpenIPMI-devel php-mbstring

2,mysql 数据库配置

创建user

 create database zabbix default character set utf8;
 grant all privileges on zabbix.* to 'zabbix'@'%' identified by 'jiemo_zabbix';
 flush privileges;

创建table,导入数据

cat schema.sql |mysql -h127.0.0.1  -uzabbix -pjiemo_zabbix zabbix
 cat images.sql |mysql -h127.0.0.1 -uzabbix -pjiemo_zabbix zabbix
 cat data.sql |mysql -h127.0.0.1 -uzabbix -pjiemo_zabbix zabbix

此过程很慢,可能没有log显示,你可以把命令复制过去粘贴使用

3编译zabbix

./configure --prefix=/opt/app/zabbix --enable-server --with-mysql --with-net-snmp --with-libcurl --with-openipmi --enable-proxy --enable-agent
make && make install

安装过程可能遇到的问题

如果报错

checking for main in -lmysqlclient... no 
configure: error: Not found mysqlclient library 

解决:

ln -s /usr/lib64/mysql/libmysqlclient.so.16 /usr/lib64/mysql/libmysqlclient.so

注意:可能还需要安装LAMP环境

 yum install -y httpd mysql mysql-server mysql-devel php php-mysql php-common php-mbstring php-gd php-odbc php-xml php-pear

检查安装或者移除

 rpm -qa|grep -i mysql 
 rpm -e  MySQL-devel-community 

4复制web工程

到指定目录下,
目前我没有改变目录是 /opt/zabbix/frontends

5增加用户组

点击(此处)折叠或打开

groupadd -g 1003 zabbix
useradd -u 1003 -g zabbix -s /sbin/nologin zabbix

6,复制启动脚本并设置开机启动

cp misc/init.d/fedora/core5/zabbix_* /etc/init.d/ 
chmod 755 /etc/init.d/zabbix_*


chkconfig --add zabbix_server
chkconfig --add zabbix_agentd
chkconfig --level 35 zabbix_server on
chkconfig --level 35 zabbix_agentd on

7,配置confi

[root@fung conf]# pwd
/opt/zabbix/conf
[root@fung conf]# vim /opt/app/zabbix/etc/zabbix_server.conf

修改/opt/app/zabbix/etc/zabbix_server.conf

DBName=zabbix
DBUser=zabbix
#BPassword=jiemo_zabbix  #因为上面忽略登录可以不写

修改/opt/app/zabbix/etc/zabbix_agent.conf

Hostname=Zabbix_server_ip

指定server路径
[root@fung zabbix]# vim /etc/init.d/zabbix_server

prog="Zabbix Server"
ZABBIX_BIN="/opt/app/zabbix/sbin/zabbix_server"

指定agented路径
[root@fung zabbix]# vim /etc/init.d/zabbix_agentd

ZABBIX_BIN="/opt/app/zabbix/sbin/zabbix_agentd"

开启服务端口

$grep zabbix /etc/services 
zabbix-agent    10050/tcp                       # Zabbix Agent
zabbix-agent    10050/udp                      # Zabbix Agent
zabbix-trapper  10051/tcp                       # Zabbix Trapper
zabbix-trapper  10051/udp                      # Zabbix Trapper

如果以上内容没有出现, 请手动添加到文件中

/etc/init.d/zabbix_server restart

以上参考了see http://blog.chinaunix.net/uid-24250828-id-3758077.html

源码安装

如果你不幸出现了很多其他的问题【我就是很不幸,在centos yum update 升级版本出现一顿问题,然后就全部源码安装了】
那么你只能自己安装了

最好先安装httpd在安装php
因为php要生成 modules/libphp5.so 到http lib下,httpd才能解析php

安装httpd

官网在:http://httpd.apache.org/
所有doc: http://httpd.apache.org/docs/2.4/

Download    $ lynx http://httpd.apache.org/download.cgi
    Extract	$ gzip -d httpd-NN.tar.gz
$ tar xvf httpd-NN.tar
    $ cd httpd-NN
Configure   $ ./configure --prefix=PREFIX
    Compile	$ make
Install $ make install
    Customize	$ vi PREFIX/conf/httpd.conf
Test    $ PREFIX/bin/apachectl -k start

默认安装到

/usr/local/apache2   

按照官方doc流程来就OK ,可能APR and APR-Util,可能参照doc下面的说明解决就行,官方文档还是很全面很权威的

另外httpd命令可以使用

apachectl -k restart

来代替,其实里面调用的还是httpd

安装php5

./configure  --with-apxs2=/usr/local/apache2/bin/apxs --enable-bcmath --enable-mbstring  --enable-sockets  --enable-sockets --with-gd --with-jpeg-dir=/usr/local --with-png-dir=/usr/local  --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-mysql=mysqlnd  --enable-dom --enable-xml --enable-fpm --with-libdir=lib64 --enable-bcmath --with-freetype-dir=/usr/local/include/freetype2/freetype --with-gettext   --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2

前提:gd-png/jepg mysqlnd freetype等这些你必须先已经安装了
freetype 是自己下载安装

这些都是zabbix 需要enable的功能,如果你漏掉了,恭喜你需要自己重新安装了,哈哈 如果你重新安装一定要记得

make clean

不然很多error

注意上面里面是两个 2 版本,不然编译生成不了libphp5.so
配置httd.ini【具体位置需要在配置里面找,这里是简写】

LoadModule php5_module        modules/libphp5.so
#Require all denied #注释掉不然403
AddType application/x-httpd-php .php .phtml .php3 

其他相关

zabbix 默认的用户名和密码
用户名是admin, 密码zabbix

/etc/init.d/httpd restart

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注