准备工作,安装依赖库//检查并安装组件

yum -y install gcc automake autoconf libtool make gcc-c++ glibc libxslt-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel pcre pcre-devel libmcrypt libmcrypt-devel cmake

查看linux版本:

几点说明:

pcre、openssl、zlib是安装nginx时需要的

cmake是安装MySQL时需要的

二、编译安装nginx1、下载nginx(stable版本)

P指定下载文件目录

wget -P /tmp http://nginx.org/download/nginx-1.8.1.tar.gz

或者默认下载到当前目录下

[root@centos /]# cd /usr/local/src

[root@centos src]# wget http://nginx.org/download/nginx-1.8.1.tar.gz

2、解压nginx

[root@centos src]# tar xf nginx-1.8.1.tar.gz

[root@centos src]# cd nginx-1.8.1

[root@centos nginx-1.8.1]# ./configure --help(查看参数)3、编译nginx

./configure --prefix=/usr/local/nginx --sbin-path=/usr/sbin/nginx --user=www --group=www --with-http_ssl_module --with-http_gzip_static_modulemake && make install

//启动nginx

**第一种方式 指定--sbin-path=/usr/sbin/nginx**

nginx //启动

nginx -s stop// 停止

nginx -s reload // 重新加载

**第二种方式 不指定--sbin-path**

cd /usr/local/nginx

./sbin/nginx

重启nginx /usr/local/nginx/sbin/nginx -s reload

**第三种方式**

配置开机启动

首先写一个shell脚本,脚本名称:nginx

vi /etc/rc.d/init.d/nginx

#! /bin/bash

# chkconfig: 35 85 15

# description: Nginx is an HTTP(S) server, HTTP(S) reverse

set -e

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

DESC="nginx daemon"

NAME=nginx

DAEMON=/usr/local/nginx/sbin/$NAME (这里是nginx安装是 --sbin-path指定的路径)

SCRIPTNAME=/etc/init.d/$NAME

test -x $DAEMON || exit 0

d_start(){

$DAEMON || echo -n " already running"

}

d_stop() {

$DAEMON -s quit || echo -n " not running"

}

d_reload() {

$DAEMON -s reload || echo -n " counld not reload"

}

case "$1" in

start)

echo -n "Starting $DESC:$NAME"

d_start

echo "."

;;

stop)

echo -n "Stopping $DESC:$NAME"

d_stop

echo "."

;;

reload)

echo -n "Reloading $DESC configuration..."

d_reload

echo "reloaded."

;;

restart)

echo -n "Restarting $DESC: $NAME"

d_stop

sleep 2

d_start

echo "."

;;

*)

echo "Usage: $SCRIPTNAME {start|stop|restart|reload}" >&2

exit 3

;;

esac

exit 0

//将shell脚本放入到 /etc/rc.d/init.d/中,并执行下列命令

chmod +x /etc/rc.d/init.d/nginx (设置可执行权限)

chkconfig --add nginx (添加系统服务)

service nginx start

service nginx stop

service nginx restart

service nginx reload

浏览器访问:http://localhost如能出现nginx页面则表示成功

// 查看nginx进程

ps -ef | grep nginx

// 查看进程个数 去掉首位的

ps -ef | grep nginx | wc -l

// 查看80端口

netstat -anpt4、安装PHP

//php下载

cd /usr/local/src/

//如果下载文件的文件是mirror,直接解压mirror即可

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

tar zxvf php-5.6.13.tar.gz

cd php-5.6.13

首先查看安装帮助

# ./configure   --help

# ./configure --prefix=/usr/local/php \

--with-curl \

--with-freetype-dir \

--with-gd \

--with-gettext \

--with-iconv-dir \

--with-kerberos \

--with-libdir=lib64 \

--with-libxml-dir \

--with-mysqli \

--with-openssl \

--with-pcre-regex \

--with-pdo-mysql \

--with-pdo-sqlite \

--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

如果配置错误,需要安装需要的模块,直接yum一并安装依赖库

# yum -y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel MySQL pcre-devel

注意:安装php7beta3的时候有几处配置不过去,需要yum一下,现在php-7.0.2已经不用这样了。

# yum -y install curl-devel

# yum -y install libxslt-devel

编译安装

# make &&  make install

配置文件

# cp php.ini-development /usr/local/php/lib/php.ini

# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf

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

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

需要注意的是php7中www.conf这个配置文件配置phpfpm的端口号等信息,如果你修改默认的9000端口号需在这里改,再改nginx的配置

启动

#  /etc/init.d/php-fpm

查看phpinfo()

php7和php5性能分析比较

//time /usr/local/php5/bin/php search_by_key.php

$a=array();

for($i=0;$i<600000;$i++){

$a[$i] =$i;

}

foreach($aas$i)

{

array_key_exists($i,$a);

}

?>生成一个 60 万元素的数组,通过查找key 的方式,来确定key是否存在。

PHP 5.4.44 版

[root@localhost www5.4.44]# time /usr/local/php5.4.44/bin/php search_by_key.php

real    0m0.351s

user    0m0.300s

sys     0m0.050s

PHP 5.5.28 版

[root@localhost www]# time /usr/local/php/bin/php search_by_key.php

real    0m0.361s

user    0m0.304s

sys     0m0.057s

PHP 7.0.0 版

[root@localhost www7]# time /usr/local/php7/bin/php search_by_key.php

real    0m0.114s

user    0m0.097s

sys     0m0.017s

很明显php7的性能是php5的3倍!

linux 安装lnmp环境,centos下配置LNMP环境(源码安装)相关推荐

  1. centos下配置java环境,CentOS下配置Java环境变量的操作方法

    AJAX开发,小编有自己的一些心得体会,也请AJAXer多多指教-那接下来先附上这篇CentOS下配置Java环境变量的操作方法,与君共勉,一起学习. rhel 和 centos linux 使用yu ...

  2. linux部署3proxy源码,在CentOS 7系统中从源码安装RTPProxy的方法

    本文介绍在CentOS 7操作系统中从源码安装RTPProxy的方法,按照以下步骤操作即可成功. 在CentOS 7.x上安装RTPProxy 1.将目录更改为/usr/src: [root@kama ...

  3. linux vnc服务重启,CentOS下配置VNCServer,重启服务仍然生效

    CentOS下配置VNC Server,重启服务,配置仍然生效的方法: 本文前提:系统已安装好gnome桌面,如果没有请执行下面的命令安装即可. yum groupinstall "Desk ...

  4. Linux 系统安装配置PHP服务(源码安装)

    简介: PHP(外文名:PHP: Hypertext Preprocessor,中文名:"超文本预处理器")是一种通用开源脚本语言.语法吸收了C语言.Java和Perl的特点,利于 ...

  5. Linux【学习心得】深入剖析软件的源码安装

    转自:http://www.imooc.com/wenda/detail/242044 学习了一段时间的Linux,相信大家都会遇到需要安装软件的情况,而新手(比如我)对于这个问题肯定是特别头疼.照着 ...

  6. Windows下strongswan-5.5.3源码安装

    Windows 下strongswan源码安装 网上没有一个完整版本的安装教程,只能看官方英文文档,折腾数周,成功编译.现附上安装历程供大家参考.有问题可以互相讨论. windows支持strongs ...

  7. Linux软件安装的几种方法 (三)—— 源码安装

    [摘要] Linux系统上安装软件的方法和在windows上安装软件是有很大不同的,有时候Linux上安装软件碰到各种依赖不满足,是极为头疼的事情,下面盘点一下Linux上安装软件的几种方法,笔者基本 ...

  8. drcom linux最新版,Ubuntu高于8.04版本的源码安装drcom

    Ubuntu高于8.04版本的源码安装drcom注意点,这里借用别个的,我的早安装好了,为了方便记忆,把别人的copy过来,方便找用源码安装drcom时候,make报错,9.10和10.04都此问题. ...

  9. mininet安装过程(ubantu、git、mininet源码安装)以及POX安装

    小白一只,由于毕设题目跟SDN有关,就开始踢软件定义网络的大门,当然第一步就是熟悉网络工具,从mininet开始.对于从没接触过mininet.Linux的人来说,安装过程还是挺艰难的,我在安装过程中 ...

最新文章

  1. python 源码安装教程_python安装步骤
  2. python把数据写入excel_Python读取和写入Excel文件(转)
  3. 浅析ThinkPHP缓存之快速缓存(F方法)和动态缓存(S方法)
  4. offSet().left 与position().left的区别
  5. 【渝粤题库】陕西师范大学164212 国际贸易实务 作业(专升本)
  6. MySQL水平分区代理Spock Proxy(一)
  7. [转]Nant daily build实践
  8. u盘 连接服务器系统软件,u盘服务器系统
  9. 搜狗加入鹅厂,将成为腾讯间接全资子公司!
  10. ArcEngine 相关-转载
  11. flutter环境配置详解及开发第一个项目
  12. Servlet的执行原理和生命周期
  13. HR:你为什么选择计算机这个行业?
  14. sketchup生成面域插件_什么插件这么神奇,SketchUp一秒搞定99%异形建模
  15. maccms重定向次数过多
  16. matlab的比较器模块,simulink中的比较器
  17. IIS部署,发布网站
  18. 盘点10款超好用的数据可视化工具
  19. STM8L低功耗设置,深坑。。。
  20. vue 深度监听watch(如何watch监听一个对象内部的变化)

热门文章

  1. hdl四位二进制计数器_利用Quartus设计4位同步二进制加法计数器
  2. Web tech resource
  3. 使用Redshift渲染器,怎么选电脑配置!
  4. Dubbo框架基本使用
  5. vivaldi浏览器的页内查询功能
  6. 深度学习一般工作流程
  7. dilate convolution
  8. 一文开启自然语言处理之旅
  9. LCD的poll和vcom的反馈调节
  10. Matlab车牌识别停车场车辆进出管理系统