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.0
php-5.3.5
mysql-5.5.6
Yum source configuration (in fact, there is no change)
[[email protected] ~]# cat /etc/yum.repos.d/1.repo
[1]
name=1
baseurl=file:///media
enabled=1
gpgcheck=0
[[email protected] ~]# 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
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 the path to the 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 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 nginx
Root 61291 0.0 0.0 31120 896? Nginx: Master process/software/nginx/sbin/nginx-C/software/nginx/CONF/nginx. conf
Nginx 61293 0.0 0.1 31560 1612? 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-Readline -- 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-rc] #/software/MySQL/bin/mysql_install_db -- basedir =/software/MySQL/-- datadir =/data/MySQL/-- user = MySQL
### This file is 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 mysqld
Root 55475 0.1 0.1 115348 1696? S/bin/sh/software/MySQL/bin/mysqld_safe -- datadir =/data/MySQL -- PID-file =/data/MySQL. PID
MySQL 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
### Install patches to avoid manual modification of 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. 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 or something you can adjust according to the configuration ##
[[Email protected] php-5.3.5] # Cat>/software/PHP/etc/php-fpm.conf <
Okay... look at the picture.