先安装myql和php
mysql5.7.17: http://www.cnblogs.com/cjsblogs/p/8116782.html
php7.2.1: http://www.cnblogs.com/cjsblogs/p/8116782.html
安装zabbix
# tar -zxf zabbix-3.4.6.tar.gz
# cd zabbix-3.4.6
# mkdir -p /usr/local/zabbix/logs
# ./configure --prefix=/usr/local/zabbix --with-mysql=/usr/local/mysql/bin/mysql_config --with-net-snmp --enable-server --enable-agent --enable-proxy --with-libcurl --with-ssh2 --with-openipmi --with-unixodbc --enable-java
make && make install
创建zabbix用户和用户组
# groupadd zabbix
# useradd -r -g zabbix zabbix
# cd /usr/local && chown -R zabbix:zabbix zabbix
创建zabbix数据库,并导入表结构
# mysql -uroot -p
mysql> create database if not exists zabbix default character set utf8 collate utf8_general_ci;
mysql> use zabbix;
mysql> source /tmp/zabbix-3.4.6/database/mysql/schema.sql;
mysql> source /tmp/zabbix-3.4.6/database/mysql/images.sql;
mysql> source /tmp/zabbix-3.4.6/database/mysql/data.sql;
修改zabbix_server.conf
LogFile=/usr/local/zabbix/logszabbix_server.log
LogFileSize=50
PidFile=/usr/local/zabbix/etc/zabbix_server.pid
SocketDir=/var/run/zabbix
DBName=zabbix
DBPassword=zabbix
DBUser=zabbix
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
Timeout=4
AlertScriptsPath=/usr/lib/zabbix/alertscripts
ExternalScripts=/usr/lib/zabbix/externalscripts
LogSlowQueries=3000
启动zabbix_server
# ln -s /usr/local/mysql/lib/libmysqlclient.so.20 /usr/lib/
# ldconfig
# /usr/local/zabbix/sbin/zabbix_server
安装NGINX
nginx: http://www.cnblogs.com/cjsblogs/p/8426140.html
添加配置文件zabbix.conf
# cd /usr/local/nginx/conf/vhosts/
# vim zabbix.conf
server {
listen 80;
server_name ip;
root /usr/local/nginx/html/zabbix;
index index.html index.htm index.php;
location ~* ^.+\.(js|ico|gif|jpg|jpeg|pdf|png|css|swf)$ {
expires 30d;
access_log off;
}
location ~ ^/.*\.php?$ {
include fcgi.conf;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
拷贝网页文件到 nginx 目录
cp -r ~/zabbix-3.4.6/frontends/php/ /usr/local/nginx/html/zabbix
chown -R www.www /usr/local/nginx/html/zabbix
启动nginx
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf