zoukankan      html  css  js  c++  java
  • centos_6下源码编译安装zabbix之一 LNMP环境的搭建

         今晚心血来潮,来加加班,想起还有一个博客,索性来写写,步骤会比较清楚,毕竟我有轻微强迫症... 声明下,用的是centos6 的系统环境,默认root权限,部署过程中iptables关闭,之后根据需求配置策略,selinux也是默认关闭的,

       关闭iptables : /etc/init.d/iptables stop,  先暂时关闭selinux:setenforce 0

    首先是Lnmp环境,毕竟zabbix_server需要php和数据库支持,先放软件包的下载地址,全部可以通过wget 进行下载

    php       http://cn2.php.net/distributions/php-5.6.32.tar.gz

    mysql   https://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.38.tar.gz

    nginx    http://nginx.org/download/nginx-1.10.3.tar.gz

      软件下载完先解压,tar zxf  php-5.6.32.tar.gz  、   tar zxf  mysql-5.6.38.tar.gz  、  tar zxf  nginx-1.10.3.tar.gz   、

      然后yum一波依赖,我一般用得aliyun的yum,下面三行代码看需求,线上环境的话具体对待,

        mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak 

        wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

        yum clean all && yum makecache

      开始yum,

            yum -y install  automake autoconf cmake gcc gcc-c++ openssl openssl-devel pcre pcre-devel  libaio  libaio-devel ncurses ncurses-devel net-snmp-devel  libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libpng libpng-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel curl curl-devel gdbm-devel db4-devel  libXpm-devel libX11-devel gd-devel

    先nginx吧:

    groupadd nginx

    useradd nginx -g nginx -M -s /sbin/nologin

    cd nginx-1.10.3/

    ./configure  --prefix=/usr/local/nginx --with-http_ssl_module --with-http_stub_status_module --with-pcre --user=nginx --group=nginx

    make && make install

    然后是mysql:    [PS:mysql是默认安装位位置/usr/localmysql,数据的存贮位置为  /data/mysql]

    groupadd mysql

    useradd mysql -g mysql -M -s /sbin/nologin

    mkdir -p /data/mysql

    chown -R mysql.mysql /data/mysql

    cd mysql-5.6.38/

    cmake
    -DCMAKE_INSTALL_PREFIX=/usr/local/mysql
    -DDEFAULT_CHARSET=utf8
    -DDEFAULT_COLLATION=utf8_general_ci
    -DWITH_INNOBASE_STORAGE_engine=1
    -DWITH_ARCHIVE_STORAGE_ENGINE=1
    -DWITH_BLACKHOLE_STORAGE_ENGINE=1
    -DMYSQL_DATADIR=/data/mysql
    -DMYSQL_TCP_PORT=3306
    -DENABLE_DOWNLOADS=1

    make && make install

    cp /usr/local/mysql/support-files/mysql.server /etc/inint.d/mysql

    chmod 755 /etc/init.d/mysql

    初始化数据库先:

    /usr/local/mysql/scripts/mysql_install_db  --user=mysql --datadir=/data/mysql

    cp /usr/local/mysql/my.cnf     /etc/my.cnf 

    然后修改 /etc/my.cnf 中的

      basedir = /usr/local/mysql

      datadir  =  /data/mysql 

      user = mysql

    修改完保存退出

    /etc/init.d/mysql start

    如果不出意外,mysql就正常启动了

    最后是php。

    cd php-5.6.32/

    ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-bz2 --with-curl --enable-sockets
    --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --enable-gd-native-ttf --with-iconv-dir --enable-mbstring
    --enable-calendar --with-gettext --with-libxml-dir --with-zlib --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-
    mysql=mysqlnd --enable-dom --enable-xml --enable-fpm --with-libdir=lib64 --enable-bcmath

    make && make install

    配置php:

    cp php.ini-production  /usr/local/php/etc/php.ini

    mv /usr/local/php/etc/php-fpm.conf.default  /usr/local/php/etc/php-fpm.conf

    cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm  

    chmod 755  /etc/init.d/php-fpm  

    修改nginx支持php,把下面7行代码加入nginx的配置文件的,server段里面 ,然后保存退出。

    location ~ .php$ {
      root html;
      fastcgi_pass 127.0.0.1:9000;
      fastcgi_index index.php;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      include fastcgi_params;
    }

    启动服务:

    /usr/local/nginx/sbin/nginx

    /etc/init.d/pfp-fpm start

    放置php探针 :

    echo -e  "<?php phpinfo();" > /usr/local/nginx/html/info.php

    curl 127.0.0.1/info.php |grep php-fpm  

    如果有类似于 <td class="e">php-fpm </td>  这样的输出,证明已经支持了。

    lnmp环境就已经搭好了 

    落花影斑驳,当时明月曾照我
  • 相关阅读:
    Linux mii-tool 命令
    MySQL 主从复制
    MySQL 备份与恢复
    SOAP 版本可能不匹配: 出现意外的 Envelope 命名空间 http://schemas.xmlsoap.org/wsdl/
    网管邮件配置
    ORA-10873
    Exception in thread "main" java.lang.UnsatisfiedLinkError:
    安装 ORACLE 11G出现Error Message:PRVF-7535
    mount /dev/sr0 /media/cdrom you must specify the filesystem type
    NBU 还原windows ORACLE数据库(BW)
  • 原文地址:https://www.cnblogs.com/maigc846476619/p/8075854.html
Copyright © 2011-2022 走看看