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

centos6.5 搭建zabbix3.0

时间:2017-04-14 23:12:11      阅读:386      评论:0      收藏:0      [点我收藏+]

标签:--nodeps   ref   connector   grant   lda   base   北京时间   ide   zabbix3.0   

一.搭建LAMP平台

注意zabbix3.0需要php5.4以上的版本

(1)安装依赖包

httpd和mysql安装过程省略

rpm -e httpd --nodeps

 

yum -y install mysql-devel gcc gcc-c++ autoconf httpd-manual mod_perl mod_auth_mysql mysql-connector-odbc libdbi-dbd-mysql net-snmp-devel curl-devel unixODBC-devel java-devel openldap openldap-devel ncurses-devel

 

2)安装源码包LAMP

php编译参数

./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/httpd/bin/apxs --with-mysql=/usr/local/mysql --with-openssl --enable-sockets --enable-sysvshm --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib-dir --with-libxml-dir=/usr --enable-xml --with-mhash --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-curl --with-gd --with-gettext --enable-bcmath --enable-opcache

 

cp php.ini-development  /etc/php.ini

 

 

建议用源码包安装PHP

 

 

 

修改php.ini  因为zabbix的运行环境要求,否则zabbix 的环境检测室无法通过的

 

 vim /etc/php.ini

440 max_execution_time = 300

449 max_input_time = 300

457 memory_limit = 128M

706 always_populate_raw_post_data = -1 #去掉注释

729 post_max_size = 16M

946 date.timezone = Asia/Shanghai    #启用并修改

1586 mbstring.func_overload = 2       #启用并修改

 

 

4.修改php配置文件(用sed修改上边的参数)

 

sed -i "s@;date.timezone =@date.timezone = Asia/Shanghai@g" /etc/php.ini

sed -i "s@max_execution_time = 30@max_execution_time = 300@g" /etc/php.ini
sed -i "s@post_max_size = 8M@post_max_size = 32M@g" /etc/php.ini

sed -i "s@max_input_time = 60@max_input_time = 300@g" /etc/php.ini

sed -i "s@memory_limit = 128M@memory_limit = 128M@g" /etc/php.ini

sed -i "s@;mbstring.func_overload = 0@ambstring.func_overload = 2@g" /etc/php.ini

 

5、启动httpdmysql

/etc/init.d/httpd start

/etc/init.d/mysqld start

 

6、编译安装zabbix

useradd -s /sbin/nologin zabbix

mkdir /etc/zabbix /var/log/zabbix

chown -R zabbix.zabbix /var/log/zabbix/

 

更改系统时间,系统时间和北京时间一致

date 041211482017

tar xf zabbix-3.0.4.tar.gz  -C /usr/src/

cd /usr/src/zabbix-3.0.4/

 

./configure --prefix=/usr/local/zabbix --sysconfdir=/etc/zabbix/ \

--enable-server \

--enable-proxy\

 --enable-agent\

 --enable-ipv6\

 --with-mysql=/usr/bin/mysql_config\

 --with-net-snmp\

 --with-libcurl\

 --with-unixodbc\

 --with-ldap \

--enable-java

 

make && make install

 

 

复制启动脚本

cp misc/init.d/fedora/core/zabbix_* /etc/init.d/

编辑启动脚本,更改安装路径

sed -i ‘s/BASEDIR=\/usr\/local/BASEDIR=\/usr\/local\/zabbix/g‘ /etc/init.d/zabbix_server

 sed -i ‘s/BASEDIR=\/usr\/local/BASEDIR=\/usr\/local\/zabbix/g‘ /etc/init.d/zabbix_agentd

 

7.修改zabbix的主配置文件

cd /etc/zabbix/

cp zabbix_server.conf zabbix_server.conf.origin

vim  zabbix_server.conf

39 LogFile=/var/log/zabbix/zabbix_server.log

87 DBName=zabbix

103 DBUser=zabbix

112  DBPassword=zabbix

120  DBSocket=/tmp/mysql.sock

128  DBPort=3306

77  DBHost=localhost

 

可以用sed修改

sed -i "s@DBUser=root@DBUser=zabbix@g" /etc/zabbix/zabbix_server.conf
sed -i "s@#DBPassword=@DBPassword=zabbix@g" /etc/zabbix/zabbix_server.conf
sed -i "s@# DBPassword=@DBPassword=zabbix@g" /etc/zabbix/zabbix_server.conf
sed -i "s@ # DBSocket=/tmp/mysql.sock@ DBSocket=/tmp/mysql.sock@g" /etc/zabbix/zabbix_server.conf

sed -i "s@# DBPort=3306@DBPort=3306 @g" /etc/zabbix/zabbix_server.conf

sed -i "s@# DBHost=localhost@DBHost=localhost@g" /etc/zabbix/zabbix_server.conf

 

cp zabbix_agentd.conf zabbix_agentd.conf.origin

编辑agentd.conf的配置文件

vim zabbix_agentd.conf

 LogFile=/var/log/zabbix/zabbix_agentd.log

 91 Server=127.0.0.1,192.168.3.10    #服务端IP

 132 ServerActive=192.168.3.10:10051   #服务端IP,固定端口

 264 Include=/etc/zabbix/zabbix_agentd.conf.d/     #自定义配置文件的路径

 280 UnsafeUserParameters=1   #自定义脚本功能,1为开启

 

8.导入数据库文件

cd /usr/src/zabbix-3.0.4/

mysqladmin -u root password ‘123123‘

 

登录mysql创建数据库,并且授权

mysql> create database zabbix character set utf8;

Query OK, 1 row affected (0.02 sec)

mysql> grant all on zabbix.* to ‘zabbix‘@localhost identified by ‘zabbix‘;

Query OK, 0 rows affected (0.03 sec)

mysql> flush privileges;        #刷新权限

Query OK, 0 rows affected (0.00 sec)

 

mysql -uzabbix -pzabbix zabbix < database/mysql/schema.sql

mysql -uzabbix -pzabbix zabbix < database/mysql/images.sql

mysql -uzabbix -pzabbix zabbix < database/mysql/data.sql

 

 

9、部署php页面

cd /usr/src/zabbix-3.0.4/

cp -rf frontends/php/ /usr/local/httpd/htdocs/zabbix/

chown -R apache:apache /usr/local/httpd/htdocs/zabbix/

 

 10、通过浏览器测试

http://192.168.3.10/zabbix/setup.php

 

 

 

 

 

centos6.5 搭建zabbix3.0

标签:--nodeps   ref   connector   grant   lda   base   北京时间   ide   zabbix3.0   

原文地址:http://www.cnblogs.com/pangbing/p/6711176.html

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