最新lnmp安装(nginx1.10,php7 ,mysql5.5)



//创建nginx  系统用户、用户组
groupadd  -r -g 108  nginx
useradd -r  -g 108   nginx


//安装常用的
 yum -y install gcc gcc-c++ autoconf automake libtool make cmake

cd    /usr/local/src/

//安装  nginx  需要的 
yum -y install zlib zlib-devel openssl openssl-devel pcre-devel

//下载 最新稳定版的nginx
wget   http://nginx.org/download/nginx-1.10.0.tar.gz

./configure  \
--prefix=/usr/local/nginx \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--pid-path=/var/run/nginx/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--user=nginx \
--group=nginx \
--with-http_stub_status_module \
--with-http_ssl_module \
--with-http_flv_module \
--with-http_gzip_static_module \
--http-client-body-temp-path=/var/tmp/nginx/client/ \
--http-proxy-temp-path=/var/tmp/nginx/proxy/ \
--http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ \
--http-uwsgi-temp-path=/var/tmp/nginx/uwsgi \
--http-scgi-temp-path=/var/tmp/nginx/scgi \
--with-pcre 

make && make install
/usr/sbin/nginx  //启动     
mkdir    /var/tmp/nginx/client -p      //再次启动

安装 php7  

先安装一些常用的库
 yum -y install libxslt-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel  gd  gd-devel
yum -y install     zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel 
yum -y install   ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel 
yum -y install   krb5 krb5-devel libidn libidn-devel openssl openssl-devel    //安装库

wget http://cn2.php.net/get/php-7.0.10.tar.gz/from/this/mirror  

./configure --prefix=/usr/local/php \
--with-gd \
--enable-gd-native-ttf \
--enable-gd-jis-conv \
--enable-mysqlnd \
 --with-curl \
 --with-freetype-dir \
 --with-gd \
 --with-gettext \
 --with-iconv-dir \
 --with-kerberos \
 --with-libdir=lib64 \
 --with-libxml-dir \
 --with-mysqli=mysqlnd \     ##mysql  可以后面安装
 --with-pdo-mysql=mysqlnd \
 --without-sqlite3 \      #  去掉sqlti3
 --without-pdo-sqlite \   #  去掉pdo-sqlite
 --with-openssl \
 --with-pcre-regex \
 --with-pear \
 --with-png-dir \
 --with-xmlrpc \
 --with-xsl \
 --with-zlib \
 --enable-fpm \
 --enable-bcmath \
 --enable-libxml \
 --enable-inline-optimization \
 --enable-gd-native-ttf \
 --enable-mbregex \
 --enable-mbstring \
 --enable-opcache \
 --enable-pcntl \
 --enable-shmop \
 --enable-soap \
 --enable-sockets \
 --enable-sysvsem \
 --enable-xml \
 --enable-zip \
 --disable-inline-optimization   ##这个     一直编译 zend_execute.lo 错误,     看了  ./configure --help    里面写了 如果这个编译错误 就带上这个选项
make  && make install

cp /usr/local/php/php-fpm.conf.default     /usr/local/phpphp-fpm.conf

cp  /usr/local/php/etc/php-fpm.d/www.conf.default  /usr/local/php/etc/php-fpm.d/www.conf

cp  /usr/local/src/php7**/php.ini-production      /usr/local/php/lib/php.ini



开启  opcache   

在php.ini  中 加入一行,

zend_extension=opcache.so

并开启 opcache 选项



/usr/local/php/sbin/php-fpm   //开启php

整合nginx 和php

vim    /etc/nginx/nginx.conf

   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/sbin/nginx  -s reload   

vim       /usr/local/nginx/html/phpinfo.php

ip********/phpinfo.php   //有表示整合成功







安装 mysql
我用的是 搜狐镜像,直接用它编译好的二进制包, 
http://mirrors.sohu.com/mysql/MySQL-5.5/

cd /usr/local/src
wget   http://mirrors.sohu.com/mysql/MySQL-5.5/mysql-5.5.50-linux2.6-x86_64.tar.gz

tar  zxvf  mysql-5.5.50-linux2.6-x86_64.tar.gz

mv     mysql-5.5.50-linux2.6-x86_64   /usr/local/mysql

看着这个文档 一步一步来

http://dev.mysql.com/doc/refman/5.5/en/binary-installation.html


shell> groupadd mysql
shell> useradd -r -g mysql -s /bin/false mysql
shell> cd /usr/local
shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> scripts/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql data
# Next command is optional
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> bin/mysqld_safe --user=mysql &
# Next command is optional
shell> cp support-files/mysql.server /etc/init.d/mysql.server

/usr/local/mysql/bin/mysql  
use  mysql
select  Host,User,Password from  user\G
> delete from user  where  Host !='localhost';
> DELETE FROM  user where  User !='root';
>update  user  set Password=password('maozhongyu')  where 1;
>flush privileges;




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值