![](https://csdnimg.cn/release/download_crawler_static/88014863/bg1.jpg)
Lnmp(mysql 分离)(nginx 1.13.6+mysql5.5.32+php5.3)环境搭建
在服务器 192.168.37.128 上搭建 lnmp(mysql 只到 make install 即可)
1.源码安装 nginx1.13.6(单域名网站,默认站点 html 下)
[root@localhost ~]# mkdir /nginx
rz 上传 nginx 1.13.6 源码包到/nginx /目录下
[root@localhost ~]# ls /nginx/
nginx-1.13.6.tar.gz
[root@localhost ~]# yum -y install gcc gcc-c++
[root@localhost ~]# yum -y install openssl-devel
[root@localhost ~]# yum -y install zlib-devel
[root@localhost ~]# yum -y install pcre-devel
[root@localhost ~]# useradd nginx -s /sbin/nologin -M
[root@localhost ~]# cd /nginx/
[root@localhost nginx]# ls
nginx-1.13.6.tar.gz
[root@localhost nginx]# tar -zxf nginx-1.13.6.tar.gz
[root@localhost nginx]# ls
nginx-1.13.6 nginx-1.13.6.tar.gz
[root@localhost nginx]# cd nginx-1.13.6
[root@localhost nginx-1.13.6]# ls
auto CHANGES CHANGES.ru conf configure contrib html LICENSE man README src
[root@localhost nginx-1.13.6]# ./configure --user=nginx --group=nginx --prefix=/usr/local/nginx
--with-http_ssl_module
[root@localhost nginx-1.13.6]# make && make install
[root@localhost nginx-1.13.6]# /usr/local/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[root@localhost nginx-1.13.6]# /usr/local/nginx/sbin/nginx
[root@localhost nginx-1.13.6]# netstat -anptu |grep :80
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 6111/nginx
tcp 1 0 192.168.40.139:54725 223.119.248.25:80 CLOSE_WAIT
2423/clock-applet
2.源码安装 mysql5.5
[root@localhost nginx-1.13.6]# cd
[root@localhost ~]# mkdir /mysql
rz 上传 mysql5.5 包和 cmake 包
[root@localhost ~]# ls /mysql/
cmake-2.8.8.tar.gz mysql-5.5.32.tar.gz
1)先安装 cmake,并安装最后提示运行 gmake 方式来安装 cmake 软件
[root@localhost ~]# cd /mysql/
[root@localhost mysql]# ls
cmake-2.8.8.tar.gz mysql-5.5.32.tar.gz
[root@localhost mysql]# tar -zxf cmake-2.8.8.tar.gz
[root@localhost mysql]# ls
cmake-2.8.8 cmake-2.8.8.tar.gz mysql-5.5.32.tar.gz
[root@localhost mysql]# cd cmake-2.8.8
[root@localhost cmake-2.8.8]# ls
bootstrap CMakeCPackOptions.cmake.in cmake_uninstall.cmake.in CTestConfig.cmake
DartLocal.conf.in Modules Tests
ChangeLog.manual CMakeGraphVizOptions.cmake CompileFlags.cmake CTestCustom.cmake.in Docs
Readme.txt Utilities
ChangeLog.txt CMakeLists.txt configure CTestCustom.ctest.in
doxygen.config Source
CMakeCPack.cmake CMakeLogo.gif Copyright.txt DartConfig.cmake Example
Templates
[root@localhost cmake-2.8.8]# ./configure
……
CMake has bootstrapped. Now run gmake. #提示运行 gmake ,可能 make 也行,没试过
[root@localhost cmake-2.8.8]# gmake
[root@localhost cmake-2.8.8]# gmake install
[root@localhost cmake-2.8.8]# cd ..
[root@localhost mysql]# ls
cmake-2.8.8 cmake-2.8.8.tar.gz mysql-5.5.32.tar.gz
2)安装 mysql 依赖包:
[root@localhost mysql]# yum -y install ncurses-devel
3)用 cmake 软件包安装 mysql5.5:
[root@localhost mysql]# groupadd mysql
[root@localhost mysql]# useradd mysql -s /sbin/nologin -M -g mysql
[root@localhost mysql]# ls
cmake-2.8.8 cmake-2.8.8.tar.gz mysql-5.5.32.tar.gz
[root@localhost mysql]# tar -zxf mysql-5.5.32.tar.gz
[root@localhost mysql]# ls
cmake-2.8.8 cmake-2.8.8.tar.gz mysql-5.5.32 mysql-5.5.32.tar.gz
[root@localhost mysql]# cd mysql-5.5.32
[root@localhost mysql-5.5.32]# ls
BUILD CMakeLists.txt COPYING include libmysqld mysys regex
sql-common tests win
BUILD-CMAKE cmd-line-utils dbug INSTALL-SOURCE libservices packaging scripts storage
unittest zlib
client config.h.cmake Docs INSTALL-WIN-SOURCE man plugin sql strings
VERSION
cmake configure.cmake extra libmysql mysql-test README sql-bench
support-files vio