zabbix源码安装配置

来源:互联网 发布:如何关闭mac的应用 编辑:程序博客网 时间:2024/06/01 09:02

本文安装环境:

a、Redhat 6.6

b、php-5.6.29

c、nginx-1.11.8

d、zabbix-3.2.3

e、使用系统镜像盘配置本地yum源安装依赖包

 

一、PHP源码安装配置

1、安装依赖包

yum install gcc-c++ mysql-develyum install libxml2-develyum install libjpeg-develyum install libpng-develyum install freetype-devel

 

2、下载php源码包

wget http://cn2.php.net/distributions/php-5.6.29.tar.gz

 

3、安装php

tar zxvf php-5.6.29.tar.gz
cd php-5.6.29
./configure --prefix=/usr/local/php --enable-fpm --enable-bcmath  --enable-mbstring --enable-sockets --with-gd  --with-mysql --with-mysqli  --with-gettext --with-png-dir --with-jpeg-dir --with-freetype-dir
make -j 4
make install

 

4、配置php

cp /data/source/php-5.6.29/php.ini-development /usr/local/php/lib/php.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf

修改php.ini配置文件

max_execution_time = 300
max_input_time = 300
date.timezone = Asia/Shanghai
post_max_size = 16M
always_populate_raw_post_data = -1

 

5、启动php-fpm

/usr/local/php/sbin/php-fpm
netstat -ntlp|grep 9000
tcp        0      0 127.0.0.1:9000              0.0.0.0:*                   LISTEN      2302/php-fpm

至此zabbix所需PHP环境配置完成

 

二、Nginx源码安装配置

 

1、下载nginx和pcre源码安装包

wget http://nginx.org/download/nginx-1.11.8.tar.gz
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.tar.gz

 

2、安装依赖pcre

 

./configure --prefix=/usr/local/pcre
make -j 4
make install

 

3、安装nginx

 

./configure --prefix=/usr/local/nginx --with-pcre=../pcre-8.38
make -j 4
make install

 

4、配置zabbix web

cat /usr/local/nginx/conf/zabbix.conf

server{        listen       80;        server_name  192.168.62.200  zabbix.kbsonlong.com;        root   /data/www/zabbix;        index  index.html index.htm index.php;        location ~ .*\.(php|php5)?$        {                fastcgi_pass  127.0.0.1:9000;                fastcgi_index index.php;                include fastcgi.conf;        }        access_log logs/zabbix.log;}

 

三、zabbix源码安装配置

 

1、安装依赖包

yum install gcc-c++ mysql-devel libxml2-devel curl-devel net-snmp-devel

 

2、安装zabbix server

groupadd -g 1000 zabbix
useradd -M -g zabbix -u 1000 -s /sbin/nologin zabbix
tar zxvf zabbix-3.2.3.tar.gz
cd zabbix-3.2.3
./configure --prefix=/usr/local/zabbix --enable-server  --with-mysql   --with-net-snmp --with-libcurl --with-libxml2
make install

 

3、数据库权限配置

mysql -uroot -pkbsonlong -h 192.168.62.200 -e "create database zabbix character set utf8;"
mysql -uroot -pkbsonlong -h 192.168.62.200 -e "grant all on zabbix.* to zabbix@192.168.62.200 identified by 'zabbix';"

 

4、初始化数据库

cd /data/source/zabbix-3.2.3
mysql -uzabbix -p'zabbix' -h 192.168.62.200 zabbix < database/mysql/schema.sql
mysql -uzabbix -p'zabbix' -h 192.168.62.200 zabbix < database/mysql/images.sql
mysql -uzabbix -p'zabbix' -h 192.168.62.200 zabbix < database/mysql/data.sql

 

5、配置服务端口

cat >> /etc/services <<eofzabbix-agent    10050/tcp                           #ZabbixAgentzabbix-agent    10050/udp                           #Zabbix Agentzabbix-trapper  10051/tcp                           #ZabbixTrapperzabbix-trapper  10051/udp                           #Zabbix Trappereof

 

6、将zabbix web代码拷贝到nginx配置中的/data/www/zabbix 目录

cd /data/source/zabbix-3.2.3
cp frontends/php/ /data/www/zabbix –r
cp misc/init.d/fedora/core/zabbix_server /etc/init.d/
sed -i 's#BASEDIR=/usr/local#BASEDIR=/usr/local/zabbix#g' /etc/init.d/zabbix_server

 

7、修改zabbix_server配置

# cat /usr/local/zabbix/etc/zabbix_server.conf|grep -v ''#LogFile=/tmp/zabbix_server.logDBHost=192.168.62.200DBName=zabbixDBUser=zabbixDBPassword=zabbixDBSocket=/var/lib/mysql/mysql.sock

 

8、启动zabbix server

/etc/init.d/zabbix_server startStarting zabbix_server:                                    [  OK  ]netstat -ntlp|grep 10051tcp        0      0 0.0.0.0:10051               0.0.0.0:*                   LISTEN      9226/zabbix_server

 

 

9、安装zabbix agent

yum install gcc-c++
cd /data/source/
tar zxvf zabbix-3.2.3.tar.gz
cd zabbix-3.2.3
./configure –prefix=/usr/local/zabbix --enable-agent
make install

 

10、配置zabbix agent

cd /data/source/zabbix-3.2.3
cp misc/init.d/fedora/core/zabbix_agentd /etc/init.d/
sed -i 's#BASEDIR=/usr/local#BASEDIR=/usr/local/zabbix#g' /etc/init.d/zabbix_agentd

 

11、启动zabbix agent

/etc/init.d/zabbix_agentd startStarting zabbix_agentd:                                    [  OK  ] netstat -ntlp|grep 10050tcp        0      0 0.0.0.0:10050               0.0.0.0:*                   LISTEN      15495/zabbix_agentd

 

12、启动nginx

/usr/local/nginx/sbin/nginx netstat -ntlp|grep 80tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      15528/nginx


四、zabbix web配置

http://192.168.62.200  Admin/zabbix

image

 

image

 

 

image

 

image

 

image

 

image

 

image

image

0 0