一、ZABBIX 安装
原创:Perry.Zhang
修改:Jane.Hoo
本文未经许可严禁转载。
注:涉及到的可自定义的部分均使用变量表示。如zabbix安装路径为$ZABBIX_HOME。
1.LNMP环境搭建
1.1.Nginx安装
1.1.1.环境依赖
1) 支持rewrite功能必须安装pcre 。perl兼容的正则表达式库。
# yum install pcre*
[root@zabbix ~]# rpm -qa|grep pcre*
pcre-static-7.8-6.el6.x86_64
pcre-7.8-6.el6.x86_64
pcre-devel-7.8-6.el6.x86_64
2) 如需要SSL支持则还需要安装openssl包。
# yum install openssl*
[root@zabbix ~]# rpm -qa|grep openssl
openssl-static-1.0.1e-30.el6.11.x86_64
openssl098e-0.9.8e-18.el6_5.2.x86_64
openssl-1.0.1e-30.el6.11.x86_64
openssl-devel-1.0.1e-30.el6.11.x86_64
openssl-perl-1.0.1e-30.el6.11.x86_64
1.1.2.下载源码包
(本文使用1.9.3版本)
# wgethttp://nginx.org/download/nginx-1.9.3.tar.gz
1.1.3.解压与编译安装
$NGINX_HOME=/data/nginx
# tar -zxvf nginx-1.9.3.tar.gz
# ./configure--prefix=$NGINX_HOME \
--with-http_ssl_module--with-http_spdy_module \
--with-http_stub_status_module\
--with-pcre
# make&& make install
#ln –s $NGINX_HOME /usr/local/nginx
1.1.4.修改配置文件
详情参见nginx.conf和sites-enabled/$YOUR_VHOST.conf, $NGINX_HOME/sites-enabled是自定义的目录,用来存放虚机配置。
1.1.5.检测
1) 在修改完nginx的配置文件后,应该先使用# $NGINX_HOME/sbin/nginx –t 验证配置文件是否没有报错
2) 如果配置文件修改无误的话,应使用# $NGINX_HOME/sbin/nginx –S reload命令热启动,重新加载新的配置文件即可,无需重启服务。
1.1.6.配置开机启动
# vim /etc/rc.local
加入:$NGINX_HOME/sbin/nginx
启动服务:
$NGINX_HOME/sbin/nginx
1.2.PHP安装
1.2.1.环境依赖
# yuminstall gcc make gd-devellibjpeg-turbo-devel libpng-devel libxml2-devel bzip2-devellibcurl-devel–y
注意:gd-devel是zabbix运行环境非必需软件,但是其它复杂php程序运行的必需软件
1.2.2.下载源码包
(本文使用5.5.27版本)
#wget http://cn2.php.net/distributions/php-5.5.27.tar.gz
1.2.3.解压与编译安装
# tar zxvf php-5.5.27.tar.gz
$PHP_HOME=/data/php
# ./configure--prefix=$PHP_HOME\
--enable-fpm \
--with-fpm-user=daemon\
--with-fpm-group=daemon\
--with-config-file-path=/usr/local/php/etc\
--with-mysql=mysqlnd\
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd\
--with-iconv\
--with-iconv-dir \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--with-gd \
--with-zlib \
--with-libxml-dir \
--with-curl \
--with-curlwrappers \
--with-mhash \
--with-xmlrpc \
--with-mcrypt\
--with-openssl \
--enable-xml\
--disable-rpath \
--enable-safe-mode \
--enable-bcmath\
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--enable-mbregex \
--enable-mbstring\
--enable-gd-native-ttf \
--enable-ftp \
--enable-pcntl \
--enable-sockets \
--enable-zip\
--enable-soap \
--disable-debug \
--disable-ipv6\
--with-gettext\
--enable-calendar\
--enable-dom
# make && make install
#ln –s $PHP_HOME/usr/local/php
注:
1) 特别需要注意libmcrypt包。由于CentOS没有版权所以通用的官方源里都没有这个包。推荐大家使用atomic的第三方源,或者使用源码包安装(没有编译安装过的不建议)。