zabbix 3.0 完全安装全解!

Posted MoStart

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了zabbix 3.0 完全安装全解!相关的知识,希望对你有一定的参考价值。

  • 环境准备:
    • centos 6.5 x86_x64
  • 安装依赖库文件
    • yum -y install mysql-devel net-snmp-devel curl curl-devel gcc pcre-devel libpng-devel libjpeg-devel libxml2-devel freetype-devel
  • 准备软件
    • nginx-1.11.5.tar ,php-5.4.101 ,zabbix-3.2.1.tar ,freetype-2.5.3.tar
  • 安装软件
[[email protected] ~]#groupadd mysql
[[email protected] ~]#useradd -g mysql mysql -M -s /sbin/nologin 
  • 安装mysql:

 

yum -y install mysql-server

 

  • 添加nginx用户:

 

[[email protected] ~]#groupadd nginx
[[email protected] ~]#useradd -g nginx nginx -M -s /sbin/nologin

 

  • 安装nginx:  
[[email protected] ~]# cd /tmp/
[[email protected] tmp]# tar zxvf nginx-1.11.5.tar.gz 
[[email protected] tmp]# cd nginx-1.11.5
[[email protected] nginx-1.11.5]# ./configure --prefix=/usr/local/nginx  --user=nginx --group=nginx
[[email protected] nginx-1.11.5]#make && make install
  • 安装freetype:
[[email protected] tmp]# tar zxvf freetype-2.5.3.tar.gz
[[email protected] tmp]# cd freetype-2.5.3
[[email protected] freetype-2.5.3]# ./configure --prefix=/usr/local/freetype
[[email protected] freetype-2.5.3]# make && make install
  • 安装php:
[[email protected] tmp]# tar zxvf php-5.4.101.tar
[[email protected] php-5.4.10]# ./configure --prefix=/usr/local/php --enable-fpm > --enable-mbstring --with-gettext > --with-zlib --enable-sockets > --with-mhash --enable-zip --with-pcre-regex --with-mysql --with-mysqli > --with-gd --with-jpeg-dir --enable-bcmath --with-freetype-dir=/usr/local/freetype/
 [[email protected] php-5.4.10]# make && make install
  • 安装zabbix

 

[[email protected] tmp]# tar zxvf zabbix-3.2.1.tar.gz 
[[email protected] tmp]#./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2
[[email protected] tmp]#make && make install
  • 编辑修改zabbix配置文件,配置zabbix_server 
  • [[email protected] zabbix-3.2.1]# vim /usr/local/zabbix/etc/zabbix_server.conf
    DBName=zabbix
    DBUser=zabbix
    DBPassword=zabbix
    Timeout=30
    [[email protected] zabbix-3.2.1]# vim /usr/local/zabbix/etc/zabbix_agentd.conf
    Server=zabbix-server
    ServerActive=zabbix-server
    Hostname=zabbix-server   #必须与web页面添加主机名一致
    

      

 

  • 建立zabbix数据库并导入数据文件

 

[[email protected] zabbix-3.2.1]# service mysqld start
mysql  进入MySQL控制台 
create database zabbix character set utf8; #创建数据库zabbix,并且数据库编码使用utf8 
GRANT USAGE ON *.* TO ‘zabbix‘@‘localhost‘ IDENTIFIED BY ‘zabbix‘ WITH GRANT OPTION; #新建账户zabbix,密码zabbix
flush privileges; #再次刷新系统授权表 
grant all on zabbix.* to ‘zabbix‘@‘localhost‘ identified by ‘zabbix‘ with grant option; #允许账户zabbix能从本机连接到数据库zabbix 
flush privileges; #再次刷新系统授权表 
use zabbix #进入数据库,并刷新数据库,一定要按照sql文件顺序 
source  /tmp/zabbix-3.2.1/database/mysql/schema.sql #导入脚本文件到zabbix数据库 
source  /tmp/zabbix-3.2.1/database/mysql/images.sql #导入脚本文件到zabbix数据库 
source  /tmp/zabbix-3.2.1/database/mysql/data.sql #导入脚本文件到zabbix数据库
  • 建立web站点目录配置
[[email protected] mysql]# mkdir -p /var/www/html/zabbix
[[email protected] mysql]# cd /tmp/zabbix-3.2.1/frontends/
[[email protected] frontends]# cp -rf php/* /var/www/html/zabbix/
  • 配置PHP.conf
[[email protected] sbin]# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
  • 启动服务[[email protected] sbin]# /usr/local/php/sbin/php-fpm  
    • [[email protected] sbin]#/usr/local/nginx/sbin/nginx  
      配置nginx的conf文件
      [[email protected] sbin]#vim /usr/local/nginx/conf/nginx.conf
          location / {
          root /var/www/html/zabbix;
          index index.html index.htm index.php;
          }
          location ~ \.php$ {
               fastcgi_buffer_size 128k;
                fastcgi_buffers 32 32k;
          root /var/www/html/zabbix;
          fastcgi_pass 127.0.0.1:9000;
          fastcgi_index index.php;
          fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
          include fastcgi_params;
          }
      

       添加php.ini

  • [[email protected] sbin]# cp /tmp/php-5.4.10/php.ini-production /usr/local/php/lib/php.ini

 

以上是关于zabbix 3.0 完全安装全解!的主要内容,如果未能解决你的问题,请参考以下文章

zabbix 3.0快速安装简介

Zabbix 3.0安装

Zabbix培训视频-3.0版本安装

zabbix 3.0 监控的安装

Ubuntu14.04 x64 zabbix 3.0 安装

zabbix3.0安装