CentOS7 compilation and installation of LNMP

Source: Internet
Author: User
Tags openssl library automake

CentOS7 compilation and installation of LNMP

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)

[root@ipython ~]# cat /etc/yum.repos.d/1.repo [1]name=1baseurl=file:///mediaenabled=1gpgcheck=0[root@ipython ~]# mount /dev/cdrom /media && yum clean allmount: /dev/sr0 is write-protected, mounting read-onlyLoaded plugins: fastestmirrorCleaning repos: 1Cleaning up everything

Compile tool Installation

[root@ipython ~]# yum install gcc-c++ automake autoconf bzip2

Zlib library (a function library for data compression ):

[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 Library (rewrite Support)

[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 library (https Support)

[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 tool (google Memory Management Kit)

[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 ### add path to dynamic link library ### [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 (not explained)

[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 ngi Nx-1.6.0] # sed-I "s #/usr/local #/software/google-perftools #" auto/lib/google-perftools/conf # configuration parameters are a bit long ##[ 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-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 --- zlib =/root/lnmp/zlib-1.2.8 -- with-google_perftools_module [root @ ipython nginx-1.6.0] # make & make install [root @ ipython nginx-1.6.0] # mkdir/tmp/tcmalloc [root @ ipython nginx- 1.6.0] # chmod 0777/tmp/tcmalloc/### this file in the attachment ### [root @ ipython nginx-1.6.0] # cp .. /nginx. conf/software/nginx/conf/[root @ ipython nginx-1.6.0] # cp .. /fcgi. conf/software/nginx/conf/[root @ ipython nginx-1.6.0] # chmod 755/etc/init. d/nginx [root @ ipython nginx-1.6.0] # mkdir/data/{logs, www. ipython. me} [root @ ipython nginx-1.6.0] #/software/nginx/sbin/nginx [root @ ipython nginx-1.6.0] # iptables-F [root @ ipython Nginx-1.6.0] # iptables-a input-p tcp -- dport 22-j ACCEPT [root @ ipython nginx-1.6.0] # iptables-a input-p tcp -- dport 80-j ACCEPT [root @ ipython nginx-1.6.0] # ps aux | grep nginxroot 61291 0.0 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)

[root@ipython lnmp]# tar jxf ncurses-5.9.tar.bz2 [root@ipython lnmp]# cd ncurses-5.9[root@ipython ncurses-5.9]# ./configure --prefix=/software/ncurses --with-shared --without-debug[root@ipython ncurses-5.9]# make && make install

Mysql (database)

[Root @ ipython lnmp] #/usr/sbin/groupadd mysql [root @ ipython lnmp] #/usr/sbin/useradd-s/sbin/nologin-g mysql [root @ ipython lnmp] # tar zxf mysql-5.5.6-rc.tar.gz [root @ ipython lnmp] # cd mysql-5.5.6-rc [root @ ipython 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 -- -Embedded-server -- enable-local-infile -- with-plugins = partition, innobase, myisammrg -- with-named-curses-libs =/software/ncurses/lib/libncurses. so.5 [root @ ipython mysql-5.5.6-rc] # make & make install [root @ ipython mysql-5.5.6-rc] # mkdir/data/mysql/{binlog, relaylog}-p [root @ ipython mysql-5.5.6-rc] # chown-R mysql: mysql/data/mysql [root @ ipython mysql-5.5.6-rc] #/software/mysql/bin/mysql_install_db -- ba Sedir =/software/mysql/-- datadir =/data/mysql/-- user = mysql ### this file is in the attachment ### [root @ ipython mysql-5.5.6-rc] # \ cp.. /my. cnf/etc/my. cnf [root @ ipython mysql-5.5.6-rc] # \ cp .. /mysqld/etc/init. d/mysqld [root @ ipython mysql-5.5.6-rc] # chmod 755/etc/init. d/mysqld [root @ ipython mysql-5.5.6-rc] # systemctl enable mysqld [root @ ipython mysql-5.5.6-rc] # systemctl start mysqld [root @ ipython mysql-5.5.6-rc] # ps aux | gre P 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)

[Root @ ipython lnmp] # tar zxf libiconv-1.14.tar.gz ### patch it, avoid manual modification to hidden logic errors ### [root @ ipython lnmp] # gzip-d libiconv-glibc-2.16.patch.gz [root @ ipython lnmp] # cd libiconv-1.14/srclib [root @ ipython srclib] # patch- p1 <.. /.. /libiconv-glibc-2.16.patch patching file stdio. in. h [root @ ipython libiconv-1.14] # cd .. [root @ ipython libiconv-1.14] #. /configure -- prefix =/software/sharelib/[root @ ipython libiconv-1.14] # make & make install

Libxml Library (XML library)

[root@ipython lnmp]# tar jxf libxml2-2.8.0.tar.bz2 [root@ipython lnmp]# cd libxml2-2.8.0[root@ipython libxml2-2.8.0]# ./configure --prefix=/software/sharelib[root@ipython libxml2-2.8.0]# make && make install

Libpng library (Image Library)

[root@ipython lnmp]# tar jxf libpng-1.6.8.tar.bz2 [root@ipython lnmp]# cd libpng-1.6.8[root@ipython libpng-1.6.8]# LDFLAGS="-L/software/sharelib/lib/" CPPFLAGS="-I/software/sharelib/include" ./configure --prefix=/software/sharelib[root@ipython libpng-1.6.8]# make && make install

Jpeg Library (Image Library)

[root@ipython lnmp]# tar jxf jpegsrc.v9a.tar.bz2[root@ipython lnmp]# cd jpeg-9a/ [root@ipython jpeg-9a]# ./configure --prefix=/software/sharelib/[root@ipython jpeg-9a]# make && make install

Freetype (Font Library)

[root@ipython lnmp]# tar jxf freetype-2.5.2.tar.bz2 [root@ipython lnmp]# cd freetype-2.5.2[root@ipython freetype-2.5.2]# LIBPNG_CFLAGS="-I/software/sharelib/include/" LIBPNG_LDFLAGS="-L/software/sharelib/lib/" ./configure --prefix=/software/sharelib[root@ipython freetype-2.5.2]# make && make install[root@ipython freetype-2.5.2]# ln -s /software/sharelib/include/freetype2 /software/sharelib/include/freetype2/freetype

Libmcrypt Library (encryption algorithm)

[root@ipython lnmp]# tar jxf libmcrypt-2.5.8.tar.bz2 [root@ipython lnmp]# cd libmcrypt-2.5.8[root@ipython libmcrypt-2.5.8]# ./configure --prefix=/software/sharelib[root@ipython libmcrypt-2.5.8]# make && make install

Mhash Library (encrypted)

[root@ipython lnmp]# tar jxf mhash-0.9.9.9.tar.bz2[root@ipython lnmp]# cd mhash-0.9.9.9[root@ipython mhash-0.9.9.9]# ./configure --prefix=/software/sharelib/[root@ipython mhash-0.9.9.9]# make && make install

Curl Library (URL transmission)

[root@ipython lnmp]# tar jxf curl-7.36.0.tar.bz2[root@ipython lnmp]# cd curl-7.36.0[root@ipython curl-7.36.0]# ./configure --prefix=/software/curl[root@ipython curl-7.36.0]# make && make install

Gd library (drawing)

[root@ipython lnmp]# tar zxf gd-2.0.35.tar.gz [root@ipython lnmp]# cd gd-2.0.35[root@ipython 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[root@ipython gd-2.0.35]# make && make install

Libtool (library compilation support)

[root@ipython lnmp]# tar zxf libtool-2.4.2.tar.gz [root@ipython lnmp]# cd libtool-2.4.2[root@ipython libtool-2.4.2]# ./configure --prefix=/software/sharelib/ --enable-ltdl-install[root@ipython libtool-2.4.2]# make && make install

Add mysql library files to dynamic sharing

[root@ipython lnmp]# echo "/software/mysql/lib/mysql/" >> /etc/ld.so.conf && ldconfig

PHP (a language)

[Root @ ipython lnmp] # tar zxf php-5.3.5.tar.gz [root @ ipython lnmp] # cd php-5.3.5 [root @ ipython php-5.3.5] # sed-I s "# mysql/psi. h #/software/mysql/include/mysql/psi. h # "/software/mysql/include/mysql/my_sys.h [root @ ipython php-5.3.5] # sed-I s" # mysql/plugin. h #/software/mysql/include/mysql/plugin. h # "/software/mysql/include/mysql/m_string.h [root @ ipython php-5.3.5] # sed-I s" # mysql/services. h #/software/mysql/include/mysql/services. h # "/software/mysql/include/mysql/plugin. h [root @ ipython 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 [root @ ipython 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 [root @ ipython 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 [root @ ipython php-5.3.5] # make install # create a PHP-FPM configuration file, parameters of what you adjust according to the configuration # [root @ ipython php-5.3.5] # cat>/software/php/etc/php-fpm.conf <

Okay... look at the picture.

This article from the "IT Chen Yi" blog, please be sure to keep this source http://itchenyi.blog.51cto.com/4745638/1437686

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.