安装环境
系统:CentOS7.1
Apache:2.4.6
MySQL:5.6.26
PHP:5.6.12
安装Zabbix之前
获取Zabbix2.5源代码
# cd /tmp
# wget 'http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Development/2.5.0/zabbix-2.5.0.tar.gz'
# tar -zxvf zabbix-2.5.0.tar.gz
添加zabbix用户
# groupadd zabbix
# useradd -g zabbix zabbix
创建Zabbix数据库
# mysql -uroot
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'YOURPASSWORD';
mysql> exit
导入数据
# cd /tmp/zabbix-2.5.0/database/mysql
# mysql -uroot zabbix < schema.sql
# mysql -uroot zabbix < images.sql
# mysql -uroot zabbix < data.sql
编译安装Zabbix
准备编译安装
# yum -y install gcc libxml2-devel net-snmp-devel libcurl-devel
准备编译
# cd /tmp/zabbix-2.5.0
# ./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2
~ 省略 ~
Configuration:
Detected OS: linux-gnu
Install path: /usr/local
Compilation arch: linux
Compiler: gcc
Compiler flags: -g -O2 -I/usr/include/mysql -g -m64 -fPIC -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing -I/usr/include/libxml2 -I/usr/local/include -I/usr/lib64/perl5/CORE -I. -I/usr/include
Enable server: yes
Server details:
With database: MySQL
WEB Monitoring: cURL
Native Jabber: no
SNMP: yes
IPMI: no
SSH: no
ODBC: no
Linker flags: -rdynamic -L/usr/lib64/mysql -L/usr/lib64
Libraries: -lm -ldl -lresolv -lmysqlclient -lxml2 -lnetsnmp -lcurl
Enable proxy: no
Enable agent: yes
Agent details:
Linker flags: -rdynamic
Libraries: -lm -ldl -lresolv -lcurl
Enable Java gateway: no
LDAP support: no
IPv6 support: yes
***********************************************************
* Now run 'make install' *
* *
* Thank you for using Zabbix! *
* *
***********************************************************
编译及安装
# make install
安装Zabbix之后
修改php.ini
# sed -i -e "s/memory_limit = 128M/memory_limit = 256M/g" /etc/php.ini
# sed -i -e "s/post_max_size = 8M/post_max_size = 16M/g" /etc/php.ini
# sed -i -e "s/max_execution_time = 30/max_execution_time = 300/g" /etc/php.ini
# sed -i -e "s/max_input_time = 60/max_input_time = 300/g" /etc/php.ini
# sed -i -e "s/;date.timezone =/date.timezone = Asia/Chongqing/g" /etc/php.ini
# sed -i -e "s/;always_populate_raw_post_data/always_populate_raw_post_data/g" /etc/php.ini
修改Zabbix配置文件
修改DBName、DBUser、DBPassword参数,必须和MySQL配置的数据库名,用户名,密码一致。
# vi /usr/local/etc/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=YOURPASSWORD
# mkdir /var/www/html/zabbix
# cp -a /tmp/zabbix-2.5.0/frontends/php/* /var/www/html/zabbix
# chown -R apache:apache /var/www/html/zabbix/*
启动Zabbix
# /usr/local/sbin/zabbix_server
启动Apache
# systemctl start httpd
Web界面安装Zabbix
启动浏览器,访问http://YourIP/zabbix
1) 点击「Next step」