环境:Centos6.10 已有lnmp环境 mysql5.7 php7.2
创建zabbix数据库
mysql> create database zabbix character set utf8 collate utf8_bin; mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
创建zabbix用户
shell> groupadd zabbix shell> useradd -g zabbix zabbix
下载zabbix3.2.0安装包
wget https://nchc.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.2.6/zabbix-3.2.6.tar.gz
导入zabbix数据到数据库中
shell> tar zxvf zabbix-3.2.6.tar.gz shell> cd zabbix-3.2.6/database/mysql/ shell> mysql -u zabbix -pzabbix < schema.sql shell> mysql -u zabbix -pzabbix < images.sql shell> mysql -u zabbix -pzabbix < data.sql
编译安装zabbix(同时安装server端和agent端)
shell>cd /root/zabbix-3.2.6 shell> ./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2 --with-unixodbc --with-ssh2 --with-openipmi --with-openssl shell> make install
修改配置启动文件
shell>vim /usr/local/etc/zabbix_server.conf DBName=zabbix DBUser=zabbix DBPassword=zabbix
创建zabbix-web页面文件夹
mkdir /home/zabbix cd /usr/local/zabbix/frontends/php/ cp -a . /home/zabbix/
配置nginx配置文件server段
server { listen 88; root /home/www/wwwroot/zabbix; #页面路径 index index.html index.htm index.php; include enable-php.conf; location ~* \.(auto)\.(jpg|gif|png|jpeg)?$ { if (!-f $request_filename) { rewrite ^/.*$ /autoimg.php; } expires max; } }
授权
chown -R www.www /home/zabbix
chmod +x /home/zabbix/conf/
拷贝启动服务
cp /usr/local/zabbix/misc/init.d/fedora/core/zabbix_server /etc/init.d/zabbix_server
优化PHP
vim /etc/php.ini post_max_size=16M max_execution_time=300 max_input_time=300 date.timezone=Asia/Shanghai always_populate_raw_post_data=-1 /etc/init.d/httpd restart
启动服务:
service nginx reload
service zabbix_server start
进入页面