環境: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.confDBName=zabbixDBUser=zabbixDBPassword=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
進入頁面