上帝大脸 发表于 2018-1-1 08:21:27

lnmp源码编译安装zabbix

软件安装
Mysql
安装
  tar xf mysql-5.7.13-1.el6.x86_64.rpm-bundle.tar -C mysql
  rpm -e --nodepsmysql-libs-5.1.73-7.el6.x86_64
  rpm -vih mysql-community-*
  service mysqld start
初始化root
  grep 'temporary password' /var/log/mysqld.log
  2017-05-05T11:50:26.980187Z 1 A temporary password is generated for root@localhost: rVVAzI+Qw7.A
  mysql -uroot -p'rVVAzI+Qw7.A'

  mysql>>  mysql> \q
  service mysqld restart
PHP
依赖包
devel
  yum -y install gcc* libxslt-devel libicu-devel zlib-devel bzip2-develpcre-devel openssl-devel libxml2-devel mhash-devel gmp-devel libcurl-devel gd-devel libpng-devel libXpm-devel freetype-devel enchant-devel openjpeg-devel opencryptoki-devel libedit-devel readline-devel recode-devel net-snmp-devel unixODBC-devel aspell-devel
libwebp
  tar xzf libwebp-0.6.0.tar.gz
  cd libwebp-0.6.0
  ./configure --prefix=/usr/
  make
  make install
libmcrypt
  tar xzf libmcrypt-2.5.8.tar.gz
  cd libmcrypt-2.5.8
  ./configure --prefix=/usr/
  make
  make install
libgd
  tar xzf libgd-2.2.4.tar.gz
  cd libgd-2.2.4
  ./configure --prefix=/usr/
  vimsrc/gd_gd2.c
  make
  make install
PEAR
  tar xzf PEAR-1.10.4.tgz
安装
  ./configure --prefix=/usr/local/php --with-mysqli=/usr/bin/mysql_config --enable-fpm --enable-bcmath--with-bz2=/usr/ --enable-intl --enable-mbstring --enable-soap--enable-sysvmsg --enable-sysvsem       --enable-calendar --with-curl=/usr/ --enable-exif--enable-ftp--with-gettext=/usr/ --with-gmp=/usr/ --with-iconv-dir=/usr/ --with-mhash=/usr/ --with-mysql-sock=/var/lib/mysql/mysql.sock --with-pcre-dir=/usr/ --enable-shmop--enable-sockets--enable-wddx--with-xsl=/usr/ --enable-zip --with-zlib-dir=/usr --with-unixODBC=/usr --with-enchant=/usr --with-gd=/usr --with-webp-dir=/usr --with-jpeg-dir=/usr --with-png-dir=/usr --with-xpm-dir=/usr --with-freetype-dir=/usr --with-mcrypt=/usr --with-pspell=/usr --with-libedit=/usr --with-readline=/usr --with-recode=/usr --with-snmp=/usr --enable-sysvshm --with-pear=../PEAR-1.10.4
  make
  make test
  make install
  cp /usr/local/src/php-7.1.4/php.ini-production /usr/local/php/etc/php.ini
  cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
  cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
  /usr/local/php/sbin/php-fpm -c /usr/local/php/etc/php.ini
JAVA
  tar xzf jdk-7u79-linux-x64.gz -C /usr/local/
  vim /etc/profile.d/jdk.sh
  export JAVA_HOME=/usr/local/jdk1.7.0_79

  export>  export PATH=$JAVA_HOME/bin:$PATH
  source /etc/profile.d/jdk.sh
zabbix
  tar xzf zabbix-3.2.5.tar.gz
  cd zabbix-3.2.5
  yum -y install openldap-devel
  ./configure --prefix=/usr/local/zabbix --enable-server --enable-proxy --enable-agent --enable-java --with-mysql --with-libxml2 --with-unixodbc --with-net-snmp --with-openssl --with-libcurl --with-ldap
  make && make install
  groupadd zabbix
  useradd -M -g zabbix -s /sbin/nologin zabbix
NGINX
  tar xzf tengine-1.5.2.tar.gz
  tar xf jemalloc-3.6.0.tar.bz2
  cd tengine-1.5.2
  ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_realip_module --with-http_addition_module --with-http_xslt_module --with-http_image_filter_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_gzip_static_module --with-pcre --with-jemalloc=../jemalloc-3.6.0
  make && make install
  groupadd nginx
  useradd -g nginx -M -s /sbin/nologin nginx
部署配置
NGINX
  vim /usr/local/nginx/conf/nginx.conf
  usernginx;
  worker_processes8;
  events {
  worker_connections10240;
  }
  http {
  include       mime.types;
  default_typeapplication/octet-stream;
  log_formatmain'$remote_addr - $remote_user [$time_local] "$request" '
  '$status $body_bytes_sent "$http_referer" '
  '"$http_user_agent" "$http_x_forwarded_for"';
  access_loglogs/access.logmain;
  sendfile      on;
  keepalive_timeout65;
  server {
  listen       80;
  server_namelocalhost;
  access_loglogs/host.access.logmain;
  location / {
  root   zabbix;
  indexindex.html index.htm index.php;
  }
  error_page   500 502 503 504/50x.html;
  location = /50x.html {
  root   html;
  }
  location ~ \.php$ {
  root         zabbix;
  fastcgi_pass   127.0.0.1:9000;
  fastcgi_indexindex.php;
  fastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_script_name;
  include      fastcgi_params;
  }
  }
  /usr/local/nginx/sbin/nginx
MYSQL
创建zabbix数据库
  mysql -uroot -p'LiMuGen@uce.com56.&'
  mysql> create database zabbix character set utf8 collate utf8_bin;

  mysql> grant all privileges on zabbix.* to zabbix@localhost>  mysql> flush privileges;
  mysql> \q
导入zabbix数据
  cd /usr/local/src/zabbix-3.2.5/database/mysql
  mysql -uzabbix -p zabbix <schema.sql
  mysql -uzabbix -p zabbix <images.sql
  mysql -uzabbix -p zabbix <data.sql
PHP
  vim /usr/local/php/etc/php.ini
  post_max_size = 16M
  max_execution_time = 300
  max_input_time = 300
  date.timezone = Asia/ShangHai
ZABBIX
Web访问文件准备
  cp -r /usr/local/src/zabbix-3.2.5/frontends/php/ /usr/local/nginx/
  mv /usr/local/nginx/php/ /usr/local/nginx/zabbix
zabbix服务配置修改
  vim /usr/local/zabbix/etc/zabbix_server.conf
  DBName=zabbix
  DBUser=zabbix
  DBPassword=Zabbix@UC56.com(..)
PHP7报错修正
  cp /usr/local/nginx/zabbix/include/func.inc.php /usr/local/nginx/zabbix/include/func.inc.php-bk20170505
  sed -i '/$last = strtolower(substr($val, -1));/a$val = substr($val,0,-1);' /usr/local/nginx/zabbix/include/func.inc.php
页: [1]
查看完整版本: lnmp源码编译安装zabbix