zabbix安装

环境

192.168.0.219  zabbix server

192.168.0.230  zabbix agentd

软件

zabbix-2.4.5.tar.gz

Apache+MySQL+PHP

系统

Centos 7

Server端配置

一、关闭防火墙

setenforce 0 

   systemctl stop firewall

   systemctl disable firewall

二、安装epel扩展源

  Rpm -ivh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm

三、安装LAMP环境

yum install php php-gd php-mysql php-bcmath php-mbstring php-xml curl curl-devel net-snmp net-snmp-devel perl-DBI

yum –y install mariadb*

四、配置数据库

  systemctl start mariadb.service    启动数据库

  mysql –u root      进入数据库,密码为空

  MariaDB [(none)]>  create database zabbix character set utf8;  #创建数据库zabbix,数据库编码使用utf8

  MariaDB [(none)]>  grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix'; #允许账户能从本机连接至数据库zabbix

  MariaDB [(none)]> flush privileges;

五、ZABBIX的安装

 (1)wget http://nchc.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.4.5/zabbix-2.4.5.tar.gz   下载源码包

 tar zxf zabbix-2.4.5.tar.gz

 cd zabbix-2.4.5

 mkdir /usr/local/zabbix  创建zabbix的安装目录

 ./configure --with-mysql=/usr/bin/mysql_config --with-net-snmp --with-libcurl --enable-server --enable-agent --enable-proxy --prefix=/usr/local/zabbix

 --prefix----> 指定zabbix安装目录

 --enable-server----> 支持zabbix服务器

 --enable-agent----> 支持zabbix代理

 --enable-proxy----> 支持zabbix代理服务器

 --with-libcurl----> 使用curl包

 --with-net-snmp----> 使用net-snmp软件包,选择性地指定路径NET-SNMP配置

 --with-mysql=/usr/bin/mysql_config 使用MySQL客户端库可以选择指定路径mysql_config注:configure: error: no acceptable C compiler found in $PATH  错误

   原因没有安装gcc

   yum -y install gcc 

make install

(2)导入数据库

  mysql -u root

  MariaDB [(none)]> use zabbix;

  MariaDB [zabbix]> source /root/zabbix-2.4.5/database/mysql/schema.sql

  MariaDB [zabbix]> source /root/zabbix-2.4.5/database/mysql/data.sql

  MariaDB [zabbix]> source /root/zabbix-2.4.5/database/mysql/images.sql

  MariaDB [zabbix]> exit

(3)拷贝相关的配置文件到/etc/下

      [root@localhost ~]# mkdir -p /etc/zabbix

   [root@localhost ~]# cp -r zabbix-2.4.5/conf/* /etc/zabbix/

   [root@localhost ~]# chown -R zabbix:zabbix /etc/zabbix

   [root@localhost ~]#ln -s /usr/local/zabbix/etc /etc/zabbix/

   [root@localhost ~]# ln -s /usr/local/zabbix/bin/* /usr/bin/

   [root@localhost ~]# ln -s /usr/local/zabbix/sbin/* /usr/sbin/

(4) 配置zabbix_server.conf文件

      

[root@slave4 etc]# egrep -v '^$|^#' zabbix_server.conf

LogFile=/tmp/zabbix_server.log

DBName=zabbix

DBUser=zabbix

DBPassword=zabbix

(5)配置zabbix_agentd文件  

六、php配置

    vi /etc/php.ini

   max_execution_time = 300

    max_input_time = 300

   memory_limit = 128M

   upload_max_filesize = 2M

   date.timezone = Asia/Shanghai

   post_max_size = 28M

七、配置web站点

    cd zabbix-2.4.5/

  cp -r frontends/php /var/www/html/zabbix

    修改httpd.conf的参数

 vi /etc/httpd/conf/httpd.conf

   <IfModule dir_module>

         DirectoryIndex index.html index.php

  </IfModule>

     启动httpd服务

     Systemctl start httpd

八、初始化安装

     在浏览器中输入http://192.168.0.219/zabbix 访问web端,      

     根据提示进行

九、添加开机脚本

cd zabbix-2.4.5/

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

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

  chmod +x /etc/init.d/zabbix_server 

  sed –i 's/BASEDIR=/usr/local/BASEDIR=/usr/local/zabbix/g' /etc/init.d/zabbix_agentd

 chmod +x /etc/init.d/zabbix_agentd

  chkconfig zabbix_server on?

  chkconfig zabbix_agentd on

 /usr/local/zabbix/sbin/zabbix_server start

原文地址:https://www.cnblogs.com/Z-style/p/5610363.html