标签:zabbix
1,打开php.ini配置文件,修改如下参数为如下值,否则zabbix安装不了。
max_execution_time = 300
memory_limit = 128M
post_max_size = 16M
upload_max_filesize = 2M
max_input_time = 300
date.timezone Asia/shanghai
2,所有版本下载地址:http://www.zabbix.com/download.php
3,安装所依赖的包:
[root@localhost zabbix-2.0.8]# yum -y install net-snmp-devel curl-devel
3,解压并安装编译:
[root@localhost zabbix-2.0.8]# tar zxvf zabbix-2.0.8.tar.gz
[root@localhost zabbix-2.0.8]# cd zabbix-2.0.8
[root@localhost zabbix-2.0.8]#./configure --prefix=/usr/local/zabbix/ --enable-server \
--enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2
[root@localhost zabbix-2.0.8]#make
[root@localhost zabbix-2.0.8]#make install
4,创建用户和组:
[root@localhost ~]# groupadd zabbix
[root@localhost ~]# useradd -g zabbix zabbix
5,初始化数据库(该数据库文件的路径是:/tmp/install/zabbix-2.0.8/database/mysql
),并把sql文件导入到mysql.zabbix数据库中(导入顺序一定要注意)
[root@localhost mysql]# mysql -uzabbix -p123456 zabbix < schema.sql
[root@localhost mysql]# mysql -uzabbix -p123456 zabbix < images.sql
[root@localhost mysql]# mysql -uzabbix -p123456 zabbix < data.sql
6,为zabbix server添加端口:
[root@localhost mysql]# cat >> /etc/services <<eof
> zabbix-agent 10050/tcp #ZabbixAgent
> zabbix-agent 10050/udp #Zabbix Agent
> zabbix-trapper 10051/tcp #ZabbixTrapper
> zabbix-trapper 10051/udp #Zabbix Trapper
> eof
7,更改zabbix-server.conf配置文件中关于数据库部分。默认的配置文件在/usr/local/zabbix安装目录下
# vim /etc/zabbix/zabbix_server.conf
DBName=zabbix
DBUser=zabbix
DBPassword=123456
DBPort=3306
8,给zabbix-2.0.8服务端程序做软链接:
[root@localhost mysql]# mkdir -p /data/zabbix
[root@localhost mysql]# cd /usr/local/zabbix/bin/
[root@localhost bin]# for i in *;do ln -s /usr/local/zabbix/bin/${i} /usr/bin/${i};done
[root@localhost bin]# cd /usr/local/zabbix/sbin/
[root@localhost sbin]# for i in *;do ln -s /usr/local/zabbix/sbin/${i} /usr/sbin/${i};done
9,拷贝修改zabbix服务端、客户端启动脚本
[root@localhost sbin]cp /tmp/install/zabbix-2.0.8/misc/init.d/redhat/zabbix_server /etc/init.d/zabbix_server start
[root@localhost sbin]cp /tmp/install/zabbix-2.0.8/misc/init.d/redhat/zabbix_agentd /etc/init.d/zabbix_agentd start
[root@localhost zabbix-2.0.8]# chmod +x /etc/init.d/zabbix_*
[root@localhost zabbix-2.0.8]# chkconfig --add zabbix_server
[root@localhost zabbix-2.0.8]# chkconfig --add zabbix_agentd
[root@localhost zabbix-2.0.8]#chkconfig zabbix_server on
[root@localhost zabbix-2.0.8]#chkconfig zabbix_agentd on
[root@localhost zabbix-2.0.8]#chkconfig --list
10,拷贝zabbix前端目录网站到 /data/下
[root@localhost zabbix-2.0.8]# cp -r frontends/php/ /data/
[root@localhost data]# ll
total 20
drwxr-xr-x. 3 root root 4096 Sep 7 18:14 logs
drwxr-xr-x. 6 mysql mysql 4096 Sep 7 22:40 mysql
drwxr-xr-x. 3 root root 4096 Sep 7 18:20 nginx
drwxr-xr-x. 11 zabbix zabbix 4096 Sep 8 17:14 php
11, 在nginx中添加zabbix虚拟主机.
server {
listen 80;
server_name localhost;
access_log /data/nginx/log/nginx.access.log;
index index.php index.html;
# root /usr/local/nginx/html;
root /data/php;
# root /data/test/php;
# root /data/www/php;
error_page 500 502 503 /50x.html;
location ~ \.php$
{
# root /usr/local/nginx/html/zabbix;
expires -1s;
#index index.php index.html;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass 127.0.0.1:9000;
}
12,修改PHP配置文件php.ini(/usr/local/php/etc/php.ini)内容:
date.timezone = Asia/Shanghai
post_max_size = 32M
max_execution_time = 300
max_input_time = 300
***注意了,修改过后别忘重新启动php ,由于我做成了服务使用一下命令重新启动php:
[root@localhost ~]# /etc/init.d/php-fpm restart
Gracefully shutting down php-fpm . done
Starting php-fpm done
13,在浏览器中打开zabbix 的ip地址:http://192.168.1.244 由于nginx配置好了即可直接进入zabbix的安装界面,不可以的话请查看iptables是否关闭,或nginx的报错日志
14,单击下一步,各个安装需求满足,如果有不满足的话,直接修改php.ini文件,重新加载即可。
15,
如果php动态添加gettext模块
[root@localhost ~]#cd /tmp/install/php-5.5.28/ext/gettext //进入到php源码包中,php源码包中包含有gettext
[root@localhost ~]#/usr/local/php/bin/phpize
[root@localhost ~]# ./configure --with-php-config=/usr/local/webserver/php/bin/php-config --with-gettext
[root@localhost gettext]# make && make install //成功会在/usr/local/webserver/php/lib/php/extensions产生gettext.so。确认php.ini文件中的extension_dir=/opt/php/lib/php/extensions是否存在,并在php.ini中添加extension=gettext.so
[root@localhost gettext]# /etc/init.d/php-fpm reload //重载php,这里可以通过/usr/local/webserver/php/bin/php -m|grep gettext来查看是否添加了gettext模块
16,连接zabbix数据库,设置zabbix账号和密码即可:
如果zabbix连接不上可以修改php目录下的文件即可(vi /data/php/include/db.inc.php最上边的即可如下)
<?php
if(!isset($DB)){
$DB = array();
if(isset($DB_TYPE)) $DB[‘TYPE‘] = "mysql";
if(isset($DB_SERVER)) $DB[‘SERVER‘] = "localhost";
if(isset($DB_PORT)) $DB[‘PORT‘] = "3306";
if(isset($DB_DATABASE)) $DB[‘DATABASE‘] = "zabbix";
if(isset($DB_USER)) $DB[‘USER‘] = "root";
if(isset($DB_PASSWORD)) $DB[‘PASSWORD‘] = "123456";
}
17,然后下一步,下一步即可,到安装所示如下图:
18,单击完成。
19,zabbix服务端的安装完成。
如果出现:error
/usr/local/zabbix/sbin/zabbix_server
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/
进行解决。
本文出自 “清风明月” 博客,请务必保留此出处http://liqingbiao.blog.51cto.com/3044896/1692639
标签:zabbix
原文地址:http://liqingbiao.blog.51cto.com/3044896/1692639