部署Zabbix需要LAMP环境(Linux、Apache、MysqL、PHP),所以首先要安装Apache(当然,Nginx也可以)、MysqL和PHP。在Ubuntu 16.04下只有PHP7.0而没有PHP5
#安装apahce2 sudoapt-getinstallapache2 #安装MysqL sudoapt-getinstallMysqL-server #安装PHP sudoapt-getinstallPHP7.0PHP7.0-gdlibapache2-mod-PHP7.0PHP7.0-MysqLPHP7.0-bcmathPHP7.0-mbstringPHP7.0-xml
以上完成了基本环境的安装,接下来安装zabbix
#获取3.4zabbix安装包 wgethttp://repo.zabbix.com/zabbix/3.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.4-1+xenial_all.deb
#使用dpkg安装3.4deb包 dpkg-izabbix-release_3.4-1+xenial_all.deb #更新apt aptupdate #安装zabbixweb程序 aptinstallzabbix-server-MysqLzabbix-frontend-PHPzabbix-agent #拷贝web程序到apache2 sudocp-r/usr/share/zabbix/var/www/html/zabbix
建立zabbix的库表,并导入数据
MysqL-uroot-p password MysqL>createdatabasezabbixcharactersetutf8collateutf8_bin; MysqL>grantallprivilegesonzabbix.*tozabbix@localhostidentifiedby'password'; MysqL>quit;
导入表结构和数据,官网的/usr/share/doc/zabbix-server-MysqL*/create.sql.gz目录是错误的,并不是doc下
zcat/usr/share/zabbix-server-MysqL*/create.sql.gz|MysqL-uzabbix-pzabbix
sudonano/etc/zabbix/zabbix_server.conf
配置参考如下,主要是修改密码
DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=zabbix12345
完成以上配置后,重启zabbix-server
sudo/etc/init.d/zabbix-serverrestart
把zabbix 加入开机启动
systemctlrestartzabbix-serverzabbix-agentapache2 systemctlenablezabbix-serverzabbix-agentapache2原文链接:https://www.f2er.com/ubuntu/349629.html