• LNMP安装流程


    1、系统环境

    [root@testserver src]# cat /etc/issue
    CentOS release 6.7 (Final)
    Kernel 
     on an m
    [root@testserver src]# uname -a
    Linux testserver 2.6.32-573.el6.x86_64 #1 SMP Thu Jul 23 15:44:03 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
    

    2、软件包准备

    mysql 、php、 apache、 nginx 安装包事先要下载到/usr/local/src目录下,如名字不对需要更改脚本里的软件包名称;
    httpd-2.4.18.tar.gz 、mysql-5.6.25.tar.gz 、nginx-1.6.2.tar.gz、 php-5.6.10.tar.gz
    

    3、install dependencies packages

    yum install wget gcc gcc-c++ make re2c curl curl-devel libxml2 libxml2-devel libjpeg libjpeg-devel libpng libpng-devel libmcrypt libmcrypt-devel zlib zlib-devel openssl openssl-devel freetype freetype-devel gd gd-devel perl perl-devel ncurses ncurses-devel bison bison-devel libtool gettext gettext-devel cmake bzip2 bzip2-devel pcre pcre-devel -y
    

    4、安装mysql

    cd /usr/local/src
    tar -zxf mysql-5.6.25.tar.gz
    cd mysql-5.6.25
    cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DSYSCONFDIR=/etc -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
    
    make && make install
    
    useradd -M -s /sbin/nologin mysql
    mkdir -p /data/mysql
    chown -R mysql:mysql /data/mysql/
    chown -R mysql:mysql /usr/local/mysql/
    
    cd /usr/local/mysql/scripts/
    ./mysql_install_db --basedir=/usr/local/mysql/ --datadir=/data/mysql/ --user=mysql
    
    /bin/cp /usr/local/mysql/my.cnf /etc/my.cnf
    sed -i '/^[mysqld]$/auser = mysql
    datadir = /data/mysql
    default_storage_engine = InnoDB
    ' /etc/my.cnf
    
    cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
    sed -i 's#^datadir=#datadir=/data/mysql#' /etc/init.d/mysqld
    sed -i 's#^basedir=#basedir=/usr/local/mysql#' /etc/init.d/mysqld
    service mysqld start
    chkconfig --add mysqld
    chkconfig mysqld on
    
    iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
    /etc/init.d/iptables save
    
    echo "export PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
    source /etc/profile
    

    5、安装php5.6.10

    useradd -s /sbin/nologin php-fpm
    cd /usr/local/src
    tar zxf php-5.6.10.tar.gz
    cd php-5.6.10
    ./configure --prefix=/usr/local/php-fpm --with-config-file-path=/usr/local/php-fpm/etc --enable-fpm --with-fpm-user=php-fpm --with-fpm-group=php-fpm --with-mysql=mysqlnd --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-ftp --enable-exif --disable-ipv6 --with-pear --with-curl --enable-bcmath --enable-mbstring --enable-sockets --with-gettext
    
    make && make install
    

    ./configure出现的问题及解决方案:

    报错内容:configure: error: mcrypt.h not found. Please reinstall libmcrypt
    网上搜索了很多,包括自带的 yum install libmcrypt libmcrypt-devel,这个是没有效果的。

    wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/attic/libmcrypt/libmcrypt-2.5.7.tar.gz   
    tar -zxf libmcrypt-2.5.7.tar.gz         
    cd libmcrypt-2.5.7        
    ./configure        
    make && make install
    /sbin/ldconfig
    cd libltdl/
    ./configure --enable-ltdl-install
    make && make install
    cd ../../
    然后再重新编译php
    
    cp /usr/local/src/php-5.6.10/php.ini-production /usr/local/php-fpm/etc/php.ini
    sed -i 's#^;date.timezone =#date.timezone=Asia/Shanghai#' /usr/local/php-fpm/etc/php.ini
    cd /usr/local/php-fpm/etc/
    mv php-fpm.conf.default php-fpm.conf
    
    cp /usr/local/src/php-5.6.10/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
    chmod 755 /etc/init.d/php-fpm
    chkconfig --add php-fpm
    chkconfig php-fpm on
    service php-fpm start
    
    PHP7.0 安装参考:http://blog.csdn.net/21aspnet/article/details/47708763
    
    

    6、安装nginx

    cd /usr/local/src
    tar zxf nginx-1.6.2.tar.gz
    cd nginx-1.6.2
    ./configure --prefix=/usr/local/nginx --with-pcre --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module
    
    make && make install
    
    /usr/local/nginx/sbin/nginx
    

    7、设置

    sed -i '56alocation ~ .php$ {
     root html;
     fastcgi_pass 127.0.0.1:9000;
     fastcgi_index index.php;
     fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;
     include fastcgi_params;
    }
    ' /usr/local/nginx/conf/nginx.conf
    /usr/local/nginx/sbin/nginx -s reload
    
    echo -e '<?php
     echo "nginx and PHP is OK";
    ?>
    ' >/usr/local/nginx/html/index.php
    curl localhost/index.php
    
  • 相关阅读:
    Oracle Instant Client 配置
    释放至强平台 AI 加速潜能 汇医慧影打造全周期 AI 医学影像解决方案
    Analytics Zoo Cluster Serving自动扩展分布式推理
    基于时序数据,推动智能运维发展
    助力用户选择更优模型和架构,推动 AI机器视觉落地智能制造
    英特尔与 Facebook 合作采用第三代英特尔® 至强® 可扩展处理器和支持 BFloat16 加速的英特尔® 深度学习加速技术,提高 PyTorch 性能
    如何无缝地将人工智能扩展到分布式大数据
    Burger King使用RayOnSpark进行基于实时情景特征的快餐食品推荐
    如何往Spark社区做贡献,贡献代码
    开源:从社区到商业化
  • 原文地址:https://www.cnblogs.com/migongci0412/p/5130739.html
Copyright © 2020-2023  润新知