操作系统:CentOS 7
安装方式:源码安装
提示:源码安装相对比较复杂,会遇到较多问题,新手建议用yum安装
requires
libxml2
libxml2-devel
net-snmp-devel
libevent-devel
libcurl-devel
mysql-devel
$ yum -y install libxml2 libxml2-devel net-snmp-devel libevent-devel libcurl-devel mysql-devel
1. 准备LAMP或者LNMP环境,这里采用LNMP环境,安装详细步骤请参考 LNMP环境搭建
2. 下载安装包,并创建用户
$wget https://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.4.8/zabbix-3.4.8.tar.gz
$ tar -zxvf zabbix-3.4.0.tar.gz
groupadd zabbix
useradd -g zabbix zabbix -s /sbin/nologin -M
3. 创建zabbix数据库和用户名
$ mysql -uroot -p<password>
>mysql> create database zabbix character set utf8 collate utf8_bin;
>mysql> grant all privileges on zabbix.* to zabbix@localhost identified by '<password>';
>quit;
3.1导入数据
$cd zabbix-3.4.0/database/mysql
$mysql -uzabbix -p<password> zabbix < schema.sql
# stop here if you are creating database for Zabbix proxy
$mysql -uzabbix -p<password> zabbix < images.sql
$mysql -uzabbix -p<password> zabbix < data.sql
4.开始安装
$./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2
$make install
PS: --with-mysql=mysql_config,找不到可以用find / -name mysql_config*查找下路径
5.修改配置文件
修改zabbix_agentd配置文件/usr/local/etc/zabbix_agentd.conf
cat /usr/local/etc/zabbix_agentd.conf | grep -v '^#' | grep -v '^$'
LogFile=/tmp/zabbix_agentd.log
Server=127.0.0.1
ServerActive=127.0.0.1
Hostname=Zabbix server
修改zabbix_server配置文件/usr/local/etc/zabbix_server.conf
cat /usr/local/etc/zabbix_server.conf | grep -v '^#' | grep -v '^$'
LogFile=/tmp/zabbix_server.log
DBName=zabbix
DBUser=zabbix
DBPassword=******
Timeout=4
LogSlowQueries=3000
6.启动zabbix_server和zabbix_agentd
$zabbix_server
$zabbix_agentd
7. 将zabbix的php文件拷贝到网站目录下
我的网站根目录是/usr/local/nginx/html
创建zabbix目录
$ mkdir /usr/local/nginx/html/zabbix
$ cp -a /root/zabbix-3.4.8/frontends/php/* /usr/local/nginx/html/zabbix
在浏览器中打开http://ip/zabbix
可以进入zabbix安装界面
接下去就按提示安装,详情参考官方文档
网友评论