配置环境:LAMP+ZABBIX

上传zabbix软件到服务器:zabbix-3.0.0alpha2.tar.gz


安装环境需要的依赖包:

yum -y install gcc gcc-c++  automake mysql-server httpd php mysql-devel net-snmp-devel curl-devel perl-DBI php-gd php-mysql php-bcmath php-mbstring php-xml


note:php建议>=5.4,如果小于这个版本可能会出现以下报错:

PHP Parse error:  syntax error, unexpected '[' in /var/www/html/zabbix/index.php on line 29

升级php:http://crfsz.blog.51cto.com/7835882/1851023


重启mysql

#新搭建的mysql需要给root用户配置密码
mysql –uroot
set password for 'root'@'localhost' = password('admin');

#创建zabbix数据库及导入zabbix初始化数据
mysql –uroot –padmin   
create database zabbix character set utf8;
grant all on zabbix.* TO zabbix@'localhost' identified by 'zabbix';
flush privileges;

cd zabbix-3.0.0alpha2/database/mysql #进入sql目录
mysql -uroot -padmin zabbix < schema.sql
mysql -uroot -padmin zabbix < p_w_picpaths.sql
mysql -uroot -padmin zabbix < data.sql


添加zabbix用户
groupadd zabbix
useradd zabbix -g zabbix -s /sbin/nologin


安装zabibx服务
mkdir /usr/local/zabbix  #创建目录
tar –zxvf zabbix-3.0.0alpha2.tar.gz  #解压

#编译安装

cd zabbix-3.0.0alpha2
./configure --with-mysql --with-net-snmp --with-libcurl --enable-server --enable-agent --enable-proxy --prefix=/usr/local/zabbix/
make
make install


修改zabbix配置文件
cp misc/init.d/fedora/core5/zabbix_server /etc/init.d/
chmod 755 /etc/init.d/zabbix_*
vim /etc/init.d/zabbix_server
修改ZABBIX_BIN=”/usr/local/zabbix/sbin/zabbix_server”


修改php的配置文件
vim /etc/php.ini

sed -i 's/^.*date\.timezone.*=.*$/date\.timezone = Asia\/Shanghai/g' /etc/php.ini
sed -i 's/^.*max_execution_time.*=.*$/max_execution_time = 300/g' /etc/php.ini
sed -i 's/^.*post_max_size.*=.*$/post_max_size = 32M/g' /etc/php.ini
sed -i 's/^.*max_input_time.*=.*$/max_input_time=300/g' /etc/php.ini
sed -i 's/^.memory_limit.*=.*$/memory_limit = 128M/g' /etc/php.ini
#sed -i 's/^.mbstring\.func_overload.*=.*$/mbstring.func_overload = 1/g' /etc/php.ini


将zabbix的部署文件放在apache的目录下面
cp -r  frontends/php/* /var/www/html/zabbix/
chown –R zabbix:zabbix /var/www/html/zabbix/*

启动相对应的服务
/etc/init.d/mysql
/etc/init.d/httpd start
/etc/init.d/zabbix_server start


访问URL:http://192.168.1.86/zabbix/index.php

开始安装zabbix

centos 6.6安装zabbix3.0_第1张图片


centos 6.6安装zabbix3.0_第2张图片


centos 6.6安装zabbix3.0_第3张图片

centos 6.6安装zabbix3.0_第4张图片


账户和密码:admin/zabbix




爬坑:

一、

安装到数据库那一步提示:The frontend does not match Zabbix database.

检查之后发现zabbix库没数据,又重新导入一次解决。


二、安装完成后

Access denied.Your are logged in as guest. You have no permissions to access this page.If you think this message is wrong, please consult your administrators about getting the necessary permissions.


解决参考:

http://www.ttlsa.com/zabbix/login-as-guest-zabbix/


三、PHP always_populate_raw_post_data -1

http://very1024.blog.51cto.com/3588520/1722902

重启http生效


四、zabbix server is not running the information……

 connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost' (using password: NO)
 31914:20161206:200208.756 database is down: reconnecting in 10 seconds

解决方法: /etc/zabbix/zabbix_server.conf中的数据库配置项目 密码那项没有启用,去掉注释,填上密码再次启动即可