CentOS 7.0下编译安装LNMP

LNMP(Linux-Nginx-MySQL-PHP),本文在CentOS 7.0上编译LNMP尝尝鲜,全文基本上都是采用手动编译部署,依赖yum帮我安装了GCC和automake。写这个东西耗时有点久了。太花时间啦。

--------------------------------------分割线 --------------------------------------

Ubuntu 14.04 LTS 安装 LNMP Nginx\PHP5 (PHP-FPM)\MySQL

Ubuntu 13.04 安装 LAMP\Vsftpd\Webmin\phpMyAdmin 服务及设置

CentOS 6.4 下的LNMP 生产环境搭建及安装脚本

生产环境实用之LNMP架构的编译安装+SSL加密实现

LNMP 全功能编译安装 for CentOS 6.3笔记

CentOS 6.3 安装LNMP (PHP 5.4,MyySQL5.6)

在部署LNMP的时候遇到Nginx启动失败的2个问题

Ubuntu安装Nginx php5-fpm MySQL(LNMP环境搭建)

--------------------------------------分割线 --------------------------------------

主要软件版本:
nginx-1.6.0
php-5.3.5
mysql-5.5.6
  yum源配置(其实没什么改动)
[root@iPython ~]# cat /etc/yum.repos.d/1.repo
[1]
name=1
baseurl=file:///media
enabled=1
gpgcheck=0

[root@ipython ~]# mount /dev/cdrom /media && yum clean all
mount: /dev/sr0 is write-protected, mounting read-only
Loaded plugins: fastestmirror
Cleaning repos: 1
Cleaning up everything
  编译工具安装
[root@ipython ~]# yum install gcc-c++ automake autoconf bzip2
  zlib库(提供数据压缩用的函式库):
[root@ipython lnmp]# tar zxf zlib-1.2.8.tar.gz
[root@ipython lnmp]# cd zlib-1.2.8
[root@ipython zlib-1.2.8]# ./configure --prefix=/software/sharelib
[root@ipython zlib-1.2.8]# make && make install
  pcre库(rewrite的支持)
[root@ipython lnmp]# tar zxf pcre-8.35.tar.gz
[root@ipython lnmp]# cd pcre-8.35
[root@ipython pcre-8.35]# ./configure --prefix=/software/pcre --enable-utf8 --enable-unicode-properties
[root@ipython pcre-8.35]# make && make install
  OpenSSL库(https的支持)
[root@ipython lnmp]# tar zxf openssl-1.0.1h.tar.gz
[root@ipython lnmp]# cd openssl-1.0.1h
[root@ipython openssl-1.0.1h]# ./config --prefix=/software/openssl
[root@ipython openssl-1.0.1h]# make && make install
  TCMalloc工具(google内存管理套件)
[root@ipython lnmp]# tar zxf libunwind-1.1.tar.gz
[root@ipython lnmp]# cd libunwind-1.1
[root@ipython libunwind-1.1]# CFLAGS=-fPIC ./configure --prefix=/software/google-libunwind
[root@ipython libunwind-1.1]# make CFLAGS=-fPIC && make CFLAGS=-fPIC install

[root@ipython lnmp]# tar zxf gperftools-2.2.tar.gz
[root@ipython lnmp]# cd gperftools-2.2
[root@ipython gperftools-2.2]# LDFLAGS="-L/software/google-libunwind/lib" CPPFLAGS="-I/software/google-libunwind/include" ./configure --prefix=/software/google-perftools
[root@ipython gperftools-2.2]# make && make install

###路径加到动态链接库###
[root@ipython gperftools-2.2]# echo "/software/google-libunwind/lib/" >> /etc/ld.so.conf
[root@ipython gperftools-2.2]# echo "/software/google-perftools/lib/" >> /etc/ld.so.conf
[root@ipython gperftools-2.2]# echo "/software/sharelib/lib/" >> /etc/ld.so.conf && ldconfig
  Nginx(不解释)
[root@ipython lnmp]# groupadd -g 1500 nginx
[root@ipython lnmp]# useradd -M -u 1500 -g nginx -s /sbin/nologin nginx
[root@ipython lnmp]# mkdir /var/tmp/nginx
[root@ipython lnmp]# chown nginx:nginx /var/tmp/nginx/
[root@ipython lnmp]# tar zxf nginx-1.6.0.tar.gz
[root@ipython lnmp]# cd nginx-1.6.0
[root@ipython nginx-1.6.0]# sed -i 's/CFLAGS="$CFLAGS -g"/#CFLAGS="$CFLAGS -g"/' auto/cc/gcc
[root@ipython nginx-1.6.0]# sed -i "s#/usr/local#/software/google-perftools#" auto/lib/google-perftools/conf
##配置参数有点长##
[root@ipython nginx-1.6.0]# ./configure --prefix=/software/nginx --user=nginx --group=nginx --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module --with-http_gzip_static_module --with-debug --http-client-body-temp-path=/var/tmp/nginx/client --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --http-scgi-temp-path=/var/tmp/nginx/scgi --with-pcre=/root/lnmp/pcre-8.35 --with-openssl=/root/lnmp/openssl-1.0.1h --with-zlib=/root/lnmp/zlib-1.2.8 --with-google_perftools_module
[root@ipython nginx-1.6.0]# make && make install

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/2a35fb8a6d5b771cb4a4d534b3bdafc6.html