1. 程式人生 > >記一次“愉快”的lnmp環境的搭建

記一次“愉快”的lnmp環境的搭建

系統 nts unix open align maintain com curses .cn

愉快的lnmp環境搭建

  • 後續更新
  • 幾個筆記記錄
    yum remove php-mysql
    
    yum -y install cmake autoconf wget gcc-c++ gcc zlib pcre pcre-devel 
    yum -y install bison bison-devel perl vim libjpeg libjpeg-devel libpng libpng-devel
    yum -y install freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel
    yum -y install bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel
    yum -y install openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers make gd gd2 gd-devel gd2-devel
    yum -y libaio mlocate lsof epel-release libmcrypt libmcrypt-devel mhash libiconv mcrypt libzip openssl openssl-devel mysqlnd

    yum -y update

    wget http://nginx.org/download/nginx-1.9.9.tar.gz

    ./configure \
    --user=www \
    --group=www \
    --prefix=/workspace/app/nginx \
    --with-pcre \
    --with-http_stub_status_module \
    --with-http_ssl_module \
    --with-http_realip_module \
    --with-http_image_filter_module

    wget -c https://downloads.mysql.com/archives/get/file/mysql-5.6.25.tar.gz

    cmake \
    -DCMAKE_INSTALL_PREFIX=/workspace/app/mysql \
    -DMYSQL_DATADIR=/workspace/data/mysql \
    -DSYSCONFDIR=/etc \
    -DWITH_MYISAM_STORAGE_ENGINE=1 \
    -DWITH_INNOBASE_STORAGE_ENGINE=1 \
    -DMYSQL_UNIX_ADDR=/tmp/mysqld.sock \
    -DMYSQL_TCP_PORT=3306 \
    -DENABLED_LOCAL_INFILE=1 \
    -DWITH_PARTITION_STORAGE_ENGINE=1 \
    -DEXTRA_CHARSETS=all \
    -DDEFAULT_CHARSET=utf8mb4 \
    -DDEFAULT_COLLATION=utf8mb4_unicode_ci

    ./scripts/mysql_install_db --user=mysql --datadir=/workspace/data/mysql

    cp support-files/my-default.cnf /etc/my.cnf

    wget https://www.php.net/distributions/php-7.1.27.tar.gz

    ./configure \
    --prefix=/workspace/app/php/php71 \
    --with-config-file-path=/workspace/config/php/php71/etc \
    --with-mysqli=/workspace/app/mysql/bin/mysql_config \
    --with-mysqli=mysqlnd \
    --with-pdo-mysql=mysqlnd \
    --with-iconv \
    --with-freetype-dir \
    --with-jpeg-dir \
    --with-png-dir \
    --with-zlib \
    --with-libxml-dir \
    --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-zip \
    --with-bz2 \
    --enable-soap \
    --enable-opcache \
    --with-pdo-mysql \
    --enable-maintainer-zts \
    --enable-pcntl \
    --enable-shmop \
    --enable-sysvmsg \
    --enable-sysvsem \
    --enable-sysvshm \
    --without-pear \
    --with-gettext \
    --enable-fpm \
    --enable-opcache=no

    # 配置nginx支持php
    fastcgi_param SCRIPT_FILENAME $document_root$fasrcgi_script_name
    #設置環境變量
    PATH=$PATH:$HOME/bin:/workspace/app/mysql/bin:/workspace/app/mysql/lib
    
    #制作成服務啟動
    cp support-files/mysql.server /etc/init.d/mysql
    #相關命令:
        service mysql start  
        #停止mysql服務  
        service mysql stop  
        #重啟mysql服務  
        service mysql restart
    #添加到開機啟動項 chkconfig --add mysql
    #下面是為了php-fpm隨系統自啟動。
    cp ./sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm

    未完。。待續。。

記一次“愉快”的lnmp環境的搭建