• 欢迎访问蜷缩的蜗牛博客 蜷缩的蜗牛
  • 微信搜索: 蜷缩的蜗牛 | 联系站长 kbsonlong@qq.com
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Zabbix源码安装配置

Zabbix 蜷缩的蜗牛 2年前 (2017-02-19) 298次浏览 已收录 0个评论

本文安装环境:

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-devel
yum install libxml2-devel
yum install libjpeg-devel
yum install libpng-devel
yum 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.gzcd 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 <<eof
zabbix-agent    10050/tcp                           #ZabbixAgent
zabbix-agent    10050/udp                           #Zabbix Agent
zabbix-trapper  10051/tcp                           #ZabbixTrapper
zabbix-trapper  10051/udp                           #Zabbix Trapper
eof

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.log
DBHost=192.168.62.200
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
DBSocket=/var/lib/mysql/mysql.sock

8、启动 zabbix server

/etc/init.d/zabbix_server start
Starting zabbix_server:                                    [  OK  ]

netstat -ntlp|grep 10051
tcp        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 start
Starting zabbix_agentd:                                    [  OK  ]

 netstat -ntlp|grep 10050
tcp        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 80
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      15528/nginx

四、zabbix web 配置

访问http://192.168.62.200 

Zabbix 源码安装配置

 

Zabbix 源码安装配置

 

Zabbix 源码安装配置

 

Zabbix 源码安装配置

 

Zabbix 源码安装配置

 

 

Zabbix 源码安装配置

 

至此 zabbix 安装完成,访问http://192.168.62.200 

Admin/zabbix

Zabbix 源码安装配置

 

Zabbix 源码安装配置


蜷缩的蜗牛 , 版权所有丨如未注明 , 均为原创丨 转载请注明Zabbix 源码安装配置
喜欢 (2)
[]
分享 (0)

您必须 登录 才能发表评论!