Zabbix 3.0 + Nginx + Mariadb

1.安装nginx,php-fpm,依赖开发包
# yum install nginx -y
# yum install php-fpm php-pear php-devel php-common php-bcmath php-mbstring php-gd php-xml php-mysql -y
# yum install mariadb-devel libcurl-devel net-snmp-devel gd-devel libjpeg-devel libpng-devel libxml2-devel bzip2-devel
 
2.创建zabbix配置
/etc/nginx/conf.d/zabbix.conf 配置文件内容如下:
 
server {
listen 80;
server_name zabbix.demo.com;
index index.html index.php;
root /var/www/zabbix;
location ~ .*.php$ {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
 
3.创建运行zabbix的用户
# groupadd zabbix
# useradd -g zabbix zabbix
 
4.下载zabbix源码,解压缩,复制zabbix的前端图形界面文件到web目录中。
# tar -zxvf zabbix-3.0.9.tar.gz
# cd frontends/php
# cp -a . /var/www/zabbix
 
5.修改/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
 
6.初始化zabbix数据库
shell> mysql -u -p
mysql> create database zabbix default character set utf8 collate utf8_general_ci;
mysql> grant all privileges on zabbix.* to 'zabbix'@'localhost' identified by 'set-password-here';
mysql> quit;
# mysql -u -p zabbix < database/mysql/schema.sql
*** stop here if you are creating database for Zabbix proxy ***
# mysql -u -p zabbix < database/mysql/images.sql
# mysql -u -p zabbix < database/mysql/data.sql
 
7.编译zabbix
安装服务器
# ./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl
# make install
 
安装代理(如果使用sqlite)
./configure --prefix=/usr --enable-proxy --with-net-snmp --with-sqlite3 --with-ssh2
 
安装客户端
./configure --enable-agent
 
8.修改/usr/local/etc/zabbix_server.conf
DBName=zabbix
DBUser=zabbix
DBPassword=set-password-here
 
9.修改目录权限
# vim /etc/php-fpm.d/www.conf 看到文件末尾有一行:
php_value[session.save_path] = /var/lib/php/session
 
发现 /var/lib/php/下面没有session目录,创建并授权
# mkdir /var/lib/php/session
# setfacl -R -m u:www:rwx /var/lib/php/session
 
*** 如果不做这一步,后面页面setup.php 会一直卡在第一步
 
10.启动php-fpm,nginx,zabbix_server
# systemctl start php-fpm
# nginx
# cp zabbix-3.0.9/misc/init.d/fedora/core/zabbix_server /etc/init.d/
# /etc/init.d/zabbix_server start
原文地址:https://www.cnblogs.com/sunjzz/p/7056510.html