Lnmp (Linux-nginx-mysql-PHP), this article will try to compile lnmp on centos7.0. The full text basically uses manual compilation and deployment... relying on Yum helped me install GCC and automake .. it takes a long time to write this thing... nima is too time-consuming. Linux O & M exchange group: 344177552
Major software versions:
nginx-1.6.0php-5.3.5mysql-5.5.6
Yum source configuration (in fact, there is no change)
[[email protected] ~]# cat /etc/yum.repos.d/1.repo [1]name=1baseurl=file:///mediaenabled=1gpgcheck=0[[email protected] ~]# mount /dev/cdrom /media && yum clean allmount: /dev/sr0 is write-protected, mounting read-onlyLoaded plugins: fastestmirrorCleaning repos: 1Cleaning up everything
Compile tool Installation
[[email protected] ~]# yum install gcc-c++ automake autoconf bzip2
Zlib library (a function library for data compression ):
[[email protected] lnmp]# tar zxf zlib-1.2.8.tar.gz [[email protected] lnmp]# cd zlib-1.2.8[[email protected] zlib-1.2.8]# ./configure --prefix=/software/sharelib[[email protected] zlib-1.2.8]# make && make install
PCRE Library (rewrite Support)
[[email protected] lnmp]# tar zxf pcre-8.35.tar.gz [[email protected] lnmp]# cd pcre-8.35[[email protected] pcre-8.35]# ./configure --prefix=/software/pcre --enable-utf8 --enable-unicode-properties[[email protected] pcre-8.35]# make && make install
OpenSSL library (HTTPS Support)
[[email protected] lnmp]# tar zxf openssl-1.0.1h.tar.gz [[email protected] lnmp]# cd openssl-1.0.1h[[email protected] openssl-1.0.1h]# ./config --prefix=/software/openssl[[email protected] openssl-1.0.1h]# make && make install
Tcmalloc tool (Google Memory Management Kit)
[[Email protected] lnmp] # tar zxf libunwind-1.1.tar.gz [[email protected] lnmp] # cd libunwind-1.1 [[email protected] libunwind-1.1] # cflags =-FPIC. /configure -- prefix =/software/Google-libunwind [[email protected] libunwind-1.1] # Make cflags =-FPIC & make cflags =-FPIC install [[email protected] lnmp] # tar zxf gperftools-2.2.tar.gz [[email protected] lnmp] # cd gperftools-2.2 [[email protected] gperftools-2.2] # ldflags = "-l/software/Google-libunwind/lib" cppflags = "-I /software/Google-libunwind/include ". /configure -- prefix =/software/Google-perftools [[email protected] gperftools-2.2] # Make & make install ### add path to dynamic link library ### [email protected] gperftools-2.2] # echo "/software/Google-libunwind/lib/">/etc/lD. so. conf [[email protected] gperftools-2.2] # echo "/software/Google-perftools/lib/">/etc/lD. so. conf [[email protected] gperftools-2.2] # echo "/software/sharelib/lib/">/etc/lD. so. conf & ldconfig
Nginx (not explained)
[[Email protected] lnmp] # groupadd-G 1500 nginx [[email protected] lnmp] # useradd-m-u 1500-G nginx-S/sbin/nologin nginx [[email protected] lnmp] # mkdir/var/tmp/nginx [[email protected] lnmp] # chown nginx: nginx/var/tmp/nginx/[[email protected] lnmp] # tar zxf nginx-1.6.0.tar.gz [[email protected] lnmp] # cd nginx-1.6.0 [[email protected] nginx-1.6.0] # sed-I 's/cflags = "$ cflags-G"/# cflags = "$ cflags -G "/'Auto/CC/GCC [[[email protected] nginx-1.6.0] # sed-I" s #/usr/local #/software/Google-perftools # "Auto/lib /Google-perftools/conf # configuration parameters are a bit long # [[email protected] 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-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 [[email protected] nginx-1.6.0] # Make & make install [[email protected] Nginx-1.6.0] # mkdir/tmp/tcmalloc [[email protected] nginx-1.6.0] # chmod 0777/tmp/tcmalloc/### this file is in the attachment ### [[email protected] nginx-1.6.0] # CP .. /nginx. conf/software/nginx/CONF/[[email protected] nginx-1.6.0] # CP .. /fcgi. conf/software/nginx/CONF/[[email protected] nginx-1.6.0] # chmod 755/etc/init. d/nginx [[email protected] nginx-1.6.0] # mkdir/data/{logs, www. ipython. me} [[email protected] nginx-1. 6.0] #/software/nginx/sbin/nginx [[email protected] nginx-1.6.0] # iptables-f [[email protected] nginx-1.6.0] # iptables-A input-p tcp -- dport 22 -J accept [[email protected] nginx-1.6.0] # iptables-A input-p tcp -- dport 80-J accept [[email protected] nginx-1.6.0] # ps aux | grep nginxroot 61291 0.0 31120 896? SS nginx: Master process/software/nginx/sbin/nginx-C/software/nginx/CONF/nginx. confnginx 61293 0.0 0.1 31560? S nginx: Worker Process
Ncurses Library (character terminal processing Library)
[[email protected] lnmp]# tar jxf ncurses-5.9.tar.bz2 [[email protected] lnmp]# cd ncurses-5.9[[email protected] ncurses-5.9]# ./configure --prefix=/software/ncurses --with-shared --without-debug[[email protected] ncurses-5.9]# make && make install
MySQL (database)
[[Email protected] lnmp] #/usr/sbin/groupadd MySQL [[email protected] lnmp] #/usr/sbin/useradd-S/sbin/nologin-G MySQL [[email protected] lnmp] # tar zxf mysql-5.5.6-rc.tar.gz [[email protected] lnmp] # cd mysql-5.5.6-rc [[email protected] mysql-5.5.6-rc] #. /configure -- prefix =/software/MySQL/-- enable-starter er -- With-extra-charsets = Complex -- enable-thread-safe-client -- With-big-tables -- With-R Eadline -- With-SSL -- With-embedded-server -- enable-local-infile -- With-plugins = partition, Innobase, myisammrg -- With-named-Curses-libs =/software/ncurses/lib/libncurses. so.5 [[email protected] mysql-5.5.6-rc] # Make & make install [[email protected] mysql-5.5.6-rc] # mkdir/data/MySQL/{BINLOG, relaylog}-P [[email protected] mysql-5.5.6-rc] # chown-r MYSQL: MySQL/data/MySQL [[email protected] mysql-5.5.6-r C] #/software/MySQL/bin/mysql_install_db -- basedir =/software/MySQL/-- datadir =/data/MySQL/-- user = MySQL ### this file is included in the attachment # # [[email protected] mysql-5.5.6-rc] # \ CP .. /My. CNF/etc/My. CNF [[email protected] mysql-5.5.6-rc] # \ CP .. /mysqld/etc/init. d/mysqld [[email protected] mysql-5.5.6-rc] # chmod 755/etc/init. d/mysqld [[email protected] mysql-5.5.6-rc] # systemctl enable mysqld [[email protected] mysql-5.5.6- RC] # systemctl start mysqld [[email protected] mysql-5.5.6-rc] # ps aux | grep mysqldroot 55475 0.1 0.1 115348 1696? S/bin/sh/software/MySQL/bin/mysqld_safe -- datadir =/data/MySQL -- PID-file =/data/MySQL. pidmysql 56342 2.7 11.9 1918248 120680? SL/software/MySQL/libexec/mysqld -- basedir =/software/MySQL -- datadir =/data/MySQL -- Plugin-Dir =/software/MySQL/lib/MySQL/plugin -- user = MySQL -- log-error =/data/MySQL/mysql_error.log -- Open-files-Limit = 10240 -- PID-file =/data/MySQL. PID -- socket =/tmp/MySQL. sock -- Ports = 3306
Libiconv Library (character encoding conversion)
[[Email protected] lnmp] # tar zxf libiconv-1.14.tar.gz ### patch it, avoid manual modification to hidden logic errors ### [[email protected] lnmp] # gzip-D libiconv-glibc-2.16.patch.gz [[email protected] lnmp] # cd libiconv-1.14/srclib [[email protected] srclib] # patch-P1 <.. /.. /libiconv-glibc-2.16.patch patching file stdio. in. H [[email protected] libiconv-1.14] # CD .. [[email protected] libiconv-1.14] #. /configure -- prefix =/software/sharelib/[[email protected] libiconv-1.14] # Make & make install
Libxml Library (XML library)
[[email protected] lnmp]# tar jxf libxml2-2.8.0.tar.bz2 [[email protected] lnmp]# cd libxml2-2.8.0[[email protected] libxml2-2.8.0]# ./configure --prefix=/software/sharelib[[email protected] libxml2-2.8.0]# make && make install
Libpng library (Image Library)
[[email protected] lnmp]# tar jxf libpng-1.6.8.tar.bz2 [[email protected] lnmp]# cd libpng-1.6.8[[email protected] libpng-1.6.8]# LDFLAGS="-L/software/sharelib/lib/" CPPFLAGS="-I/software/sharelib/include" ./configure --prefix=/software/sharelib[[email protected] libpng-1.6.8]# make && make install
JPEG Library (Image Library)
[[email protected] lnmp]# tar jxf jpegsrc.v9a.tar.bz2[[email protected] lnmp]# cd jpeg-9a/ [[email protected] jpeg-9a]# ./configure --prefix=/software/sharelib/[[email protected] jpeg-9a]# make && make install
FreeType (Font Library)
[[email protected] lnmp]# tar jxf freetype-2.5.2.tar.bz2 [[email protected] lnmp]# cd freetype-2.5.2[[email protected] freetype-2.5.2]# LIBPNG_CFLAGS="-I/software/sharelib/include/" LIBPNG_LDFLAGS="-L/software/sharelib/lib/" ./configure --prefix=/software/sharelib[[email protected] freetype-2.5.2]# make && make install[[email protected] freetype-2.5.2]# ln -s /software/sharelib/include/freetype2 /software/sharelib/include/freetype2/freetype
Libmcrypt Library (encryption algorithm)
[[email protected] lnmp]# tar jxf libmcrypt-2.5.8.tar.bz2 [[email protected] lnmp]# cd libmcrypt-2.5.8[[email protected] libmcrypt-2.5.8]# ./configure --prefix=/software/sharelib[[email protected] libmcrypt-2.5.8]# make && make install
Mhash Library (encrypted)
[[email protected] lnmp]# tar jxf mhash-0.9.9.9.tar.bz2[[email protected] lnmp]# cd mhash-0.9.9.9[[email protected] mhash-0.9.9.9]# ./configure --prefix=/software/sharelib/[[email protected] mhash-0.9.9.9]# make && make install
Curl Library (URL transmission)
[[email protected] lnmp]# tar jxf curl-7.36.0.tar.bz2[[email protected] lnmp]# cd curl-7.36.0[[email protected] curl-7.36.0]# ./configure --prefix=/software/curl[[email protected] curl-7.36.0]# make && make install
GD library (drawing)
[[email protected] lnmp]# tar zxf gd-2.0.35.tar.gz [[email protected] lnmp]# cd gd-2.0.35[[email protected] gd-2.0.35]# LDFLAGS="-L/software/sharelib/lib" CPPFLAGS="-I/software/sharelib/include" ./configure --prefix=/software/sharelib --enable-shared --with-png=/software/sharelib --with-freetype=/software/sharelib --with-libiconv-prefix=/software/sharelib --with-jpeg=/software/sharelib[[email protected] gd-2.0.35]# make && make install
Libtool (library compilation support)
[[email protected] lnmp]# tar zxf libtool-2.4.2.tar.gz [[email protected] lnmp]# cd libtool-2.4.2[[email protected] libtool-2.4.2]# ./configure --prefix=/software/sharelib/ --enable-ltdl-install[[email protected] libtool-2.4.2]# make && make install
Add MySQL library files to dynamic sharing
[[email protected] lnmp]# echo "/software/mysql/lib/mysql/" >> /etc/ld.so.conf && ldconfig
PHP (a language)
[[Email protected] lnmp] # tar zxf php-5.3.5.tar.gz [[email protected] lnmp] # cd php-5.3.5 [[email protected] php-5.3.5] # sed-I s "# MySQL/psi/PSI. h #/software/MySQL/include/MySQL/psi. h # "/software/MySQL/include/MySQL/my_sys.h [[email protected] php-5.3.5] # sed-I s" # MySQL/plugin. h #/software/MySQL/include/MySQL/plugin. h # "/software/MySQL/include/MySQL/m_string.h [[email protected] php-5.3.5] # sed-I s" # MySQL/services. h #/software/MySQL/include/MySQL/services. h # "/software/MySQL/include/MySQL/plugin. H [[email protected] php-5.3.5] # sed-I s "# MySQL/service_my_snprintf.h #/software/MySQL/include/MySQL/service_my_snprintf.h #"/software/MySQL/include/MySQL/ services. H [[email protected] php-5.3.5] # sed-I s "# MySQL/service_thd_alloc.h #/software/MySQL/include/MySQL/service_thd_alloc.h #"/software/MySQL/include/MySQL/ services. H [[email protected] php-5.3.5] #. /configure -- prefix =/software/PHP -- With-config-file-Path =/software/PHP/etc -- With-mysql =/software/MySQL -- With-mysqli =/software /MySQL/bin/mysql_config -- With-iconv-Dir =/software/sharelib -- disable-ipv6 -- With-FreeType-Dir =/software/sharelib/-- With-JPEG-Dir =/software /sharelib/-- With-PNG-Dir =/software/sharelib/-- With-zlib =/software/sharelib/-- With-libxml-Dir =/software/sharelib/-- disable- rpath -- enable-bcmath -- enable-safe-mode -- enable-shmop -- enable-sysvsem -- With-curl =/software/curl/-- enable-FPM -- enable-mbstring --- mcrypt =/software/sharelib/-- With-Gd =/software/sharelib/-- enable-Gd-native-TTF -- With-OpenSSL =/software/OpenSSL -- With-mhash -- enable -pcntl -- enable-sockets -- With-XMLRPC -- enable-zip -- enable-soap -- enable-inline-optimization -- With-curlwrappers -- enable-mbregex -- With-gettext [[email protected] php-5.3.5] # make install # create a PHP-FPM configuration file, parameters of what you adjust according to the configuration # [[email protected] php-5.3.5] # Cat>/software/PHP/etc/php-fpm.conf <
Okay... look at the picture.
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/3C/B8/wKiom1PCoIPhQ3pXAAKppSWGhd8839.jpg "Title =" centos7-lnmp.jpg "alt =" wkiom1pcoiphq3pxaakppswghd8839.jpg "/>
This article from the "IT Chen Yi" blog, please be sure to keep this source http://itchenyi.blog.51cto.com/4745638/1437686