Centos 6.4 Build Lnmp (series 1)

Source: Internet
Author: User
Tags install openssl mcrypt xsl

Needless to say, there are lamp compiler installation will have LNMP compile installation.

Original blog from: www.51niux.com bo: Busy Firewood less

On the following Yum, may look at Yum a bit more, but this is my different version of the installation to install the files need yum, basically follow me this yum installation, compile time will not error.

Operating system version: Centos 6.4 64-bit

Nginx Version: 1.5.7

MySQL version: 5.5.53

PHP Version: 5.3.27

One, the MySQL compilation installs

Mkdir/tools
cd/tools/
Yum-y Install Bison gcc gcc-c++ autoconf automake zlib* libxml* ncurses-devel libtool-ltdl-devel* mysql-devel
wget http://www.cmake.org/files/v2.8/cmake-2.8.8tar.gz
Tar zxf cmake-2.8.8.tar.gz
CD cmake-2.8.8
Make && make install
./configure && make && make install
cd/tools/
wget downloads.mysql.com/archives/get/file/mysql-5.5.35.tar.gz
Tar zxf mysql-5.5.35.tar.gz
CD mysql-5.5.35
/usr/local/bin/cmake \
-dcmake_install_prefix=/application/mysql-5.5.35 \
-dmysql_unix_addr=/tmp/mysql.sock \
-ddefault_charset=utf8 \
-DDEFAULT_COLLATION=UTF8_GENERAL_CI \
-dextra_charsets=all \
-dwith_myisam_storage_engine=1 \
-dwith_innobase_storage_engine=1 \
-dwith_memory_storage_engine=1 \
-dwith_readline=1 \
-denabled_local_infile=1 \
-dmysql_datadir=/mysqldata \
-dmysql_user=mysql \
-dmysql_tcp_port=3306
Make && make install
Useradd mysql-s/sbin/nologin-m
Chown-r mysql:mysql/application/mysql-5.5.35
Ln-s/application/mysql-5.5.35/application/mysql
CP Support-files/mysql.server/etc/init.d/mysqld
CP SUPPORT-FILES/MY-SMALL.CNF/ETC/MY.CNF
chmod 755/etc/init.d/mysqld
Chown mysql:mysql/etc/my.cnf
Mkdir/mysqldata
Chown Mysql:mysql/mysqldata
/application/mysql/scripts/mysql_install_db--defaults-file=/etc/my.cnf--basedir=/application/mysql--datadir=/ Mysqldata

Vi/etc/profile

Path= $PATH:/application/mysql/bin
Export PATH

Soure/etc/profile

#/usr/local/bin/cmake know why the front to install CMake, mysql5.5 after the CMake compiled by the installation

#-dcmake_install_prefix=/application/mysql-5.5.35 Specifying MySQL installation location

#-dmysql_unix_addr=/tmp/mysql.sock Sock Socket Location

#-ddefault_charset=utf8 default character set is UTF8, in fact there is a utf8mb4, this is to deal with antiquity four bytes, first of all, this four-byte antiquity above the UTF8 display is garbled, since the 5.5.3 series have utf8mb4 character set.

#-ddefault_collation=utf8_general_ci Default character Proofing

#-dextra_charsets=all Extended Character Set I choose all here, do not eat the loss of the character set

#-dwith_myisam_storage_engine=1 enabling the MYISAM engine

#-dwith_innobase_storage_engine=1 enabling the InnoDB engine

#-dwith_memory_storage_engine=1 enabling the MEMORY engine

#-dwith_readline=1 Enable READLINE Library Support (provides editable command line)

#-denabled_local_infile=1 enable local data import support

#-dmysql_datadir=/mysqldata Specify the location of the database

#-dmysql_user=mysql specifying MySQL User

#-dmysql_tcp_port=3306 specifies that the TCP port is 3306

Second, the installation of Nginx compiler

cd/tools/
Yum Install openssl* libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 Libxml2-dev El zlib zlib-devel ncurses ncurses-devel Curl curl-devel gd gd2 gd-devel gd2-devel-y
wget http://sourceforge.net/proje Cts/pcre/files/pcre/8.32/pcre-8.32.tar.gz/download
Tar zxf pcre-8.32.tar.gz
CD pcre-8.32
./configure
Make && make install
Cd/tools
Useradd cspweb-s/sbin/nologin -M
wget http://nginx.org/download /nginx-1.5.7.tar.gz
Tar zxf nginx-1.5.7.tar.gz
CD nginx-1.5.7
./configure --user=cspweb--group= Cspweb--prefix=/application/nginx-1.5.7--with-http_stub_status_module--with-http_ssl_module
Make && Make install
echo "/usr/local/lib" >>/etc/ld.so.conf
Ln-s/application/nginx-1.5.7/application/nginx

#--with-http_stub_status_module This module can obtain some of Nginx's operating status, is the monitoring module

#--with-http_ssl_module support ssl,443 Port Well, this must be loaded, Nginx is often combined with SSL

Iii. compilation and installation of PHP

Cd/tools

Yum install zlib libxml libjpeg freetype libpng gd Curl libiconv zlib-devel libxml2-devel Libjpeg-devel freetype-devel Lib Png-devel Gd-devel Curl-devel libxslt-devel-y

wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
Tar zxf libiconv-1.14.tar.gz #装这个是为支持编码转化, the specific role can be Baidu
CD libiconv-1.14
./configure--prefix=/usr/local/libiconv
Make && make install
Cd/tools
wget http://downloads.sourceforge.net/mcrypt/libmcrypt-2.5.8.tar.gz?modtime=1171868460&big_mirror=0
Tar zxf libmcrypt-2.5.8.tar.gz #作用:Libmcrypt is an extended library of cryptographic algorithms
CD libmcrypt-2.5.8
./configure
Make && make install
/sbin/ldconfig
CD libltdl/
./configure--enable-ltdl-install
Make&&make Install
Cd/tools
wget http://blog.s135.com/soft/linux/nginx_php/mhash/mhash-0.9.9.9.tar.gz
Tar zxf mhash-0.9.9.9.tar.gz #hash算法扩展库
CD mhash-0.9.9.9
./configure
Make &&make Install
Cd/tools
wget http://blog.s135.com/soft/linux/nginx_php/mcrypt/mcrypt-2.6.8.tar.gz
Tar zxf mcrypt-2.6.8.tar.gz #加密扩展库, loaded it can use the 22 encryption and decryption algorithms in his own
CD mcrypt-2.6.8
/sbin/ldconfig
./configure
Make && make install
Cd/tools
wget Http://www.php.net/get/php-5.3.27.tar.gz/from/this/mirror
Tar zxf php-5.3.27.tar.gz
CD php-5.3.27
./configure \
--prefix=/application/php5.3.27 \
--with-mysql=/application/mysql \
--with-iconv-dir=/usr/local/libiconv \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--WITH-LIBXML-DIR=/USR \
--enable-xml \
--disable-rpath \
--enable-safe-mode \
--enable-bcmath \
--ENABLE-SHMOP \
--enable-sysvsem \
--enable-inline-optimization \
--with-curl \
--with-curlwrappers \
--enable-mbregex \
--ENABLE-FPM \
--enable-mbstring \
--with-mcrypt \
--WITH-GD \
--ENABLE-GD-NATIVE-TTF \
--WITH-OPENSSL \
--with-mhash \
--ENABLE-PCNTL \
--enable-sockets \
--WITH-XMLRPC \
--enable-zip \
--ENABLE-SOAP \
--enable-short-tags \
--enable-zend-multibyte \
--enable-static \
--with-xsl \
--with-fpm-user=cspweb \
--with-fpm-group=cspweb\
--enable-ftp
Make&&make Install

CP Php.ini-production/application/php/lib/php.ini

Cp/application/php5.3.27/etc/php-fpm.conf.default/application/php5.3.27/etc/php-fpm.conf

#--prefix=/application/php5.3.27 specifying where to install PHP
#--with-mysql=/application/mysql specifying MySQL installation directory, support for MySQL
#--with-iconv-dir=/usr/local/libiconv supports LIBICONV encryption algorithm
#--with-freetype-dir opening support for the FreeType font library
#--with-jpeg-dir opening support for JPEG images
#--with-png-dir opening support for PNG images
#--with-zlib-dir opening support for zlib libraries
#--with-libxml-dir=/usr opening support for LIBXML2 libraries
#--enable-xml support for opening XML files
#--disable-rpath to close additional runtime files
#--enable-safe-mode Turn on Safe mode (php5.4 is turned on by default, this parameter is not used for compilation)
#--enable-bcmath Open picture resizing, use this module for Zabbix monitoring
#--enable-shmop Shared memory operation function, which can communicate with C + +
#--enable-sysvsem support signal volume, through the signal volume, can realize process communication, competition and so on
#--enable-inline-optimization supports stack heap pointers and optimized threads
#--with-curl opening the Curl browsing tool support
#--with-curlwrappers using the Curl tool to open the URL stream
#--enable-mbregex supports multiple character sets and supports Zhong Wenjing to intercept Chinese string lengths
#--enable-fpm CGI-style installation of the launcher, CGI form with PHP-FPM boot
#--enable-mbstring Multi-byte, string support
#--with-mcrypt supports extension of cryptographic algorithms
#--with-gd support for opening GB libraries
#--enable-gd-native-ttf Open freetype1.* Support
#--with-openssl OpenSSL support for encrypted transmissions
#--with-mhash supports the extension of hash algorithm
#--enable-pcntl Multithreading Optimization
#--enable-sockets Open Sockets support
#--with-xmlrpc Open the C language of XML-RPC
#--enable-zip opening support for zip
#--enable-soap SOAP extensions are primarily used to handle Web services in the form of RPC
#--enable-short-tags activating short Format markers
#--enable-zend-multibyte supports Zend Multi-byte (5.4 is not added after this parameter)
#--enable-static generating a static link library
#--with-xsl opens XSLT file support, expands the LibXML2 library, requires LIBXSLT software
#--with-fpm-user=cspweb initiated by the user
#--with-fpm-group=cspweb initiated user groups
#--enable-ftp Support for Open FTP

Note: Two errors may be reported

(1). Error:

ext/xmlrpc/libxmlrpc/.libs/encodings.o:in function ' Convert ':

/root/php-5.2.12/ext/xmlrpc/libxmlrpc/encodings.c:73:undefined reference to ' Libiconv_open '

/root/php-5.2.12/ext/xmlrpc/libxmlrpc/encodings.c:81:undefined reference to ' Libiconv '

/root/php-5.2.12/ext/xmlrpc/libxmlrpc/encodings.c:101:undefined reference to ' Libiconv_close '

Collect2:ld returned 1 exit status

Make: * * * [sapi/cli/php]?.. 1

Workaround:

VI Makefile

Find the following line:

Extra_libs =-lcrypt ...

After the last add-liconv save make through

(2). A second error:

Error while loading shared Libraries:libmysqlclient.so.18:cannot open Shared object file:no such file or directory.

Workaround:

Vi/etc/ld.so.conf

/application/mysql/lib #将mysql的lib库填上

[[email protected] ~]# Ldconfig is in effect


Iv. Configuration

Vi/application/nginx/conf/nginx.conf

Location ~. *\. (PHP|PHP5)? $ {
root HTML; #默认的html是nginx软件安装位置下的html目录
Fastcgi_pass 127.0.0.1:9000; #这就是php的启动ip加端口
Fastcgi_index index.php; #首页为index. php
Fastcgi_param Script_filename/scripts$fastcgi_script_name;
Include fastcgi.conf;
}


/application/nginx/sbin/nginx #启动nginx

/APPLICATION/PHP/SBIN/PHP-FPM #启动php

vi/application/nginx/html/index.php #编写测试php文件
<?php
Phpinfo ();


This article from "Technology in the progress of sharing" blog, declined reprint!

Centos 6.4 Build Lnmp (series 1)

Related Article

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.