码迷,mamicode.com
首页 > 其他好文 > 详细

Zabbix的安装与配置

时间:2018-11-30 13:53:13      阅读:463      评论:0      收藏:0      [点我收藏+]

标签:libpcre   raw   dir   XmlReader   apache   pdo   data   zone   启动   


0、环境准备

配置PHP环境

rpm -Uvh http://mirrors.ustc.edu.cn/epel/epel-release-latest-6.noarch.rpm

yum install php72w.x86_64 php72w-cli.x86_64 php72w-common.x86_64 php72w-gd.x86_64 php72w-ldap.x86_64 php72w-mbstring.x86_64 php72w-mcrypt.x86_64 php72w-mysql.x86_64 php72w-pdo.x86_64

编辑php的ini文件(vim /etc/php.ini)并修改一下内容,注意date.timezone一定要写对,否则在配置完zabbix后,显示的界面全部报错 
max_execution_time = 300
memory_limit = 128M
post_max_size = 16M
upload_max_filesize = 2M
max_input_time = 300
always_populate_raw_post_data = -1
ldap.max_links = 10
date.timezone Asia/Shanghai
extension=bcmath.so

yum install php-bcmath php-mbstring php-xml  

不安装为报以下问题:
PHP bcmath extension missing (PHP configuration parameter --enable-bcmath).
PHP mbstring extension missing (PHP configuration parameter --enable-mbstring).
PHP xmlwriter extension missing.
PHP xmlreader extension missing.

配置Http服务

vim /etc/httpd/conf/httpd.conf

DirectoryIndex index.html index.html.var index.php

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

设置web前端
mkdir /var/www/html/zabbix
cp -a zabbix-3.4.13/frontends/php/ /var/www/html/zabbix/

设置apache的执行和所有者
chown -R apache:apache /var/www/html/zabbix

赋予可执行权限
chmod +x /var/www/html/zabbix/conf/

1、创建Mysql数据库

create database zabbix character set utf8 collate utf8_bin;
grant all privileges on zabbix.* to zabbix@‘%‘ identified by ‘zabbix‘;
flush privileges;

mysql>use zabbix;
mysql>source /opt/schema.sql;
mysql>source /opt/images.sql;
mysql>source /opt/data.sql;


2、下载解压安装包

wget "https://nchc.dl.sourceforge.net/project/zabbix/ZABBIX Latest Stable/3.4.13/zabbix-3.4.13.tar.gz"
tar -zxvf zabbix-3.4.13.tar.gz

cd zabbix-3.4.13/
./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --enable-java --with-net-snmp --with-libcurl --with-libxml2 --with-unixodbc --with-ssh2 --with-openipmi --with-openssl --prefix=/usr/local/zabbix

错误解决:
configure: error: Unable to use libevent (libevent check failed)
yum install libevent-devel -y
configure: error: Unable to use libpcre (libpcre check failed)
yum -y install pcre* 

make
make install


配置zabbix的服务和参数

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



vim /usr/local/zabbix/etc/zabbix_server.conf

DBHost=127.0.0.1
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
 

#修改 /etc/init.d/zabbix_server /etc/init.d/zabbix_agentd的BASEDIR=/usr/local/为BASEDIR=/usr/local/zabbix
sed -i ‘s#BASEDIR=/usr/local/#BASEDIR=/usr/local/zabbix#g‘ /etc/init.d/zabbix_{server,agentd}

3.服务启动

#启动Apache服务
service httpd start

#启用mysql服务
service mysqld start
/etc/init.d/zabbix_server start
/etc/init.d/zabbix_agentd start

http://10.66.3.219/zabbix/

  

  

Zabbix的安装与配置

标签:libpcre   raw   dir   XmlReader   apache   pdo   data   zone   启动   

原文地址:https://www.cnblogs.com/kevinlucky/p/10043326.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!