1、下载源码包
# wget -O zabbix-3.4.2.tar.gz http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/3.4.2/zabbix-3.4.2.tar.gz/download
2、安装依赖库
# yum -y install net-snmp-devel libxml2-devel libcurl-deve libevent libevent-devel
3、解压并编译
# tar -zxf zabbix-3.4.2.tar.gz # cd zabbix-3.4.2 # ./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2
4、安装
# make && make install
5、创建zabbix用户和用户组
# groupadd zabbix # useradd -r -g zabbix zabbix# cd /usr/local && chown -R zabbix:zabbix zabbix
6、创建zabbix数据库,并导入表结构
# mysql -uroot -p mysql> create database if not exists zabbix default character set utf8 collate utf8_general_ci;mysql> use zabbix;mysql> source /tmp/zabbix-3.4.2/database/mysql/schema.sql;mysql> source /tmp/zabbix-3.4.2/database/mysql/images.sql;mysql> source /tmp/zabbix-3.4.2/database/mysql/data.sql;
7、创建日志目录
# cd /usr/local/zabbix # mkdir logs # chown zabbix:zabbix logs
8、修改zabbix_server.conf
# vim ./etc/zabbix_server.conf LogFile=/usr/local/zabbix/logs/zabbix_server.log PidFile=/tmp/zabbix_server.pid DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=zabbix DBSocket=/tmp/mysql.sock Include=/usr/local/zabbix/etc/zabbix_server.conf.d/*.conf
9、修改zabbix_agent.conf
# vim ./etc/zabbix_agentd.conf PidFile=/tmp/zabbix_agentd.pid LogFile=/usr/local/zabbix/logs/zabbix_agentd.log Include=/usr/local/zabbix/etc/zabbix_agentd.conf.d/*.con
10、启动zabbix_server 和 zabiix_agent服务
# /usr/local/zabbix/sbin/zabbix_server # /usr/local/zabbix/sbin/zabbix_agent
PS:如果再启动的时候报错:error while loading shared libraries: libmysqlclient.so.20:
cannot open shared object file: No such file or directory
解决方法:
# ln -s /usr/local/mysql/lib/libmysqlclient.so.20 /usr/lib/ # ldconfig
然后再次启动服务
11、拷贝WEB应用程序,/data/html为nginx或者Apache的运行PHP程序的目录
# mv /tmp/zabbix-3.4.2/frontends/php/ /data/html/zabbix# chown -R www:www /data/html/zabbix
12、访问zabbix:http://ip/zabbix/index.php,初始化安装的默认账号:Admin,密码:zabbix