• 编译LNMP环境


    cd /usr/local/src
    wget http://nginx.org/download/nginx-1.10.2.tar.gz

    2、解压

    cd /usr/local/src
    tar zxvf nginx-1.10.2.tar.gz

    3、配置

    cd /usr/local/src/nginx-1.10.2
    #./configure --prefix=/usr/local/nginx

    如果提示缺少某个类库,则使用yum的方式安装该类库

    4、执行编译

    make && make install

    5、启动nginx
    如果配置成功,则在/usr/local生成一个nginx目录

    cd /usr/local/nginx
    ./sbin/nginx

    如果启动失败,查找原因,一般原因有:80端口被占用,则需要关闭占用80端口的进程,还有就是防火墙的原因

    关闭防火墙:

    service iptables stop
    • 编译PHP
      1、安装必要的软件包:
    yum install gd zlib zlib-devel openssl openssl-devel libxml2 libxml2-devel libjpeg libjpeg-devel libpng
    libpng-devel

    2、下载PHP,这里下载PHP5.6.30来进行编译安装

    cd /usr/local/src
    wget http://am1.php.net/get/php-5.6.30.tar.bz2/from/this/mirror

    3、解压

    tar xzvf php-5.6.30.tar.bz2

    4、配置

    cd /usr/local/src/php-5.6.30
    
    ./configure --prefix=/usr/local/php 
    --with-gd 
    --enable-gd-native-ttf 
    --enable-gd-jis-conv 
    --enable-mysqlnd 
    --with-mysql=mysqlnd 
    --with-pdo-mysql=mysqlnd 
    --with-openssl 
    --enable-mbstring 
    --enable-fpm

    如果下载的是PHP7,则这样配置:

    ./configure --prefix=/usr/local/php 
    --with-gd 
    --enable-gd-native-ttf 
    --enable-gd-jis-conv 
    --enable-mysqlnd 
    --with-pdo-mysql=mysqlnd 
    --with-openssl 
    --enable-mbstring 
    --enable-fpm

    5、执行编译

    make && make install

    6、启动PHP进程

    cd /usr/local/php
    cp etc/php-fpm.conf.default etc/php-fpm.conf
    cp /usr/local/src/php-5.5.13/php.ini-development ./lib/php.ini
    ./sbin/php-fpm
    • 整合PHP和Nginx
      如果是和 apache 配合,PHP一般是作为 apache 的模块来使用,但是Nginx的话,PHP和Nginx是两个不同的进程,需要进行相应的配置
    cd /usr/local/nginx
    vim conf/nginx.conf

    修改如下配置:

    这里写图片描述

    让 nginx 的最新配置文件生效

    ./sbin/nginx -s reload
    • 二进制方式MySQL
      不能说是编译MySQL,应该说是以二进制包的形式来安装MySQL

    1、安装依赖库

    yum install -y gcc gcc-c++ kernel-devel ntp vim-enhanced flex bison autoconf make automake bzip2-devel ncurses-devel zlib-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel libXpm-devel gettext-devel  pam-devel libtool libtool-ltdl openssl openssl-devel fontconfig-devel libxml2-devel curl-devel  libicu libicu-devel libmcrypt libmcrypt-devel libmhash libmhash-devel pcre-devel libtool-libs gd file patch mlocate diffutils readline-devel glibc-devel glib2-devel libcap-devel
    
    yum install -y libaio

    2、下载

    cd /usr/local/src
    wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.49-linux2.6-x86_64.tar.gz

    3、解压

    tar xzvf mysql-5.5.49-linux2.6-x86_64.tar.gz

    4、配置

    mkdir /usr/local/mysql
    cd /usr/local/src
    mv ./mysql-5.5.49-linux2.6-x86_64/* /usr/local/mysql
    cd /usr/local/mysql
    
    groupadd mysql
    useradd -g mysql mysql
    chown -R mysql .
    chgrp -R mysql .
    ./script/mysql_install_db --user=mysql
    
    chown -R root .
    chown -R mysql data
    ./bin/mysqld_safe --user=mysql&

    5、启动

    ./bin/mysql -uroot -p
  • 相关阅读:
    ReactNative 打包 APK
    ReactNative常用命令
    ReactNative之坑:停在gradle一直出点
    Python搭建Web服务器,与Ajax交互,接收处理Get和Post请求的简易结构
    tensorflow 安装升级
    sqlserver 全库查询 带架构
    气象数据资料整理
    poj2841
    cf1430e
    cf1436d
  • 原文地址:https://www.cnblogs.com/cnsec/p/13407034.html
Copyright © 2020-2023  润新知