蒦嗳伱 发表于 2018-11-14 07:50:06

zbbix安装 nginx+php+zabbix3.0

  好久没有接触监控类的软件了,今天抽空搭建了下最新的版本
  首先系统环境
  zabbix-server-1 192.168.11.11   centos6.7
  mysql-server    192.168.11.5    mysql服务器独立安装
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
  两台服务器,mysql独立安装好的,这个安装不在此介绍了
  zabbix-server-1 是全新安装,安装时选择基本安装,同时在开发组件里把
  服务器平台开发
  桌面平台开发
  附加开发
  勾选上
  另外为了让web页面能够支持中文显示,在语言里,添加中午字体
  中文支持
  以上安装包对应的英文选项就不在此介绍了
  系统安装完后
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
  本次所需的第三方软件包
  以下软件包通过官网下载
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
  zabbix-3.0.3.tar.gz   http://www.zabbix.com/download.php官网下载页面
  http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/3.0.3/zabbix-3.0.3.tar.gz/download下载链接
  nginx-1.10.1.tar.gzhttp://nginx.org/en/download.html 官网下载页面
  http://nginx.org/download/nginx-1.10.1.tar.gz 下载链接
  php-5.6.22.tar.gzhttp://php.net/downloads.php 官网下载页面
  http://php.net/get/php-5.6.22.tar.gz/from/a/mirror下载链接列表
  http://cn2.php.net/get/php-5.6.22.tar.gz/from/this/mirror选择中国站点下载
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
  配置yum仓库
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
  # catzabbix.repo
  
  name=CentOS-$releasever- Base
  #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
  baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
  gpgcheck=1
  gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
  enabled=1
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
  yum clean all # 清除yum缓存
  yum makecache # 生成yum缓存
  开始安装nginx
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
  #安装依赖包
  yuminstall pcre pcre-devel openssl openssl-develgcc-c++
  useradd -s/sbin/nologin -M nginx
  tar xf nginx-1.10.1.tar.gz
  ./configure--user=nginx --group=nginx --prefix=/application/nginx-1.10.1 --with-http_stub_status_module --with-http_ssl_module
  make
  make install
  ln -s /application/nginx-1.10.1/ /application/nginx
  /application/nginx/sbin/nginx #start nginx service
  ps -ef|grep nginx
  ss -lntup|grep nginx
  # pwd
  /application/nginx/conf
  egrep -v "#|^$"nginx.conf.default > nginx.conf
  #修改部分配置
  # cat nginx.conf
  worker_processes1;
  events {
  worker_connections1024;
  }
  http {
  include       mime.types;
  default_typeapplication/octet-stream;
  sendfile      on;
  keepalive_timeout65;
  server {
  listen       80;
  server_namelocalhost;
  location / {
  root   html;
  indexindex.php index.html index.htm;
  }
  error_page   500502503504/50x.html;
  location =/50x.html {
  root   html;
  }
  location~\.(php|php5)?$ {
  root/application/nginx/html;
  fastcgi_pass 127.0.0.1:9000;
  fastcgi_indexindex.php;
  fastcgi_paramSCRIPT_FILENAME /application/nginx/html$fastcgi_script_name;
  include    fastcgi_params;
  }
  }
  }
  #杀死进程,重启服务
  ps -ef|grep nginx
  /application/nginx/sbin/nginx
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
  安装php依赖包
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
  yuminstall zlib-devel libxml2-devel libjpeg-devellibiconv-devel freetype-devel libpng-devel gd-devel curl-devel libxslt-develmysql-devel
  wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
  tar zxf libiconv-1.14.tar.gz
  cd libiconv-1.14
  ./configure--prefix=/usr/local/libiconv
  make
  makeinstall
  #添加epel源
  #https://fedoraproject.org/wiki/EPEL
  #上面这个位置找到对应的系统版本进入
  #centos 6 x86_64 https://dl.fedoraproject.org/pub/epel/6/x86_64/
  #https://dl.fedoraproject.org/pub/epel/   通过这个页面下载对应的epel yum源安装包
  wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
  yuminstall libmcrypt-devel mhash mcrypt
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
  安装php
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
  tar xf php-5.6.22.tar.gz
  cd php-5.6.22
  ./configure \
  --prefix=/application/php-5.6.22 \
  --with-mysql \
  --with-mysqli=mysqlnd\
  --with-pdo-mysql=mysqlnd\
  --with-iconv-dir=/usr/local/libiconv \
  --with-freetype-dir \
  --with-jpeg-dir \
  --with-png-dir \
  --with-zlib \
  --with-libxml-dir=/usr \
  --with-gettext \
  --enable-xml \
  --disable-rpath \
  --enable-bcmath \
  --enable-shmop \
  --enable-sysvsem \
  --enable-inline-optimization\
  --with-curl \
  --enable-mbregex \
  --enable-fpm \
  --enable-mbstring\
  --with-mcrypt \
  --with-gd \
  --enable-gd-native-ttf\
  --with-openssl \
  --with-mhash \
  --enable-pcntl \
  --enable-sockets \
  --with-xmlrpc \
  --enable-soap \
  --enable-short-tags \
  --enable-static \
  --with-xsl \
  --with-fpm-user=nginx\
  --with-fpm-group=nginx\
  --enable-ftp \
  --enable-opcache=no
  make
  makeinstall
  ln -s /application/php-5.6.22/ /application/php
  # pwd
  /root/php-5.6.22
  # cp php.ini-production /application/php/lib/php.ini
  # cd/application/php/etc/
  # ls
  pear.confphp-fpm.conf.default
  # pwd
  /application/php/etc
  # cp php-fpm.conf.default php-fpm.conf
  # /application/php/sbin/php-fpm
  # netstat -lntup|grep php-fpm
  tcp      0      0127.0.0.1:9000            0.0.0.0:*                   LISTEN      3689/php-fpm
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
  安装zabbix
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
  tar zxvf zabbix-3.0.3.tar.gz
  cd zabbix-3.0.3
  groupadd zabbix
  useradd -g zabbixzabbix
  #安装依赖包,如果一次安装错误,就多试几次
  yuminstall net-snmp net-snmp-devel libssh2-develOpenIPMI-devel
  # ./configure--enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp--with-libcurl --with-libxml2 --with-openipmi --with-ssh2
  make
  makeinstall
  # egrep -v "#|^$" /usr/local/etc/zabbix_server.conf
  LogFile=/tmp/zabbix_server.log
  DBHost=192.168.11.5
  DBName=zabbix
  DBUser=zabbix
  DBPassword=zabbix
  ListenIP=0.0.0.0
  Timeout=4
  AlertScriptsPath=${datadir}/zabbix/alertscripts
  LogSlowQueries=3000
  #拷贝启动脚本
  cp misc/init.d/fedora/core/zabbix_*/etc/rc.d/init.d/
  zabbix_server
  #修改配置文件
  vim /application/php/lib/php.ini
  max_execution_time= 300
  max_input_time = 300
  post_max_size =16M
  always_populate_raw_post_data= -1
  date.timezone = Asia/Shanghai
  #重启php
  # pkill -9 php-fpm
  # /application/php/sbin/php-fpm
  #从zabbix源码包拷贝网站到nginx
  # pwd
  /root/zabbix-3.0.3
  # cp -rf frontends/php /application/nginx/html/zabbix/
  #如果有防火墙,要么开放80端口,要么临时停止
  service iptablesstop
  #给目录设置权限
  chown -R nginx.nginx /application/nginx/html/
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
  基本上zabbix服务器算是安装差不多了
  这里准备配置mysql服务器了,需要在mysql服务器上授权,及初始化zabbix数据库
http://blog.51cto.com/e/u261/themes/default/images/spacer.gif
  #配置mysql服务器了。
  createdatabase zabbix characterset utf8 collate utf8_bin;

  grantallprivilegeson zabbix.*to zabbix@localhost>
  grantallprivilegeson zabbix.*to zabbix@'192.168.11.11'>  flush privileges;
  quit;
  #按照SQL语句顺序导入SQL:
  mysql -uzabbix -pzabbix zabbix
页: [1]
查看完整版本: zbbix安装 nginx+php+zabbix3.0