CentOS7 编译安装LNMP

LNMP(Linux-Nginx-Mysql-PHP),本文在CentOS7.0上编译LNMP尝尝鲜,全文基本上都是采用手动编译部署…依赖yum帮我安装了GCC和automake..写这个东西耗时有点久了…尼玛 太花时间啦,Linux运维交流群:344177552

主要软件版本:

nginx-1.6.0php-5.3.5mysql-5.5.6

yum源配置(其实没什么改动)

[root@ipython~]#cat/etc/yum.repos.d/1.repo[1]name=1baseurl=file:///mediaenabled=1gpgcheck=0[root@ipython~]#mount/dev/cdrom/media&&yumcleanallmount:/dev/sr0iswrite-protected,mountingread-onlyLoadedplugins:fastestmirrorCleaningrepos:1Cleaningupeverything

编译工具安装

[root@ipython~]#yuminstallgcc-c++automakeautoconfbzip2

zlib库(提供数据压缩用的函式库):

[root@ipythonlnmp]#tarzxfzlib-1.2.8.tar.gz[root@ipythonlnmp]#cdzlib-1.2.8[root@ipythonzlib-1.2.8]#./configure–prefix=/software/sharelib[root@ipythonzlib-1.2.8]#make&&makeinstall

pcre库(rewrite的支持)

[root@ipythonlnmp]#tarzxfpcre-8.35.tar.gz[root@ipythonlnmp]#cdpcre-8.35[root@ipythonpcre-8.35]#./configure–prefix=/software/pcre–enable-utf8–enable-unicode-properties[root@ipythonpcre-8.35]#make&&makeinstall

OpenSSL库(https的支持)

[root@ipythonlnmp]#tarzxfopenssl-1.0.1h.tar.gz[root@ipythonlnmp]#cdopenssl-1.0.1h[root@ipythonopenssl-1.0.1h]#./config–prefix=/software/openssl[root@ipythonopenssl-1.0.1h]#make&&makeinstall

TCMalloc工具(google内存管理套件)

[root@ipythonlnmp]#tarzxflibunwind-1.1.tar.gz[root@ipythonlnmp]#cdlibunwind-1.1[root@ipythonlibunwind-1.1]#CFLAGS=-fPIC./configure–prefix=/software/google-libunwind[root@ipythonlibunwind-1.1]#makeCFLAGS=-fPIC&&makeCFLAGS=-fPICinstall[root@ipythonlnmp]#tarzxfgperftools-2.2.tar.gz[root@ipythonlnmp]#cdgperftools-2.2[root@ipythongperftools-2.2]#LDFLAGS=”-L/software/google-libunwind/lib”CPPFLAGS=”-I/software/google-libunwind/include”./configure–prefix=/software/google-perftools[root@ipythongperftools-2.2]#make&&makeinstall###路径加到动态链接库###[root@ipythongperftools-2.2]#echo”/software/google-libunwind/lib/”>>/etc/ld.so.conf[root@ipythongperftools-2.2]#echo”/software/google-perftools/lib/”>>/etc/ld.so.conf[root@ipythongperftools-2.2]#echo”/software/sharelib/lib/”>>/etc/ld.so.conf&&ldconfig

Nginx(不解释)

[root@ipythonlnmp]#groupadd-g1500nginx[root@ipythonlnmp]#useradd-M-u1500-gnginx-s/sbin/nologinnginx[root@ipythonlnmp]#mkdir/var/tmp/nginx[root@ipythonlnmp]#chownnginx:nginx/var/tmp/nginx/[root@ipythonlnmp]#tarzxfnginx-1.6.0.tar.gz[root@ipythonlnmp]#cdnginx-1.6.0[root@ipythonnginx-1.6.0]#sed-i’s/CFLAGS=”$CFLAGS-g”/#CFLAGS=”$CFLAGS-g”/’auto/cc/gcc[root@ipythonnginx-1.6.0]#sed-i”s#/usr/local#/software/google-perftools#”auto/lib/google-perftools/conf##配置参数有点长##[root@ipythonnginx-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@ipythonnginx-1.6.0]#make&&makeinstall[root@ipythonnginx-1.6.0]#mkdir/tmp/tcmalloc[root@ipythonnginx-1.6.0]#chmod0777/tmp/tcmalloc/###这文件在附件里###[root@ipythonnginx-1.6.0]#cp../nginx.conf/software/nginx/conf/[root@ipythonnginx-1.6.0]#cp../fcgi.conf/software/nginx/conf/[root@ipythonnginx-1.6.0]#chmod755/etc/init.d/nginx[root@ipythonnginx-1.6.0]#mkdir/data/{logs,}[root@ipythonnginx-1.6.0]#/software/nginx/sbin/nginx[root@ipythonnginx-1.6.0]#iptables-F[root@ipythonnginx-1.6.0]#iptables-AINPUT-ptcp–dport22-jACCEPT[root@ipythonnginx-1.6.0]#iptables-AINPUT-ptcp–dport80-jACCEPT[root@ipythonnginx-1.6.0]#psaux|grepnginxroot612910.00.031120896?Ss15:360:00nginx:masterprocess/software/nginx/sbin/nginx-c/software/nginx/conf/nginx.confnginx612930.00.1315601612?S15:360:00nginx:workerprocess在爱情里,有时候简单的一句话,能胜过千言万语。

CentOS7 编译安装LNMP

相关文章:

你感兴趣的文章:

标签云: