欢迎光临
我们一直在努力

[Centos]安装LNMP服务器

1、安装支持扩展(根据自己需求决定安装哪些扩展)

1.1、安装Autoconf

<span class="com">#下载地址:http://mirrors.kernel.org/gnu/autoconf/</span>
<span class="com">#工具包 https://gitee.com/bbhsky/Centos7-setup.git</span><span class="pln">
tar zxvf autoconf</span><span class="pun">-</span><span class="lit">2.69</span><span class="pun">.</span><span class="pln">tar</span><span class="pun">.</span><span class="pln">gz
cd autoconf</span><span class="pun">-</span><span class="lit">2.69</span><span class="pun">/</span>
<span class="pun">./</span><span class="pln">configure </span><span class="pun">--</span><span class="pln">prefix</span><span class="pun">=</span><span class="str">/usr/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">autoconf</span><span class="pun">-</span><span class="lit">2.69</span><span class="pln">
make </span><span class="pun">&&</span><span class="pln"> make install
ln </span><span class="pun">-</span><span class="pln">s </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">autoconf</span><span class="pun">-</span><span class="lit">2.69</span><span class="str">/ /</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">autoconf
rm </span><span class="pun">-</span><span class="pln">rf autoconf</span><span class="pun">-</span><span class="lit">2.69</span><span class="pun">/</span>

1.2、安装libiconv(PHP必须)

<span class="com">#下载地址:http://www.gnu.org/software/libiconv/#downloading</span>
<span class="com">#工具包 https://gitee.com/bbhsky/Centos7-setup.git</span><span class="pln">
tar zxvf libiconv</span><span class="pun">-</span><span class="lit">1.15</span><span class="pun">.</span><span class="pln">tar</span><span class="pun">.</span><span class="pln">gz
cd libiconv</span><span class="pun">-</span><span class="lit">1.15</span>
<span class="pun">./</span><span class="pln">configure </span><span class="pun">--</span><span class="pln">prefix</span><span class="pun">=</span><span class="str">/usr/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">libiconv</span><span class="pun">-</span><span class="lit">1.15</span> <span class="pun">--</span><span class="pln">enable</span><span class="pun">-</span><span class="kwd">static</span><span class="pln">
make </span><span class="pun">&&</span><span class="pln"> make install
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">libiconv</span><span class="pun">-</span><span class="lit">1.15</span><span class="str">/ /</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">libiconv
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">libiconv</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">libiconv</span><span class="pun">.</span><span class="pln">so</span><span class="pun">.</span><span class="lit">2</span> <span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">libiconv</span><span class="pun">.</span><span class="pln">so</span><span class="pun">.</span><span class="lit">2</span><span class="pln">
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">libiconv</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">libiconv</span><span class="pun">.</span><span class="pln">so </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">libiconv</span><span class="pun">.</span><span class="pln">so
ldconfig
rm </span><span class="pun">-</span><span class="pln">rf libiconv</span><span class="pun">-</span><span class="lit">1.15</span>

1.3、安装libmcrypt

<span class="com">#下载地址:https://sourceforge.net/projects/mcrypt/files/Libmcrypt/</span>
<span class="com">#工具包 https://gitee.com/bbhsky/Centos7-setup.git</span><span class="pln">
tar zxvf libmcrypt</span><span class="pun">-</span><span class="lit">2.5</span><span class="pun">.</span><span class="lit">8.tar</span><span class="pun">.</span><span class="pln">gz
cd libmcrypt</span><span class="pun">-</span><span class="lit">2.5</span><span class="pun">.</span><span class="lit">8</span><span class="pun">/</span>
<span class="pun">./</span><span class="pln">configure
make </span><span class="pun">&&</span><span class="pln"> make install
ldconfig
cd libltdl</span><span class="pun">/</span>
<span class="pun">./</span><span class="pln">configure </span><span class="pun">--</span><span class="pln">enable</span><span class="pun">-</span><span class="pln">ltdl</span><span class="pun">-</span><span class="pln">install
make </span><span class="pun">&&</span><span class="pln"> make install
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">libmcrypt</span><span class="pun">.</span><span class="pln">la </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">libmcrypt</span><span class="pun">.</span><span class="pln">la
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">libmcrypt</span><span class="pun">.</span><span class="pln">so </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">libmcrypt</span><span class="pun">.</span><span class="pln">so
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">libmcrypt</span><span class="pun">.</span><span class="pln">so</span><span class="pun">.</span><span class="lit">4</span> <span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">libmcrypt</span><span class="pun">.</span><span class="pln">so</span><span class="pun">.</span><span class="lit">4</span><span class="pln">
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">libmcrypt</span><span class="pun">.</span><span class="pln">so</span><span class="pun">.</span><span class="lit">4.4</span><span class="pun">.</span><span class="lit">8</span> <span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">libmcrypt</span><span class="pun">.</span><span class="pln">so</span><span class="pun">.</span><span class="lit">4.4</span><span class="pun">.</span><span class="lit">8</span><span class="pln">
ldconfig
rm </span><span class="pun">-</span><span class="pln">rf libmcrypt</span><span class="pun">-</span><span class="lit">2.5</span><span class="pun">.</span><span class="lit">8</span>

1.4、安装mhash

<span class="com">#下载地址:http://mhash.sf.net/</span>
<span class="com">#工具包 https://gitee.com/bbhsky/Centos7-setup.git</span><span class="pln">
tar zxvf mhash</span><span class="pun">-</span><span class="lit">0.8</span><span class="pun">.</span><span class="lit">15.tar</span><span class="pun">.</span><span class="pln">gz
cd mhash</span><span class="pun">-</span><span class="lit">0.8</span><span class="pun">.</span><span class="lit">15</span><span class="pun">/</span>
<span class="pun">./</span><span class="pln">configure
make </span><span class="pun">&&</span><span class="pln"> make install
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">libmhash</span><span class="pun">.</span><span class="pln">a </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">libmhash</span><span class="pun">.</span><span class="pln">a
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">libmhash</span><span class="pun">.</span><span class="pln">la </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">libmhash</span><span class="pun">.</span><span class="pln">la
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">libmhash</span><span class="pun">.</span><span class="pln">so </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">libmhash</span><span class="pun">.</span><span class="pln">so
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">libmhash</span><span class="pun">.</span><span class="pln">so</span><span class="pun">.</span><span class="lit">2</span> <span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">libmhash</span><span class="pun">.</span><span class="pln">so</span><span class="pun">.</span><span class="lit">2</span><span class="pln">
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">libmhash</span><span class="pun">.</span><span class="pln">so</span><span class="pun">.</span><span class="lit">2.0</span><span class="pun">.</span><span class="lit">1</span> <span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">libmhash</span><span class="pun">.</span><span class="pln">so</span><span class="pun">.</span><span class="lit">2.0</span><span class="pun">.</span><span class="lit">1</span><span class="pln">
ldconfig
rm </span><span class="pun">-</span><span class="pln">rf mhash</span><span class="pun">-</span><span class="lit">0.8</span><span class="pun">.</span><span class="lit">15</span>

1.5、安装mcrypt

<span class="com">#下载地址:https://sourceforge.net/projects/mcrypt/</span>
<span class="com">#工具包 https://gitee.com/bbhsky/Centos7-setup.git</span><span class="pln">
tar zxvf mcrypt</span><span class="pun">-</span><span class="lit">2.6</span><span class="pun">.</span><span class="lit">8.tar</span><span class="pun">.</span><span class="pln">gz
cd mcrypt</span><span class="pun">-</span><span class="lit">2.6</span><span class="pun">.</span><span class="lit">8</span><span class="pun">/</span>
<span class="pun">./</span><span class="pln">configure </span><span class="pun">--</span><span class="pln">prefix</span><span class="pun">=</span><span class="str">/usr/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">mcrypt</span><span class="pun">-</span><span class="lit">2.6</span><span class="pun">.</span><span class="lit">8</span><span class="pln">
make </span><span class="pun">&&</span><span class="pln"> make install
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">mcrypt</span><span class="pun">-</span><span class="lit">2.6</span><span class="pun">.</span><span class="lit">8</span><span class="str">/ /</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">mcrypt
rm </span><span class="pun">-</span><span class="pln">rf mcrypt</span><span class="pun">-</span><span class="lit">2.6</span><span class="pun">.</span><span class="lit">8</span> 

1.6、安装freetype

<span class="com">#下载地址:https://download.savannah.gnu.org/releases/freetype/</span>
<span class="com">#工具包 https://gitee.com/bbhsky/Centos7-setup.git</span><span class="pln">
tar zxvf freetype</span><span class="pun">-</span><span class="lit">2.9</span><span class="pun">.</span><span class="lit">1.tar</span><span class="pun">.</span><span class="pln">gz
cd freetype</span><span class="pun">-</span><span class="lit">2.9</span><span class="pun">.</span><span class="lit">1</span><span class="pun">/</span>
<span class="pun">./</span><span class="pln">configure </span><span class="pun">--</span><span class="pln">prefix</span><span class="pun">=</span><span class="str">/usr/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">freetype</span><span class="pun">-</span><span class="lit">2.9</span><span class="pun">.</span><span class="lit">1</span><span class="pln">
make </span><span class="pun">&&</span><span class="pln"> make install
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">freetype</span><span class="pun">-</span><span class="lit">2.9</span><span class="pun">.</span><span class="lit">1</span><span class="str">/ /</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">freetype
</span><span class="com">#cp /usr/local/freetype/lib/pkgconfig/freetype2.pc /usr/lib/pkgconfig/ 这句未执行</span><span class="pln">
cat </span><span class="pun">></span> <span class="str">/etc/</span><span class="pln">ld</span><span class="pun">.</span><span class="pln">so</span><span class="pun">.</span><span class="pln">conf</span><span class="pun">.</span><span class="pln">d</span><span class="pun">/</span><span class="pln">freetype</span><span class="pun">.</span><span class="pln">conf</span><span class="pun"><<</span><span class="pln">EOF
</span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">freetype</span><span class="pun">/</span><span class="pln">lib
EOF
ldconfig
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">freetype</span><span class="pun">/</span><span class="pln">include</span><span class="pun">/</span><span class="pln">freetype2</span><span class="com">/* /usr/include/</span>

1.7、安装pcre

<span class="com">#下载地址:https://www.pcre.org/</span>
<span class="com">#工具包 https://gitee.com/bbhsky/Centos7-setup.git</span><span class="pln">
tar zxvf pcre</span><span class="pun">-</span><span class="lit">8.42</span><span class="pun">.</span><span class="pln">tar</span><span class="pun">.</span><span class="pln">gz
cd pcre</span><span class="pun">-</span><span class="lit">8.42</span><span class="pun">/</span>
<span class="pun">./</span><span class="pln">configure </span><span class="pun">--</span><span class="pln">prefix</span><span class="pun">=</span><span class="str">/usr/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">pcre</span><span class="pun">-</span><span class="lit">8.42</span><span class="pun">/</span><span class="pln">
make </span><span class="pun">&&</span><span class="pln"> make install
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">pcre</span><span class="pun">-</span><span class="lit">8.42</span><span class="str">/ /</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">pcre
rm </span><span class="pun">-</span><span class="pln">rf pcre</span><span class="pun">-</span><span class="lit">8.42</span>

1.8、内存管理优化工具(可以不装,也可以二选一)

1.8.1、安装Jemalloc

<span class="com">#下载地址:https://github.com/jemalloc/jemalloc/releases</span>
<span class="com">#工具包 https://gitee.com/bbhsky/Centos7-setup.git</span><span class="pln">
tar jxvf jemalloc</span><span class="pun">-</span><span class="lit">5.1</span><span class="pun">.</span><span class="lit">0.tar</span><span class="pun">.</span><span class="pln">bz2
cd jemalloc</span><span class="pun">-</span><span class="lit">5.1</span><span class="pun">.</span><span class="lit">0</span><span class="pun">/</span>
<span class="pun">./</span><span class="pln">configure
make </span><span class="pun">&&</span><span class="pln"> make install
ldconfig
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">libjemalloc</span><span class="pun">*</span> <span class="str">/usr/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">
rm </span><span class="pun">-</span><span class="pln">rf jemalloc</span><span class="pun">-</span><span class="lit">5.1</span><span class="pun">.</span><span class="lit">0</span>

1.8.2、安装TCMalloc(TCMalloc是gperftools的一个插件,所以直接安装gperftools即可)

因为gperftools需要libunwind,我们先来安装libunwind。

1.8.2.1、安装libunwind

<span class="com">#下载地址:http://download.savannah.gnu.org/releases/libunwind/</span>
<span class="com">#工具包 https://gitee.com/bbhsky/Centos7-setup.git</span><span class="pln">
tar zxvf libunwind</span><span class="pun">-</span><span class="lit">1.2</span><span class="pun">.</span><span class="pln">tar</span><span class="pun">.</span><span class="pln">gz
cd libunwind</span><span class="pun">-</span><span class="lit">1.2</span><span class="pun">/</span><span class="pln">
CFLAGS</span><span class="pun">=-</span><span class="pln">fPIC </span><span class="pun">./</span><span class="pln">configure
make CFLAGS</span><span class="pun">=-</span><span class="pln">fPIC
make CFLAGS</span><span class="pun">=-</span><span class="pln">fPIC install
rm </span><span class="pun">-</span><span class="pln">rf libunwind</span><span class="pun">-</span><span class="lit">1.2</span>

1.8.2.2、安装gperftools

<span class="com">#下载地址:https://github.com/gperftools/gperftools.git</span>
<span class="com">#工具包 https://gitee.com/bbhsky/Centos7-setup.git</span>
<span class="com">#使用Git库安装</span><span class="pln">
git clone https</span><span class="pun">:</span><span class="com">//github.com/gperftools/gperftools.git</span>
<span class="com">#或用工具包内文件安装</span><span class="pln">
tar zxvf gperftools</span><span class="pun">-</span><span class="lit">2.7</span><span class="pun">.</span><span class="pln">tar</span><span class="pun">.</span><span class="pln">gz
cd gperftools</span><span class="pun">-</span><span class="lit">2.7</span><span class="pun">/</span>
<span class="com">#判断系统是32还是64位</span><span class="pln">
getconf LONG_BIT
</span><span class="pun">./</span><span class="pln">autogen</span><span class="pun">.</span><span class="pln">sh
</span><span class="com">#如果64位执行</span>
<span class="pun">./</span><span class="pln">configure
</span><span class="com">#如果是32位执行</span>
<span class="pun">./</span><span class="pln">configure </span><span class="pun">--</span><span class="pln">enable</span><span class="pun">-</span><span class="pln">frame</span><span class="pun">-</span><span class="pln">pointers
make
make install
ldconfig
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">libtcmalloc</span><span class="pun">*</span> <span class="str">/usr/</span><span class="pln">lib</span><span class="pun">/</span>

<span class="pun">=================</span><span class="typ">Nginx</span><span class="pun">配置====================</span><span class="pln">
mkdir </span><span class="pun">/</span><span class="pln">tmp</span><span class="pun">/</span><span class="pln">tcmalloc
chown </span><span class="pun">-</span><span class="pln">R www</span><span class="pun">:</span><span class="pln">www </span><span class="pun">/</span><span class="pln">tmp</span><span class="pun">/</span><span class="pln">tcmalloc
sed </span><span class="pun">-</span><span class="pln">i </span><span class="str">'/nginx.pid/a\
google_perftools_profiles /tmp/tcmalloc;'</span> <span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">nginx</span><span class="pun">/</span><span class="pln">conf</span><span class="pun">/</span><span class="pln">nginx</span><span class="pun">.</span><span class="pln">conf</span>

1.9、安装openssl

<span class="com">#下载地址:https://www.openssl.org/source/snapshot/</span>
<span class="com">#工具包 https://gitee.com/bbhsky/Centos7-setup.git</span><span class="pln">
tar zxvf openssl</span><span class="pun">-</span><span class="lit">1.1</span><span class="pun">.</span><span class="lit">0</span><span class="pun">-</span><span class="pln">stable</span><span class="pun">-</span><span class="pln">SNAP</span><span class="pun">-</span><span class="lit">20180901.tar</span><span class="pun">.</span><span class="pln">gz
</span><span class="pun">./</span><span class="pln">config </span><span class="pun">-</span><span class="pln">fPIC </span><span class="pun">--</span><span class="pln">prefix</span><span class="pun">=</span><span class="str">/usr/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">openssl</span><span class="pun">-</span><span class="lit">1.1</span><span class="pun">.</span><span class="lit">0</span> <span class="pun">--</span><span class="pln">openssldir</span><span class="pun">=</span><span class="str">/usr/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">openssl</span><span class="pun">-</span><span class="lit">1.1</span><span class="pun">.</span><span class="lit">0</span><span class="pln">
perl configdata</span><span class="pun">.</span><span class="pln">pm </span><span class="pun">--</span><span class="kwd">dump</span><span class="pln">
make depend </span><span class="pun">&&</span><span class="pln"> make </span><span class="pun">&&</span><span class="pln"> make install
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">openssl</span><span class="pun">-</span><span class="lit">1.1</span><span class="pun">.</span><span class="lit">0</span><span class="str">/ /</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">openssl
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">openssl</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">libssl</span><span class="pun">.</span><span class="pln">so</span><span class="pun">.</span><span class="lit">1.1</span> <span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">libssl</span><span class="pun">.</span><span class="pln">so</span><span class="pun">.</span><span class="lit">1.1</span><span class="pln">
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">openssl</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">libssl</span><span class="pun">.</span><span class="pln">so</span><span class="pun">.</span><span class="lit">1.1</span> <span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">lib64</span><span class="pun">/</span><span class="pln">libssl</span><span class="pun">.</span><span class="pln">so</span><span class="pun">.</span><span class="lit">1.1</span><span class="pln">
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">openssl</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">libcrypto</span><span class="pun">.</span><span class="pln">so</span><span class="pun">.</span><span class="lit">1.1</span> <span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">libcrypto</span><span class="pun">.</span><span class="pln">so</span><span class="pun">.</span><span class="lit">1.1</span><span class="pln">
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">openssl</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">libcrypto</span><span class="pun">.</span><span class="pln">so</span><span class="pun">.</span><span class="lit">1.1</span> <span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">lib64</span><span class="pun">/</span><span class="pln">libcrypto</span><span class="pun">.</span><span class="pln">so</span><span class="pun">.</span><span class="lit">1.1</span><span class="pln">
rm </span><span class="pun">-</span><span class="pln">rf openssl</span><span class="pun">-</span><span class="lit">1.1</span><span class="pun">.</span><span class="lit">0</span><span class="pun">-</span><span class="pln">stable</span><span class="pun">-</span><span class="pln">SNAP</span><span class="pun">-</span><span class="lit">20180901</span>

1.10、安装Crul

<span class="com">#下载地址:https://curl.haxx.se/download.html</span>
<span class="com">#工具包 https://gitee.com/bbhsky/Centos7-setup.git</span><span class="pln">
tar zxvf curl</span><span class="pun">-</span><span class="lit">7.61</span><span class="pun">.</span><span class="lit">0.tar</span><span class="pun">.</span><span class="pln">gz
cd curl</span><span class="pun">-</span><span class="lit">7.61</span><span class="pun">.</span><span class="lit">0</span><span class="pun">/</span>
<span class="pun">./</span><span class="pln">configure </span><span class="pun">--</span><span class="pln">prefix</span><span class="pun">=</span><span class="str">/usr/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">curl</span><span class="pun">-</span><span class="lit">7.61</span><span class="pun">.</span><span class="lit">0</span> <span class="pun">--</span><span class="pln">enable</span><span class="pun">-</span><span class="pln">ares </span><span class="pun">--</span><span class="pln">without</span><span class="pun">-</span><span class="pln">nss </span><span class="pun">--</span><span class="kwd">with</span><span class="pun">-</span><span class="pln">ssl</span><span class="pun">=</span><span class="str">/usr/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">openssl
make </span><span class="pun">&&</span><span class="pln"> make install
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">curl</span><span class="pun">-</span><span class="lit">7.65</span><span class="pun">.</span><span class="lit">1</span><span class="str">/ /</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">curl
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">curl</span><span class="pun">/</span><span class="pln">bin</span><span class="com">/* /usr/bin/
rm -rf curl-7.61.0</span>

备注:安装Crul的时候有可能提示:configure: error: c-ares library defective or too old

这里升级安装c-ares

<span class="com">#下载地址:https://c-ares.haxx.se/download/</span>
<span class="com">#工具包 https://gitee.com/bbhsky/Centos7-setup.git</span><span class="pln">
tar zxvf c</span><span class="pun">-</span><span class="pln">ares</span><span class="pun">-</span><span class="lit">1.14</span><span class="pun">.</span><span class="lit">0.tar</span><span class="pun">.</span><span class="pln">gz
cd c</span><span class="pun">-</span><span class="pln">ares</span><span class="pun">-</span><span class="lit">1.14</span><span class="pun">.</span><span class="lit">0</span><span class="pun">/</span><span class="pln">
ll
</span><span class="pun">./</span><span class="pln">configure </span><span class="pun">--</span><span class="pln">prefix</span><span class="pun">=</span><span class="str">/usr/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">c</span><span class="pun">-</span><span class="pln">ares</span><span class="pun">-</span><span class="lit">1.14</span><span class="pun">.</span><span class="lit">0</span><span class="pln">
make
make install
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">c</span><span class="pun">-</span><span class="pln">ares</span><span class="pun">-</span><span class="lit">1.14</span><span class="pun">.</span><span class="lit">0</span><span class="str">/ /</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">c</span><span class="pun">-</span><span class="pln">ares
rm </span><span class="pun">-</span><span class="pln">rf c</span><span class="pun">-</span><span class="pln">ares</span><span class="pun">-</span><span class="lit">1.14</span><span class="pun">.</span><span class="lit">0</span>
<span class="com">#安装的时候需要    --enable-ares=/usr/local/c-ares/</span>

1.11、安装Nghttp2

<span class="com">#下载地址:https://github.com/nghttp2/nghttp2/releases</span>
<span class="com">#工具包 https://gitee.com/bbhsky/Centos7-setup.git</span><span class="pln">
tar </span><span class="typ">Jxvf</span><span class="pln"> nghttp2</span><span class="pun">-</span><span class="lit">1.33</span><span class="pun">.</span><span class="lit">0.tar</span><span class="pun">.</span><span class="pln">xz
cd nghttp2</span><span class="pun">-</span><span class="lit">1.33</span><span class="pun">.</span><span class="lit">0</span><span class="pun">/</span>
<span class="pun">./</span><span class="pln">configure </span><span class="pun">--</span><span class="pln">prefix</span><span class="pun">=</span><span class="str">/usr/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">nghttp2</span><span class="pun">-</span><span class="lit">1.33</span><span class="pun">.</span><span class="lit">0</span><span class="pln">
make </span><span class="pun">&&</span><span class="pln"> make install
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">nghttp2</span><span class="pun">-</span><span class="lit">1.33</span><span class="pun">.</span><span class="lit">0</span><span class="str">/ /</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">nghttp2
rm </span><span class="pun">-</span><span class="pln">rf nghttp2</span><span class="pun">-</span><span class="lit">1.33</span><span class="pun">.</span><span class="lit">0</span>

1.12、安装boots(安装MySQL5.7和MySQL8.0需要)

<span class="com">#下载地址:https://www.boost.org/users/download/</span>
<span class="com">#工具包 https://gitee.com/bbhsky/Centos7-setup.git</span>

<span class="com">#解压即可</span><span class="pln">
tar zxvf boost_1_68_0</span><span class="pun">.</span><span class="pln">tar</span><span class="pun">.</span><span class="pln">gz
</span><span class="com">#MySQL5.7如果报错请测试低版本,比如1.59</span><span class="pln">
tar zxvf boost_1_59_0</span><span class="pun">.</span><span class="pln">tar</span><span class="pun">.</span><span class="pln">gz</span>

2、系统环境设置

2.1、设置虚拟内存

<span class="com">#其他建议设置成无限制(unlimited)的一些重要设置是: </span>
<span class="com">#数据段长度:ulimit -d unlimited </span>
<span class="com">#最大内存大小:ulimit -m unlimited </span>
<span class="com">#堆栈大小:ulimit -s unlimited </span>
<span class="com">#CPU 时间:ulimit -t unlimited </span>
<span class="pun">虚拟内存:</span><span class="pln">ulimit </span><span class="pun">-</span><span class="pln">v unlimited </span><span class="com">#建议设置</span>

2.2、设置libpng和libjpeg

<span class="com">#64位</span><span class="pln">
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">lib64</span><span class="pun">/</span><span class="pln">libpng</span><span class="pun">.*</span> <span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">lib64</span><span class="pun">/</span><span class="pln">libjpeg</span><span class="pun">.*</span> <span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span>

2.3、加载新的lib库

<span class="pln">echo </span><span class="str">"/lib"</span> <span class="pun">>></span> <span class="str">/etc/</span><span class="pln">ld</span><span class="pun">.</span><span class="pln">so</span><span class="pun">.</span><span class="pln">conf
echo </span><span class="str">"/usr/lib"</span> <span class="pun">>></span> <span class="str">/etc/</span><span class="pln">ld</span><span class="pun">.</span><span class="pln">so</span><span class="pun">.</span><span class="pln">conf
echo </span><span class="str">"/usr/lib64"</span> <span class="pun">>></span> <span class="str">/etc/</span><span class="pln">ld</span><span class="pun">.</span><span class="pln">so</span><span class="pun">.</span><span class="pln">conf
echo </span><span class="str">"/usr/local/lib"</span> <span class="pun">>></span> <span class="str">/etc/</span><span class="pln">ld</span><span class="pun">.</span><span class="pln">so</span><span class="pun">.</span><span class="pln">conf
ldconfig</span>

2.4、配置limits.conf

<span class="pln">cat </span><span class="pun">>></span><span class="str">/etc/</span><span class="pln">security</span><span class="pun">/</span><span class="pln">limits</span><span class="pun">.</span><span class="pln">conf</span><span class="pun"><<</span><span class="pln">eof
</span><span class="pun">*</span><span class="pln"> soft nproc </span><span class="lit">65535</span>
<span class="pun">*</span><span class="pln"> hard nproc </span><span class="lit">65535</span>
<span class="pun">*</span><span class="pln"> soft nofile </span><span class="lit">65535</span>
<span class="pun">*</span><span class="pln"> hard nofile </span><span class="lit">65535</span><span class="pln">
eof</span>

2.5、配置sysctl.conf

<span class="com">#参数表示进程可以同时打开的最大句柄数,这个参数直接限制最大并发连接数。</span><span class="pln">
echo </span><span class="str">"fs.file-max=65535"</span> <span class="pun">>></span> <span class="str">/etc/</span><span class="pln">sysctl</span><span class="pun">.</span><span class="pln">conf</span>

3、mysql安装

3.1、Docker安装(推荐)

http://www.798vps.com/304.html

3.2、编译安装5.7

<span class="com">#下载地址:https://dev.mysql.com/downloads/mysql/</span>
<span class="com">#工具包 https://gitee.com/bbhsky/MySQL-Setup.git</span><span class="pln">
tar zxvf mysql</span><span class="pun">-</span><span class="lit">5.7</span><span class="pun">.</span><span class="lit">23.tar</span><span class="pun">.</span><span class="pln">gz
tar zxvf boost_1_68_0</span><span class="pun">.</span><span class="pln">tar</span><span class="pun">.</span><span class="pln">gz
cd mysql</span><span class="pun">-</span><span class="lit">5.7</span><span class="pun">.</span><span class="lit">23</span><span class="pun">/</span><span class="pln">
cmake </span><span class="pun">-</span><span class="pln">DCMAKE_INSTALL_PREFIX</span><span class="pun">=</span><span class="str">/usr/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">mysql57 </span><span class="pun">-</span><span class="pln">DSYSCONFDIR</span><span class="pun">=</span><span class="str">/etc -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8mb4 -DDEFAULT_COLLATION=utf8mb4_general_ci -DWITH_EMBEDDED_SERVER=1 -DENABLED_LOCAL_INFILE=1 -DWITH_BOOST=/</span><span class="pln">root</span><span class="pun">/</span><span class="pln">src</span><span class="pun">/</span><span class="typ">MySQL</span><span class="pun">-</span><span class="typ">Setup</span><span class="pun">/</span><span class="pln">boost_1_59_0</span><span class="pun">/</span><span class="pln">
make </span><span class="pun">&&</span><span class="pln"> make install
groupadd mysql
useradd </span><span class="pun">-</span><span class="pln">s </span><span class="pun">/</span><span class="pln">sbin</span><span class="pun">/</span><span class="pln">nologin </span><span class="pun">-</span><span class="pln">M </span><span class="pun">-</span><span class="pln">g mysql mysql
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">mysql57</span><span class="str">/ /</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">mysql
cp conf</span><span class="pun">/</span><span class="pln">mysql57</span><span class="pun">-</span><span class="lit">2048.cnf</span> <span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="kwd">my</span><span class="pun">.</span><span class="pln">cnf </span><span class="com">#复制优化过的内存的配置文件</span>
<span class="com">#或生成配置文件</span><span class="pln">
cat </span><span class="pun">></span> <span class="str">/etc/</span><span class="kwd">my</span><span class="pun">.</span><span class="pln">cnf</span><span class="pun"><<</span><span class="pln">EOF
</span><span class="pun">[</span><span class="pln">client</span><span class="pun">]</span>
<span class="com">#password   = your_password</span><span class="pln">
port        </span><span class="pun">=</span> <span class="lit">3306</span><span class="pln">
socket      </span><span class="pun">=</span> <span class="str">/tmp/</span><span class="pln">mysql</span><span class="pun">.</span><span class="pln">sock
</span><span class="pun">[</span><span class="pln">mysqld</span><span class="pun">]</span><span class="pln">
port        </span><span class="pun">=</span> <span class="lit">3306</span><span class="pln">
socket      </span><span class="pun">=</span> <span class="str">/tmp/</span><span class="pln">mysql</span><span class="pun">.</span><span class="pln">sock
datadir </span><span class="pun">=</span> <span class="str">/usr/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">mysql</span><span class="pun">/</span><span class="kwd">var</span><span class="pln">
skip</span><span class="pun">-</span><span class="pln">external</span><span class="pun">-</span><span class="pln">locking
key_buffer_size </span><span class="pun">=</span> <span class="lit">16M</span><span class="pln">
max_allowed_packet </span><span class="pun">=</span> <span class="lit">1M</span><span class="pln">
table_open_cache </span><span class="pun">=</span> <span class="lit">64</span><span class="pln">
sort_buffer_size </span><span class="pun">=</span> <span class="lit">512K</span><span class="pln">
net_buffer_length </span><span class="pun">=</span> <span class="lit">8K</span><span class="pln">
read_buffer_size </span><span class="pun">=</span> <span class="lit">256K</span><span class="pln">
read_rnd_buffer_size </span><span class="pun">=</span> <span class="lit">512K</span><span class="pln">
myisam_sort_buffer_size </span><span class="pun">=</span> <span class="lit">8M</span><span class="pln">
thread_cache_size </span><span class="pun">=</span> <span class="lit">8</span><span class="pln">
query_cache_size </span><span class="pun">=</span> <span class="lit">8M</span><span class="pln">
tmp_table_size </span><span class="pun">=</span> <span class="lit">16M</span><span class="pln">
performance_schema_max_table_instances </span><span class="pun">=</span> <span class="lit">500</span><span class="pln">
explicit_defaults_for_timestamp </span><span class="pun">=</span> <span class="kwd">true</span>
<span class="com">#skip-networking</span><span class="pln">
max_connections </span><span class="pun">=</span> <span class="lit">500</span><span class="pln">
max_connect_errors </span><span class="pun">=</span> <span class="lit">100</span><span class="pln">
open_files_limit </span><span class="pun">=</span> <span class="lit">65535</span><span class="pln">
log</span><span class="pun">-</span><span class="pln">bin</span><span class="pun">=</span><span class="pln">mysql</span><span class="pun">-</span><span class="pln">bin
binlog_format</span><span class="pun">=</span><span class="pln">mixed
server</span><span class="pun">-</span><span class="pln">id   </span><span class="pun">=</span> <span class="lit">1</span><span class="pln">
expire_logs_days </span><span class="pun">=</span> <span class="lit">10</span><span class="pln">
early</span><span class="pun">-</span><span class="pln">plugin</span><span class="pun">-</span><span class="pln">load </span><span class="pun">=</span> <span class="str">""</span><span class="pln">
default_storage_engine </span><span class="pun">=</span> <span class="typ">InnoDB</span><span class="pln">
innodb_file_per_table </span><span class="pun">=</span> <span class="lit">1</span><span class="pln">
innodb_data_home_dir </span><span class="pun">=</span> <span class="str">/usr/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">mysql</span><span class="pun">/</span><span class="kwd">var</span><span class="pln">
innodb_data_file_path </span><span class="pun">=</span><span class="pln"> ibdata1</span><span class="pun">:</span><span class="lit">10M</span><span class="pun">:</span><span class="pln">autoextend
innodb_log_group_home_dir </span><span class="pun">=</span> <span class="str">/usr/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">mysql</span><span class="pun">/</span><span class="kwd">var</span><span class="pln">
innodb_buffer_pool_size </span><span class="pun">=</span> <span class="lit">16M</span><span class="pln">
innodb_log_file_size </span><span class="pun">=</span> <span class="lit">5M</span><span class="pln">
innodb_log_buffer_size </span><span class="pun">=</span> <span class="lit">8M</span><span class="pln">
innodb_flush_log_at_trx_commit </span><span class="pun">=</span> <span class="lit">1</span><span class="pln">
innodb_lock_wait_timeout </span><span class="pun">=</span> <span class="lit">50</span>
<span class="pun">[</span><span class="pln">mysqldump</span><span class="pun">]</span><span class="pln">
quick
max_allowed_packet </span><span class="pun">=</span> <span class="lit">16M</span>
<span class="pun">[</span><span class="pln">mysql</span><span class="pun">]</span>
<span class="kwd">no</span><span class="pun">-</span><span class="kwd">auto</span><span class="pun">-</span><span class="pln">rehash
</span><span class="pun">[</span><span class="pln">myisamchk</span><span class="pun">]</span><span class="pln">
key_buffer_size </span><span class="pun">=</span> <span class="lit">20M</span><span class="pln">
sort_buffer_size </span><span class="pun">=</span> <span class="lit">20M</span><span class="pln">
read_buffer </span><span class="pun">=</span> <span class="lit">2M</span><span class="pln">
write_buffer </span><span class="pun">=</span> <span class="lit">2M</span>
<span class="pun">[</span><span class="pln">mysqlhotcopy</span><span class="pun">]</span><span class="pln">
interactive</span><span class="pun">-</span><span class="pln">timeout
$</span><span class="pun">{</span><span class="typ">MySQLMAOpt</span><span class="pun">}</span><span class="pln">
EOF

</span><span class="com">#如果需要开启Innodb</span><span class="pln">
sed </span><span class="pun">-</span><span class="pln">i </span><span class="str">'s/^#innodb/innodb/g'</span> <span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="kwd">my</span><span class="pun">.</span><span class="pln">cnf
</span><span class="com">#如果不开启Innodb</span><span class="pln">
sed </span><span class="pun">-</span><span class="pln">i </span><span class="str">'/^default_storage_engine/d'</span> <span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="kwd">my</span><span class="pun">.</span><span class="pln">cnf
sed </span><span class="pun">-</span><span class="pln">i </span><span class="str">'s#default_storage_engine.*#default_storage_engine = MyISAM#'</span> <span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="kwd">my</span><span class="pun">.</span><span class="pln">cnf

mkdir </span><span class="pun">-</span><span class="pln">p </span><span class="pun">/</span><span class="pln">home</span><span class="pun">/</span><span class="pln">mysql</span><span class="pun">/</span><span class="kwd">var</span><span class="pln">
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">home</span><span class="pun">/</span><span class="pln">mysql</span><span class="pun">/</span><span class="kwd">var</span> <span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">mysql</span><span class="pun">/</span><span class="kwd">var</span><span class="pln">
chown </span><span class="pun">-</span><span class="pln">R mysql</span><span class="pun">:</span><span class="pln">mysql </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">mysql</span><span class="pun">/</span><span class="kwd">var</span><span class="pln">
chown </span><span class="pun">-</span><span class="pln">R mysql</span><span class="pun">:</span><span class="pln">mysql </span><span class="pun">/</span><span class="pln">home</span><span class="pun">/</span><span class="pln">mysql</span><span class="pun">/</span><span class="kwd">var</span>
<span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">mysql</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">mysqld </span><span class="pun">--</span><span class="pln">initialize</span><span class="pun">-</span><span class="pln">insecure </span><span class="pun">--</span><span class="pln">basedir</span><span class="pun">=</span><span class="str">/usr/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">mysql </span><span class="pun">--</span><span class="pln">datadir</span><span class="pun">=</span><span class="str">/usr/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">mysql</span><span class="pun">/</span><span class="kwd">var</span> <span class="pun">--</span><span class="pln">user</span><span class="pun">=</span><span class="pln">mysql
chgrp </span><span class="pun">-</span><span class="pln">R mysql </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">mysql</span><span class="pun">/.</span><span class="pln">
cp </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">mysql</span><span class="pun">/</span><span class="pln">support</span><span class="pun">-</span><span class="pln">files</span><span class="pun">/</span><span class="pln">mysql</span><span class="pun">.</span><span class="pln">server </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">init</span><span class="pun">.</span><span class="pln">d</span><span class="pun">/</span><span class="pln">mysql
chmod </span><span class="lit">755</span> <span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">init</span><span class="pun">.</span><span class="pln">d</span><span class="pun">/</span><span class="pln">mysql
cat </span><span class="pun">></span> <span class="str">/etc/</span><span class="pln">ld</span><span class="pun">.</span><span class="pln">so</span><span class="pun">.</span><span class="pln">conf</span><span class="pun">.</span><span class="pln">d</span><span class="pun">/</span><span class="pln">mysql</span><span class="pun">.</span><span class="pln">conf</span><span class="pun"><<</span><span class="pln">EOF
</span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">mysql</span><span class="pun">/</span><span class="pln">lib
</span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">lib
EOF
ldconfig
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">mysql</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">mysql </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">mysql
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">mysql</span><span class="pun">/</span><span class="pln">include</span><span class="pun">/</span><span class="pln">mysql </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">include</span><span class="pun">/</span><span class="pln">mysql
systemctl enable mysql</span><span class="pun">.</span><span class="pln">service
</span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">init</span><span class="pun">.</span><span class="pln">d</span><span class="pun">/</span><span class="pln">mysql start
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">mysql</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">mysql </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">mysql
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">mysql</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">mysqldump </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">mysqldump
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">mysql</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">myisamchk </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">myisamchk
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">mysql</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">mysqld_safe </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">mysqld_safe
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">mysql</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">mysqlcheck </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">mysqlcheck
</span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">init</span><span class="pun">.</span><span class="pln">d</span><span class="pun">/</span><span class="pln">mysql restart
</span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">mysql</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">mysqladmin </span><span class="pun">-</span><span class="pln">u root password </span><span class="str">"password"</span>
<span class="com">#优化数据库</span><span class="pln">
mysql </span><span class="pun">-</span><span class="pln">uroot </span><span class="pun">-</span><span class="pln">p
mysql</span><span class="pun">></span><span class="pln"> DELETE FROM mysql</span><span class="pun">.</span><span class="pln">user WHERE </span><span class="typ">User</span><span class="pun">=</span><span class="str">''</span><span class="pun">;</span><span class="pln">
mysql</span><span class="pun">></span><span class="pln"> DELETE FROM mysql</span><span class="pun">.</span><span class="pln">user WHERE </span><span class="typ">User</span><span class="pun">=</span><span class="str">'root'</span><span class="pln"> AND </span><span class="typ">Host</span><span class="pln"> NOT IN </span><span class="pun">(</span><span class="str">'localhost'</span><span class="pun">,</span> <span class="str">'127.0.0.1'</span><span class="pun">,</span> <span class="str">'::1'</span><span class="pun">);</span><span class="pln">
mysql</span><span class="pun">></span><span class="pln"> DROP DATABASE test</span><span class="pun">;</span><span class="pln">
mysql</span><span class="pun">></span><span class="pln"> FLUSH PRIVILEGES</span><span class="pun">;</span>
<span class="str">/etc/</span><span class="pln">init</span><span class="pun">.</span><span class="pln">d</span><span class="pun">/</span><span class="pln">mysql restart</span>

4、编译安装php

4.1、安装编译7.2

<span class="com">#下载地址:http://php.net/</span>
<span class="com">#工具包 git@gitee.com:bbhsky/PHP-Setup.git</span><span class="pln">
tar jxvf php</span><span class="pun">-</span><span class="lit">7.2</span><span class="pun">.</span><span class="lit">9.tar</span><span class="pun">.</span><span class="pln">bz2
cd php</span><span class="pun">-</span><span class="lit">7.2</span><span class="pun">.</span><span class="lit">9</span><span class="pun">/</span>
<span class="pun">./</span><span class="pln">configure </span><span class="pun">--</span><span class="pln">prefix</span><span class="pun">=</span><span class="str">/usr/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">php</span><span class="pun">-</span><span class="lit">7.2</span><span class="pun">.</span><span class="lit">9</span> <span class="pun">--</span><span class="kwd">with</span><span class="pun">-</span><span class="pln">config</span><span class="pun">-</span><span class="pln">file</span><span class="pun">-</span><span class="pln">path</span><span class="pun">=</span><span class="str">/usr/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">php</span><span class="pun">-</span><span class="lit">7.2</span><span class="pun">.</span><span class="lit">9</span><span class="pun">/</span><span class="pln">etc </span><span class="pun">--</span><span class="kwd">with</span><span class="pun">-</span><span class="pln">config</span><span class="pun">-</span><span class="pln">file</span><span class="pun">-</span><span class="pln">scan</span><span class="pun">-</span><span class="pln">dir</span><span class="pun">=</span><span class="str">/usr/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">php</span><span class="pun">-</span><span class="lit">7.2</span><span class="pun">.</span><span class="lit">9</span><span class="pun">/</span><span class="pln">conf</span><span class="pun">.</span><span class="pln">d </span><span class="pun">--</span><span class="pln">enable</span><span class="pun">-</span><span class="pln">fpm </span><span class="pun">--</span><span class="kwd">with</span><span class="pun">-</span><span class="pln">fpm</span><span class="pun">-</span><span class="pln">user</span><span class="pun">=</span><span class="pln">www </span><span class="pun">--</span><span class="kwd">with</span><span class="pun">-</span><span class="pln">fpm</span><span class="pun">-</span><span class="kwd">group</span><span class="pun">=</span><span class="pln">www </span><span class="pun">--</span><span class="pln">enable</span><span class="pun">-</span><span class="pln">mysqlnd </span><span class="pun">--</span><span class="kwd">with</span><span class="pun">-</span><span class="pln">mysqli</span><span class="pun">=</span><span class="pln">mysqlnd </span><span class="pun">--</span><span class="kwd">with</span><span class="pun">-</span><span class="pln">pdo</span><span class="pun">-</span><span class="pln">mysql</span><span class="pun">=</span><span class="pln">mysqlnd </span><span class="pun">--</span><span class="kwd">with</span><span class="pun">-</span><span class="pln">iconv</span><span class="pun">-</span><span class="pln">dir</span><span class="pun">=</span><span class="str">/usr/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">libiconv </span><span class="pun">--</span><span class="kwd">with</span><span class="pun">-</span><span class="pln">freetype</span><span class="pun">-</span><span class="pln">dir</span><span class="pun">=</span><span class="str">/usr/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">freetype </span><span class="pun">--</span><span class="kwd">with</span><span class="pun">-</span><span class="pln">jpeg</span><span class="pun">-</span><span class="pln">dir </span><span class="pun">--</span><span class="kwd">with</span><span class="pun">-</span><span class="pln">png</span><span class="pun">-</span><span class="pln">dir </span><span class="pun">--</span><span class="kwd">with</span><span class="pun">-</span><span class="pln">zlib </span><span class="pun">--</span><span class="kwd">with</span><span class="pun">-</span><span class="pln">libxml</span><span class="pun">-</span><span class="pln">dir</span><span class="pun">=</span><span class="str">/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl=/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">curl </span><span class="pun">--</span><span class="pln">enable</span><span class="pun">-</span><span class="pln">mbregex </span><span class="pun">--</span><span class="pln">enable</span><span class="pun">-</span><span class="pln">mbstring </span><span class="pun">--</span><span class="pln">enable</span><span class="pun">-</span><span class="pln">intl </span><span class="pun">--</span><span class="pln">enable</span><span class="pun">-</span><span class="pln">pcntl </span><span class="pun">--</span><span class="pln">enable</span><span class="pun">-</span><span class="pln">ftp </span><span class="pun">--</span><span class="kwd">with</span><span class="pun">-</span><span class="pln">gd </span><span class="pun">--</span><span class="kwd">with</span><span class="pun">-</span><span class="pln">openssl</span><span class="pun">=</span><span class="str">/usr/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">openssl </span><span class="pun">--</span><span class="kwd">with</span><span class="pun">-</span><span class="pln">mhash </span><span class="pun">--</span><span class="pln">enable</span><span class="pun">-</span><span class="pln">pcntl </span><span class="pun">--</span><span class="pln">enable</span><span class="pun">-</span><span class="pln">sockets </span><span class="pun">--</span><span class="kwd">with</span><span class="pun">-</span><span class="pln">xmlrpc </span><span class="pun">--</span><span class="pln">enable</span><span class="pun">-</span><span class="pln">zip </span><span class="pun">--</span><span class="pln">enable</span><span class="pun">-</span><span class="pln">soap </span><span class="pun">--</span><span class="kwd">with</span><span class="pun">-</span><span class="pln">gettext </span><span class="pun">--</span><span class="pln">disable</span><span class="pun">-</span><span class="pln">fileinfo </span><span class="pun">--</span><span class="pln">enable</span><span class="pun">-</span><span class="pln">opcache </span><span class="pun">--</span><span class="kwd">with</span><span class="pun">-</span><span class="pln">xsl </span><span class="pun">--</span><span class="kwd">with</span><span class="pun">-</span><span class="pln">libzip
make ZEND_EXTRA_LIBS</span><span class="pun">=</span><span class="str">'-liconv'</span> <span class="pun">-</span><span class="pln">j </span><span class="str">`grep 'processor' /proc/cpuinfo | wc -l`</span><span class="pln">
make install
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">php</span><span class="pun">-</span><span class="lit">7.2</span><span class="pun">.</span><span class="lit">9</span><span class="str">/ /</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">php
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">php</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">php </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">php
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">php</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">phpize </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">phpize
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">php</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">pear </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">pear
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">php</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">pecl </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">pecl
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">php</span><span class="pun">/</span><span class="pln">sbin</span><span class="pun">/</span><span class="pln">php</span><span class="pun">-</span><span class="pln">fpm </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">php</span><span class="pun">-</span><span class="pln">fpm
mkdir </span><span class="pun">-</span><span class="pln">p </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">php</span><span class="pun">/</span><span class="pln">conf</span><span class="pun">.</span><span class="pln">d
mkdir </span><span class="pun">-</span><span class="pln">p </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">php</span><span class="pun">/</span><span class="pln">etc
cp php</span><span class="pun">.</span><span class="pln">ini</span><span class="pun">-</span><span class="pln">production </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">php</span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">php</span><span class="pun">.</span><span class="pln">ini
sed </span><span class="pun">-</span><span class="pln">i </span><span class="str">'s/post_max_size =.*/post_max_size = 50M/g'</span> <span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">php</span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">php</span><span class="pun">.</span><span class="pln">ini
sed </span><span class="pun">-</span><span class="pln">i </span><span class="str">'s/upload_max_filesize =.*/upload_max_filesize = 50M/g'</span> <span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">php</span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">php</span><span class="pun">.</span><span class="pln">ini
sed </span><span class="pun">-</span><span class="pln">i </span><span class="str">'s/;date.timezone =.*/date.timezone = PRC/g'</span> <span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">php</span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">php</span><span class="pun">.</span><span class="pln">ini
sed </span><span class="pun">-</span><span class="pln">i </span><span class="str">'s/short_open_tag =.*/short_open_tag = On/g'</span> <span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">php</span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">php</span><span class="pun">.</span><span class="pln">ini
sed </span><span class="pun">-</span><span class="pln">i </span><span class="str">'s/;cgi.fix_pathinfo=.*/cgi.fix_pathinfo=0/g'</span> <span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">php</span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">php</span><span class="pun">.</span><span class="pln">ini
sed </span><span class="pun">-</span><span class="pln">i </span><span class="str">'s/max_execution_time =.*/max_execution_time = 300/g'</span> <span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">php</span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">php</span><span class="pun">.</span><span class="pln">ini
sed </span><span class="pun">-</span><span class="pln">i </span><span class="str">'s/disable_functions =.*/disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,popen,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server/g'</span> <span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">php</span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">php</span><span class="pun">.</span><span class="pln">ini
pear config</span><span class="pun">-</span><span class="kwd">set</span><span class="pln"> php_ini </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">php</span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">php</span><span class="pun">.</span><span class="pln">ini
pecl config</span><span class="pun">-</span><span class="kwd">set</span><span class="pln"> php_ini </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">php</span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">php</span><span class="pun">.</span><span class="pln">ini
curl </span><span class="pun">-</span><span class="pln">sS </span><span class="pun">--</span><span class="pln">connect</span><span class="pun">-</span><span class="pln">timeout </span><span class="lit">30</span> <span class="pun">-</span><span class="pln">m </span><span class="lit">60</span><span class="pln"> https</span><span class="pun">:</span><span class="com">//getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer</span>
<span class="com">#写入配置文件</span><span class="pln">
cat </span><span class="pun">></span><span class="str">/usr/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">php</span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">php</span><span class="pun">-</span><span class="pln">fpm</span><span class="pun">.</span><span class="pln">conf</span><span class="pun"><<</span><span class="pln">EOF
</span><span class="pun">[</span><span class="kwd">global</span><span class="pun">]</span><span class="pln">
pid </span><span class="pun">=</span> <span class="str">/usr/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">php</span><span class="pun">/</span><span class="kwd">var</span><span class="pun">/</span><span class="pln">run</span><span class="pun">/</span><span class="pln">php</span><span class="pun">-</span><span class="pln">fpm</span><span class="pun">.</span><span class="pln">pid
error_log </span><span class="pun">=</span> <span class="str">/usr/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">php</span><span class="pun">/</span><span class="kwd">var</span><span class="pun">/</span><span class="pln">log</span><span class="pun">/</span><span class="pln">php</span><span class="pun">-</span><span class="pln">fpm</span><span class="pun">.</span><span class="pln">log
log_level </span><span class="pun">=</span><span class="pln"> notice
</span><span class="pun">[</span><span class="pln">www</span><span class="pun">]</span><span class="pln">
listen </span><span class="pun">=</span> <span class="str">/tmp/</span><span class="pln">php</span><span class="pun">-</span><span class="pln">cgi</span><span class="pun">.</span><span class="pln">sock
listen</span><span class="pun">.</span><span class="pln">backlog </span><span class="pun">=</span> <span class="pun">-</span><span class="lit">1</span><span class="pln">
listen</span><span class="pun">.</span><span class="pln">allowed_clients </span><span class="pun">=</span> <span class="lit">127.0</span><span class="pun">.</span><span class="lit">0.1</span><span class="pln">
listen</span><span class="pun">.</span><span class="pln">owner </span><span class="pun">=</span><span class="pln"> www
listen</span><span class="pun">.</span><span class="kwd">group</span> <span class="pun">=</span><span class="pln"> www
listen</span><span class="pun">.</span><span class="pln">mode </span><span class="pun">=</span> <span class="lit">0666</span><span class="pln">
user </span><span class="pun">=</span><span class="pln"> www
</span><span class="kwd">group</span> <span class="pun">=</span><span class="pln"> www
pm </span><span class="pun">=</span> <span class="kwd">dynamic</span><span class="pln">
pm</span><span class="pun">.</span><span class="pln">max_children </span><span class="pun">=</span> <span class="lit">10</span><span class="pln">
pm</span><span class="pun">.</span><span class="pln">start_servers </span><span class="pun">=</span> <span class="lit">2</span><span class="pln">
pm</span><span class="pun">.</span><span class="pln">min_spare_servers </span><span class="pun">=</span> <span class="lit">1</span><span class="pln">
pm</span><span class="pun">.</span><span class="pln">max_spare_servers </span><span class="pun">=</span> <span class="lit">6</span><span class="pln">
pm</span><span class="pun">.</span><span class="pln">max_requests </span><span class="pun">=</span> <span class="lit">1024</span><span class="pln">
pm</span><span class="pun">.</span><span class="pln">process_idle_timeout </span><span class="pun">=</span> <span class="lit">10s</span><span class="pln">
request_terminate_timeout </span><span class="pun">=</span> <span class="lit">100</span><span class="pln">
request_slowlog_timeout </span><span class="pun">=</span> <span class="lit">0</span><span class="pln">
slowlog </span><span class="pun">=</span> <span class="kwd">var</span><span class="pun">/</span><span class="pln">log</span><span class="pun">/</span><span class="pln">slow</span><span class="pun">.</span><span class="pln">log
EOF
</span><span class="com">#或者复制配置文件</span><span class="pln">
cp conf</span><span class="pun">/</span><span class="pln">php</span><span class="pun">-</span><span class="pln">fpm</span><span class="pun">-</span><span class="lit">72.conf</span> <span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">php</span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">php</span><span class="pun">-</span><span class="pln">fpm</span><span class="pun">.</span><span class="pln">conf
cp sapi</span><span class="pun">/</span><span class="pln">fpm</span><span class="pun">/</span><span class="pln">init</span><span class="pun">.</span><span class="pln">d</span><span class="pun">.</span><span class="pln">php</span><span class="pun">-</span><span class="pln">fpm </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">init</span><span class="pun">.</span><span class="pln">d</span><span class="pun">/</span><span class="pln">php</span><span class="pun">-</span><span class="pln">fpm
cp sapi</span><span class="pun">/</span><span class="pln">fpm</span><span class="pun">/</span><span class="pln">php</span><span class="pun">-</span><span class="pln">fpm</span><span class="pun">.</span><span class="pln">service </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">systemd</span><span class="pun">/</span><span class="pln">system</span><span class="pun">/</span><span class="pln">php</span><span class="pun">-</span><span class="pln">fpm</span><span class="pun">.</span><span class="pln">service
chmod </span><span class="pun">+</span><span class="pln">x </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">init</span><span class="pun">.</span><span class="pln">d</span><span class="pun">/</span><span class="pln">php</span><span class="pun">-</span><span class="pln">fpm</span>

4.2、安装编译7.3

5、编译安装Nginx

6、设置自启动

<span class="pln">systemctl enable mysql</span><span class="pun">.</span><span class="pln">service
systemctl enable php</span><span class="pun">-</span><span class="pln">fpm</span><span class="pun">.</span><span class="pln">service
systemctl enable nginx</span><span class="pun">.</span><span class="pln">service</span>

7、安装phpmyadmin

<span class="com">#下载地址:https://www.phpmyadmin.net</span>
<span class="com">#工具包 https://gitee.com/bbhsky/PHP-Setup.git</span><span class="pln">
unzip phpMyAdmin</span><span class="pun">-</span><span class="lit">4.8</span><span class="pun">.</span><span class="lit">3</span><span class="pun">-</span><span class="pln">all</span><span class="pun">-</span><span class="pln">languages</span><span class="pun">.</span><span class="pln">zip
mv phpMyAdmin</span><span class="pun">-</span><span class="lit">4.8</span><span class="pun">.</span><span class="lit">3</span><span class="pun">-</span><span class="pln">all</span><span class="pun">-</span><span class="pln">languages </span><span class="pun">/</span><span class="pln">home</span><span class="pun">/</span><span class="pln">wwwroot</span><span class="pun">/</span><span class="kwd">default</span><span class="pun">/</span><span class="pln">phpmyadmin
cp conf</span><span class="pun">/</span><span class="pln">config</span><span class="pun">.</span><span class="pln">inc</span><span class="pun">.</span><span class="pln">php </span><span class="pun">/</span><span class="pln">home</span><span class="pun">/</span><span class="pln">wwwroot</span><span class="pun">/</span><span class="kwd">default</span><span class="pun">/</span><span class="pln">phpmyadmin</span><span class="pun">/</span><span class="pln">config</span><span class="pun">.</span><span class="pln">inc</span><span class="pun">.</span><span class="pln">php
sed </span><span class="pun">-</span><span class="pln">i </span><span class="str">'s/LNMPORG/FoolTiger/g'</span> <span class="pun">/</span><span class="pln">home</span><span class="pun">/</span><span class="pln">wwwroot</span><span class="pun">/</span><span class="kwd">default</span><span class="pun">/</span><span class="pln">phpmyadmin</span><span class="pun">/</span><span class="pln">config</span><span class="pun">.</span><span class="pln">inc</span><span class="pun">.</span><span class="pln">php
mkdir </span><span class="pun">/</span><span class="pln">home</span><span class="pun">/</span><span class="pln">wwwroot</span><span class="pun">/</span><span class="kwd">default</span><span class="pun">/</span><span class="pln">phpmyadmin</span><span class="pun">/</span><span class="pln">upload
mkdir </span><span class="pun">/</span><span class="pln">home</span><span class="pun">/</span><span class="pln">wwwroot</span><span class="pun">/</span><span class="kwd">default</span><span class="pun">/</span><span class="pln">phpmyadmin</span><span class="pun">/</span><span class="pln">save
chmod </span><span class="lit">755</span> <span class="pun">-</span><span class="pln">R </span><span class="pun">/</span><span class="pln">home</span><span class="pun">/</span><span class="pln">wwwroot</span><span class="pun">/</span><span class="kwd">default</span><span class="pun">/</span><span class="pln">phpmyadmin</span><span class="pun">/</span><span class="pln">
chown www</span><span class="pun">:</span><span class="pln">www </span><span class="pun">-</span><span class="pln">R </span><span class="pun">/</span><span class="pln">home</span><span class="pun">/</span><span class="pln">wwwroot</span><span class="pun">/</span><span class="kwd">default</span><span class="pun">/</span><span class="pln">phpmyadmin</span><span class="pun">/</span>

8、安装Memcached

<span class="com">#下载地址:http://memcached.org/download</span>
<span class="com">#工具包 https://gitee.com/bbhsky/PHP-Setup.git</span><span class="pln">
cd memcached</span><span class="pun">-</span><span class="lit">1.5</span><span class="pun">.</span><span class="lit">10</span><span class="pun">/</span>
<span class="pun">./</span><span class="pln">configure </span><span class="pun">--</span><span class="pln">prefix</span><span class="pun">=</span><span class="str">/usr/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">memcached</span><span class="pun">-</span><span class="lit">1.5</span><span class="pun">.</span><span class="lit">10</span><span class="pln">
make
make install
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">memcached</span><span class="pun">-</span><span class="lit">1.5</span><span class="pun">.</span><span class="lit">10</span><span class="str">/ /</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">memcached
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">memcached</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">memcached </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">memcached
cp init</span><span class="pun">.</span><span class="pln">d</span><span class="pun">/</span><span class="pln">memcached </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">init</span><span class="pun">.</span><span class="pln">d</span><span class="pun">/</span><span class="pln">memcached
chmod </span><span class="pun">+</span><span class="pln">x </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">init</span><span class="pun">.</span><span class="pln">d</span><span class="pun">/</span><span class="pln">memcached
useradd </span><span class="pun">-</span><span class="pln">s </span><span class="pun">/</span><span class="pln">sbin</span><span class="pun">/</span><span class="pln">nologin nobody
</span><span class="com">#下载地址:https://launchpad.net/libmemcached/+download</span>
<span class="com">#工具包 https://gitee.com/bbhsky/PHP-Setup.git</span><span class="pln">
tar zxvf libmemcached</span><span class="pun">-</span><span class="lit">1.0</span><span class="pun">.</span><span class="lit">18.tar</span><span class="pun">.</span><span class="pln">gz
cd libmemcached</span><span class="pun">-</span><span class="lit">1.0</span><span class="pun">.</span><span class="lit">18</span><span class="pun">/</span>
<span class="pun">./</span><span class="pln">configure </span><span class="pun">--</span><span class="pln">prefix</span><span class="pun">=</span><span class="str">/usr/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">libmemcached</span><span class="pun">-</span><span class="lit">1.0</span><span class="pun">.</span><span class="lit">18</span> <span class="pun">--</span><span class="kwd">with</span><span class="pun">-</span><span class="pln">memcached
make </span><span class="pun">&&</span><span class="pln"> make install
ln </span><span class="pun">-</span><span class="pln">sf </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">libmemcached</span><span class="pun">-</span><span class="lit">1.0</span><span class="pun">.</span><span class="lit">18</span><span class="str">/ /</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">libmemcached</span>
赞(0)
未经允许不得转载:798VPS » [Centos]安装LNMP服务器
分享到: 更多 (0)