zabbix系统基于PHP环境运行,所以前提是系统上有PHP的运行环境,lnmp或者lamp环境
lnmp环境安装:http://www.cnblogs.com/rnckty/p/7642034.html
lamp环境安装:http://www.cnblogs.com/rnckty/p/4094272.html
1、下载源码包
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、安装依赖库
1 |
# yum -y install net-snmp-devel libxml2-devel libcurl-deve libevent libevent-devel |
3、解压并编译
1 2 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、安装
1 |
# make && make install |
5、创建zabbix用户和用户组
1 2 3 |
# groupadd zabbix # useradd -r -g zabbix zabbix # cd /usr/local && chown -R zabbix:zabbix zabbix |
6、创建zabbix数据库,并导入表结构
1 2 3 4 5 6 |
# 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、创建日志目录
1 2 3 |
# cd /usr/local/zabbix # mkdir logs # chown zabbix:zabbix logs |
8、修改zabbix_server.conf
1 2 3 4 5 6 7 8 9 10 |
# 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
1 2 3 4 5 |
# 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/*.conf |
10、启动zabbix_server 和 zabiix_agent服务
1 2 |
# /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
解决方法:
1 2 |
# ln -s /usr/local/mysql/lib/libmysqlclient.so.20 /usr/lib/ # ldconfig |
然后再次启动服务
11、拷贝WEB应用程序,/data/html为nginx或者Apache的运行PHP程序的目录
1 2 |
# 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
发表评论
要发表评论,您必须先登录。