Original Centos7 from zero compilation Nginx+php+mysql

Source: Internet
Author: User
Tags fpm memcached


It's a tough time to play. In addition to the compiler using Yum installation, all others are compiled manually. Hum ~

Seemingly on Nginx, PHP, MySQL three east, but they are too much to rely on others.

There is no way to use them to be honest with them to provide the things they want.

Some of the first modules depend on some Lib libraries,

If you are lazy, just follow the instructions below and enter them separately. Then look directly at the configuration chapter. (But this is not the latest version of the installation of Yo)


First, Centos7 from zero compile Nginx+php+mysql

Second, Centos7 from zero configuration nginx+php+mysql

Third, Centos7 from the zero compiler configuration memcached

First, the preparatory work

1.1 Installing or updating GCC gcc-c++

Because I installed the CentOS is absolutely pure drops. There's nothing. No more. The compiler must be installed first.

# yum Install gcc gcc-c++

1.2 Creating a directory to use

Source is the folder used to store the source code. The package is used to store the compiled library files. Lnmp is what we really need to put inside. (nginx+mysql+memcached+php)

mkdir /source/
mkdir /package/
mkdir /lnmp/


Second, start the installation (Nginx article)

2.1 Decompression Pcre

[Official website] http://www.pcre.org/

Command flow:

CD /source/
wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.38/pcre-8.38.tar.gz tar -zxvf pcre-8.tar.gz

Description: Do not need to compile, only need to unzip on the line.

2.2 Decompression Zlib

[Official website] http://zlib.net/

Command flow:

CD /source/
wget http://zlib.net/zlib-1.2.8.tar.gz tar -zxvf zlib-1.2.8. tar.gz

Description: Do not need to compile, only need to unzip on the line.

2.3 Installing Nginx

[Official website] http://nginx.org/

Command flow:

 # cd /source/
# wget http://nginx.org/download/nginx-1.8.0.tar.gz # tar -zxvf Nginx-1.8 . 0 .tar.gz# cd nginx -1.8 . 0 #. /configure--prefix=/lnmp/nginx--with-pcre=/source/pcre-8.38--with-zlib=/source/zlib-1.2.8# make # make install

--with-pcre: The source directory used to set up the pcre.
--with-zlib: The source directory used to set up the zlib.
Because compiling nginx needs to use the source code of these two libraries.

Small summary:

Here, the Nginx installation is complete. We can satisfy the desire of our own heart first. Open the Nginx service to see Hello World.

Start Nginx


After launch, you can open the page in the browser and the Nginx default page will be displayed.

Third, start the installation (PHP article)

3.1 Installing LIBXML2

[Official website] http://xmlsoft.org/

Command flow:

CD /source/
wget ftp://xmlsoft.org/libxml2/libxml2-2.9.3.tar.gz tar -zxvf libxml2-2.9. 3 CD libxml2-2.9. 3 # . /--prefix=/package/make doInstall

Here--with-python=no is

3.2 Installing PHP

[Official website] http://php.net/

Command flow:

# cd/source/# wget http: //cn2.php.net/distributions/php-7.0.2.tar.gz# TAR-ZXVF php-7.0.2. tar.gz# cd PHP-7.0.2# ./Configure #--prefix=/lnmp/PHP #--WITH-LIBXML-DIR=/PACKAGE/LIBXML2 \//open support for the LIBXML2 library#--WITH-CONFIG-FILE-PATH=/LNMP/PHP/ETC \//directory where the configuration files are located#--enable-mbstring \//Support Mbstring Library#--ENABLE-FPM \//Support PHP-FPM (recommended to open)#--with-mysqli//Open the Mysqli module# make# make install

Iv. start installation (MySQL article)

4.1 Installing CMake

[Official website] https://cmake.org/

Command flow:

https://cmake.org/files/v3.4/cmake-3.4.1.tar.gz# tar-zxvf cmake-3.4.1.tar.gz# cd cmake-3.4.1#./configure- -prefix=/package/cmake# make# make install#   export path=/package/cmake/bin: $PATH  //SET environment variable. Can be ignored, just for your later use CMake convenient point.

4.2 Installing ncurses

[Official website] http://ftp.gnu.org/gnu/ncurses/

Command flow:

wget http://ftp.gnu.org/gnu/ncurses/ncurses-6.0.tar.gz# TAR-ZXVF ncurses-6.0. tar.gz# CD ncurses -6.0#. /Configure--prefix=/package/ncurese# make# make install

4.3 Installing MySQL

[Official website] http://www.mysql.com/

Command flow:

Without boost mounting mode

//This is the MySQL source without the boost version. You can use the following parameters to automatically download boost during compilation//-ddownload_boost=1-dwith_boost=/package/boost# wget http: //cdn.mysql.com/downloads/mysql-5.7/mysql-5.7.10.tar.gz# TAR-ZXVF mysql-5.7.Ten. tar.gz# CD MySQL-5.7.Ten# CMake.-dcmake_install_prefix=/usr/local/MySQL #-ddownload_boost=1-dwith_boost=/package/boost \//set up the auto-download boost library and put it in the path specified by-dwith_boost. #-DCURSES_LIBRARY=/PACKAGE/NCURSES/LIB/LIBNCURSES.A \//ncurses Library LIBNCURSES.A#-dcurses_include_path=/package/ncurses/include//ncurses Library header file# make # Make Install

Self-boost Mounting mode

 # wget http://cdn.mysql.com/downloads/mysql-5.7/mysql-boost-5.7.10.tar.gz  # TAR-ZXVF Mysql-boost-5.7 . 10  .tar.gz# cd mysql -10  # CMake.                        -dcmake_install_prefix=/usr/local/mysql # -dwith_boost=/boost/boost_1_59_0 // // ncurses library LIBNCURSES.A  #-dcurses_include_path=/package/ncurses/ Include // # make # make install  

Description: MySQL has been supported by the boost library since the 5.7 release. And it is very disgusting that MySQL needs to specify the boost version number, high or low, it is possible to cause the compilation does not pass.

To this, the use of CentOS7 on the most commonly used, the new Web module has been basically completed, the rest is to configure these software. Haha, in fact, the code is much, but the understanding is really quite simple, on those several commands. What do you think? Isn't that pretty simple.

Original Centos7 from zero compilation Nginx+php+mysql

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.