zabbix4.0编译安装

发布于 2020-01-16  76 次阅读


下载地址:

https://nchc.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/4.0.16/zabbix-4.0.16.tar.gz

 

解压安装:

tar xf zabbix-4.0.16.tar.gz

groupadd zabbix

useradd -g zabbix zabbix

yum install -y net-snmp net-snmp-devel libevent libevent-devel

./configure --prefix=/application/zabbix --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2

make install

echo 'export PATH=/application/zabbix/sbin:$PATH'  >> /etc/profile

 

配置mysql:

create database zabbix character set utf8 collate utf8_bin;

grant all privileges on zabbix.* to 'zabbix'@'localhost' identified by '<password>';

导入库:

cd /server/packages/zabbix-4.0.16/frontends/phpdatabase/mysql
mysql -uzabbix -p<password> zabbix < schema.sql
# 下面步骤当创建Zabbix proxy数据库时不需要执行
mysql -uzabbix -p<password> zabbix < images.sql
mysql -uzabbix -p<password> zabbix < data.sql

 

配置zabbix_server
vim /application/zabbix/etc/zabbix_server.conf
DBName=zabbix
DBUser=zabbix
DBUser=zabbix

 

启动zabbix_server(agent同理)

su - zabbix -c zabbix_server

 

安装zabbix_web
/server/packages/zabbix-4.0.16/frontends/php
cp -a /application/zabbix_web

打开浏览器安装

 

zabbix-server启动脚本

[Unit]
Description=zabbix server
After=syslog.target network.target

[Service]
Type=simple
PIDFile=/tmp/zabbix_server.pid
ExecStart=/application/zabbix/sbin/zabbix_server
ExecReload=/bin/kill -USR2 $MAINPID
ExecStop=/bin/kill -SIGTERM $MAINPID

[Install]
WantedBy=multi-user.target

何来人间惊鸿客,只是尘世一俗人