CentOS 7 安装配置zabbix 3.2.8

运行环境:CentOS 7.2 LNMP(已提前安装好此环境)

1、首先导入zabbix安装源
# rpm -ivh http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm

2、安装zabbix包
# yum install zabbix-server-mysql zabbix-web-mysql

给本机也安装上客户端吧
# yum install zabbix-agent

3、新建zabbix数据库和zabbix用户信息
# mysql -uroot -prootpasswd
> create database zabbix character set utf8 collate utf8_bin;
> grant all privileges on zabbix.* to zabbix@localhost identified by '123456';
> flush privileges;
> quit
Bye

4、导入zabbix表结构
# cd /usr/share/doc/zabbix-server-mysql-3.2.5/
zcat create.sql.gz | mysql -uzabbix -p123456 zabbix

5、修改zabbix服务配置文件
# vim /etc/zabbix/zabbix_server.conf

DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=123456

6、启动zabbix服务,设置开机自启动
# systemctl start zabbix-server
# systemctl enable zabbix-server

7、zabbix的权限配置
# chown -R zabbix.zabbix /usr/share/zabbix
# chown -R zabbix:zabbix /etc/zabbix
# chown -R zabbix:zabbix /usr/lib/zabbix
# cp -ra /usr/share/zabiix /usr/local/
# chmod -R 755 /etc/zabbix/web #这步很重要,否则下面打开zabbix页面php会报500错误

8、配置PHP参数,满足zabbix的硬性要求
# vim /usr/local/php/etc/php.ini
max_execution_time = 300
max_input_time = 300
memory_limit = 128M
post_max_size = 16M
upload_max_filesize = 2M
date.timezone = Asia/Shanghai
always_populate_raw_post_data = -1

重启php
# /etc/init.d/php-fpm restart

9、添加zabbix的nginx配置文件
# cat /usr/local/nginx/conf/vhost/zabbix.test.com.conf

server
{
  listen 80;
  server_name zabbix.test.com;
  index index.html index.htm index.php;
  root /usr/local/zabbix;
  charset utf-8;


  location ~.*\.(swf|xml|mp3|png|jpg|gif|data)$ {
    expires max;
  }
  location ~.*\.(css|js|mx)$ {
    expires 96h;
  }
  location ~ /.svn/ {
    deny all;
  }


  location ~* \.(bak|save|sh|sql|mdb|svn|git|old)$ {
    #rewrite ^/(.*)$ $host permanent;
    return 403;
  }

  location ~ .*\.php$
  {
    include fcgi.conf;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    expires off;
  }

  access_log /data/logs/zabbix.test.com.access.log access;
  error_log /data/logs/zabbix.test.com.error.log warn;
}

重载nginx
/usr/local/nginx/sbin/nginx -t
/usr/local/nginx/sbin/nginx -s reload

10、在浏览器打开zabbix
根据提示一步一步配置下去

 

这里提示无法创建"zabbix.conf.php",那么点击"Download the configuration file"下载到电脑然后上传到/etc/zabbix/web目录即可

然后点击"Finish"即可完成配置

接着便可以登录了,默认账号密码是"admin/zabbix"

 

 

posted @ 2017-04-26 16:52  陌上归人的博客  阅读(920)  评论(0编辑  收藏  举报