美文网首页
CentOS 6.8 下 zabbix 3.2.6 安装及部署

CentOS 6.8 下 zabbix 3.2.6 安装及部署

作者: Canonzki | 来源:发表于2017-07-08 21:54 被阅读0次

    前言

    zabbix是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案。

    1.运行环境的搭建

    zabbix 3.0+以上的版本需要php5.4以上的版本,自己的机器php版本是5.3.3所以本来打算安装zabbix LTS2.2这个版本。(笔者比较懒╭(╯^╰)╮)然而老大表示装新的比较好,所以又重新撸了一遍php
    在这里我们选择了mysql作为zabbix的数据库,apache作为zabbix的web服务器

    yum install httpd mysql-server mysql-devel net-snmp-devel gcc

    下载php(笔者怕系统版本太低坑了,所以选择是现在相对比较老的php5.6这个版本)

    wget http://docs.php.net/distributions/php-5.6.31.tar.gz

    看这个架势只能自己编译安装了噜(╮(╯╰)╭)

    tar xf php-5.6.31.tar.gz
    cd php-5.6.31
    ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/lib --enable-track-vars --with-xml --with-mysql-dir=/usr/include/mysql/mysql.h --with-zlib-dir=/usr/lib

    编译完成之后进行安装

    make install

    各种报错安装,把路径链接正确之后终于= =搞定

    PHP 5.6.31 (cli) (built: Jul 7 2017 23:56:31)
    Copyright (c) 1997-2016 The PHP Group
    Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

    2.下载安装zabbix

    经过多方权衡我决定使用3.2.6这个版本(因为这就是当前最高版本了=。=

    wget http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/3.2.6/zabbix-3.2.6.tar.gz/downloa

    下载好之后我们解压这个造孽的压缩包

    tar xf zabbix-3.2.6.tar.gz

    然而这是源码,少不了再编译一次=。=

    ./configure --prefix=/usr/local --enable-server --enable-agent --enable-ipv6--with-mysql --with-net-snmp

    编译过程因为环境不同会提示奇奇怪怪的错误,这个时候就遇水搭桥见招拆招,缺啥装啥啦。

    3.初始化mysql数据库

    cd ./database/mysql
    service mysqld start

    设置数据库管理员的账号和密码

    mysqladmin –u root password root

    输入root用户密码

    mysql –u root –p

    创建zabbix数据库

    Mysql> create database zabbix character set utf8;

    授权本机通过账号account密码password访问数据库的所有权限

    Mysql> grant all on account.* TO account@'localhost' identified by 'password';
    Mysql> flush privileges;

    将zabbix数据库设置导入mysql

    mysql -h localhost -uroot -proot zabbix <schema.sql
    mysql -h localhost -uroot -proot zabbix <images.sql
    mysql -h localhost -uroot -proot zabbix <data.sql

    4.修改配置文件

    修改apache的配置文件

    vim /etc/httpd/conf/httpd.conf
    DirectoryIndex index.html index.html.var index.php

    修改zabbix配置

    vim
    DBName=zabbix
    DBUser=zabbix
    DBPassword=zabbixpass

    配置zabbix启动项可通过SysV来管理服务的启停。

    cp misc/init.d/fedora/core5/zabbix_server /etc/init.d/
    cp misc/init.d/fedora/core5/zabbix_agentd /etc/init.d/

    这个时候通过zabbix_server命令就可以启动服务啦

    zabbix_server

    创建apache的配置文件

    vim /etc/httpd/conf.d/zabbix.conf

    把下面的内容复制进去

    Alias /zabbix /usr/share/zabbix
    <Directory "/usr/share/zabbix">
    Options FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
    <IfModule mod_php5.c>
    php_value max_execution_time 300
    php_value memory_limit 128M
    php_value post_max_size 16M
    php_value upload_max_filesize 2M
    php_value max_input_time 300
    php_value always_populate_raw_post_data -1
    php_value date.timezone Asia/Shanghai
    </IfModule>
    </Directory>
    <Directory "/usr/share/zabbix/conf">
    Order deny,allow
    Deny from all
    <files *.php>
    Order deny,allow
    Deny from all
    </files>
    </Directory>
    <Directory "/usr/share/zabbix/app">
    Order deny,allow
    Deny from all
    <files *.php>
    Order deny,allow
    Deny from all
    </files>

    </Directory>
    <Directory "/usr/share/zabbix/include">
    Order deny,allow
    Deny from all
    <files *.php>
    Order deny,allow
    Deny from all
    </files>
    </Directory>
    <Directory "/usr/share/zabbix/local">
    Order deny,allow
    Deny from all
    <files *.php>
    Order deny,allow
    Deny from all
    </files>
    </Directory>

    重启apache服务器

    service httpd start

    相关文章

      网友评论

          本文标题:CentOS 6.8 下 zabbix 3.2.6 安装及部署

          本文链接:https://www.haomeiwen.com/subject/nyvqhxtx.html