系统:CentOS 6.3 X86_64
Zabbix版本:2.0.5
一、安装libpng
tar xvf libpng-1.5.14.tar.gz
cd libpng-1.5.14
./configure
make
make install
二、安装freetype
tar xvf freetype-2.1.10.tar.gz
cd freetype-2.1.10
./configure --prefix=/usr/local/freetype
make
make install
三、安装libjpeg
tar xvf jpegsrc.v6b.tar.gz
cd jpeg-6b
./configure --enable-shared --enable-static
make
------------------
出错:
[root@lump jpeg-6b]# make
./libtool --mode=compile gcc -O2 -I. -c ./jcapimin.c
make: ./libtool: Command not found
make: *** [jcapimin.lo] Error 127
[root@lump jpeg-6b]# vim Makefile
# If using GNU libtool, LIBTOOL references it; if not, LIBTOOL is empty.
LIBTOOL = ./libtool 修改为libtool
-----------------
make install
四、安装gd
tar xvf gd-2.0.35.tar.gz
cd gd-2.0.35
./configure --with-png --with-freetype --with-jpeg
make
make install
五、安装libxml
tar xvf libxml2-2.7.3.tar.gz
cd libxml2-2.7.3
./configure --enable-shared --enable-static
make
make install
六、安装php
tar xvf php-5.4.11.tar.bz2
cd php-5.4.11
./configure --prefix=/usr/local/php --with-gd --with-png-dir=/usr/local/ --with-jpeg-dir=/usr/local/ --with-freetype-dir=/usr/local/freetype/ --enable-bcmath --enable-ctype --with-libxml-dir=/usr/local/ --enable-sockets --enable-mbstring --with-gettext --with-mysql --with-mysql-sock=/data/mysql/log/mysql.sock --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-fpm
make
make install
cp php.ini-production /usr/local/php/lib/php.ini
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
cd /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
七、安装nginx
tar xvf pcre-8.31.tar.gz
tar xvf tengine-1.3.0.tar.gz
cd tengine-1.3.0
./configure --prefix=/usr/local/nginx --user=www --group=www --with-syslog --with-http_stub_status_module --with-pcre=../pcre-8.31
make
make install
八、安装zabbix
useradd -M -s /sbin/nologin zabbix
yum -y install net-snmp-devel libssh2-devel OpenIPMI-devel
tar xvf zabbix-2.0.5.tar.gz
cd zabbix-2.0.5
./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql=/usr/local/mysql/bin/mysql_config --enable-ipv6 --with-net-snmp --with-libcurl --with-ssh2 --with-openipmi
make install
九、安装mysql
yum -y install mysql-server
mysql安装目录/usr/local/mysql,数据目录/data/mysql/data
创建数据库、授权:
create database zabbix default charset utf8;
grant all on zabbix.* to zabbix@'localhost' indentified by password;
十、配置zabbix
导入数据库表结构、数据:
cd zabbix-2.0.5
mysql -uroot -p zabbix < database/mysql/schema.sql
mysql -uroot -p zabbix < database/mysql/images.sql
mysql -uroot -p zabbix < database/mysql/data.sql
当登录出现下面的错误时,是因为没有导入数据表结构等:
"mysql_free_result() expects parameter 1 to be resource, boolean given [include/db.inc.php:570]"
修改zabbix配置文件:
# vim /usr/local/zabbix/etc/zabbix_server.conf
配置以下选项:
DBHost=127.0.0.1
DBName=zabbix
DBUser=zabbix
DBPassword=password
启动zabbix_server:
cp misc/init.d/fedora/core5/zabbix_* /etc/init.d/
修改启动脚本,将"/usr/local"修改为"/usr/local/zabbix"(因zabbix安装在/usr/local/zabbix目录),如:ZABBIX_BIN=" /usr/local/zabbix/sbin/zabbix_server"
chkconfig --add zabbix_server
chkconfig --add zabbix_agentd
chkconfig --level 2345 zabbix_server on
chkconfig --level 2345 zabbix_agentd on
拷贝web程序:
mkdir /data/zabbix/html -p
cd zabbix-2.0.5
cp frontends/php/* /data/zabbix/html/ -a
chown www.www -R /data/zabbix/html/
修改php.ini配置文件:
# vim /usr/local/php/lib/php.ini
memory_limit = 128M
post_max_size = 16M
upload_max_filesize = 2M
max_execution_time = 300
max_input_time = 300
session.auto_start = 0
date.timezone = Asia/Shanghai
重启php-fpm:
/etc/init.d/php-fpm restart
配置nginx:
# cat /usr/local/nginx/conf/nginx.conf
user www www;
worker_processes 4;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost; #这里最好指定域名或服务器ip地址,因当在zabbix web页面进行跳转时,使用localhost会404错误。
root /data/zabbix/html;
location / {
index index.php index.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
}
}
进行web安装:浏览器输入 http://zabbix_server_ip
登录:默认用户名:admin,密码:zabbix
查看zabbix支持的监控项:
/usr/local/zabbix/sbin/zabbix_agentd -p
参考文档:
https://www.zabbix.com/documentation/2.0/manual/installation/install