阅读(1489)
赞(0)
20.2 LNMP动态网站架构
2019-05-17 11:07:30 更新
LNMP动态网站部署架构是一套由Linux + Nginx + MySQL + PHP组成的动态网站系统解决方案(其logo见图20-1)。LNMP中的字母L是Linux系统的意思,不仅可以是RHEL、CentOS、Fedora,还可以是Debian、Ubuntu等系统。本书的配套站点https://www.linuxprobe.com就是基于LNMP部署出来的,目前的运行一直很稳定,访问速度也很快。
图20-1 LNMP动态网站部署架构的Logo
在使用源码包安装服务程序之前,首先要让安装主机具备编译程序源码的环境,他需要具备C语言、C++语言、Perl语言的编译器,以及各种常见的编译支持函数库程序。因此请先配置妥当Yum软件仓库,然后把下面列出的这些软件包都统统安装上:
[root@linuxprobe ~]# yum install -y apr* autoconf automake bison bzip2 bzip2* compat* cpp curl curl-devel fontconfig fontconfig-devel freetype freetype* freetype-devel gcc gcc-c++ gd gettext gettext-devel glibc kernel kernel-headers keyutils keyutils-libs-devel krb5-devel libcom_err-devel libpng libpng-devel libjpeg* libsepol-devel libselinux-devel libstdc++-devel libtool* libgomp libxml2 libxml2-devel libXpm* libtiff libtiff* make mpfr ncurses* ntp openssl openssl-devel patch pcre-devel perl php-common php-gd policycoreutils telnet t1lib t1lib* nasm nasm* wget zlib-devel
Loaded plugins: langpacks, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
………………省略部分安装过程………………
Installing:
apr x86_64 1.4.8-3.el7 rhel7 103 k
apr-devel x86_64 1.4.8-3.el7 rhel7 188 k
apr-util x86_64 1.5.2-6.el7 rhel7 92 k
apr-util-devel x86_64 1.5.2-6.el7 rhel7 76 k
autoconf noarch 2.69-11.el7 rhel7 701 k
automake noarch 1.13.4-3.el7 rhel7 679 k
bison x86_64 2.7-4.el7 rhel7 578 k
bzip2-devel x86_64 1.0.6-12.el7 rhel7 218 k
compat-dapl x86_64 1:1.2.19-3.el7 rhel7 109 k
compat-db-headers noarch 4.7.25-27.el7 rhel7 48 k
compat-db47 x86_64 4.7.25-27.el7 rhel7 795 k
compat-gcc-44 x86_64 4.4.7-8.el7 rhel7 10 M
compat-gcc-44-c++ x86_64 4.4.7-8.el7 rhel7 6.3 M
compat-glibc x86_64 1:2.12-4.el7 rhel7 1.2 M
compat-glibc-headers x86_64 1:2.12-4.el7 rhel7 452 k
compat-libcap1 x86_64 1.10-7.el7 rhel7 19 k
compat-libf2c-34 x86_64 3.4.6-32.el7 rhel7 155 k
compat-libgfortran-41 x86_64 4.1.2-44.el7 rhel7 142 k
compat-libtiff3 x86_64 3.9.4-11.el7 rhel7 135 k
compat-openldap x86_64 1:2.3.43-5.el7 rhel7 174 k
cpp x86_64 4.8.2-16.el7 rhel7 5.9 M
fontconfig-devel x86_64 2.10.95-7.el7 rhel7 128 k
freetype-devel x86_64 2.4.11-9.el7 rhel7 355 k
gcc x86_64 4.8.2-16.el7 rhel7 16 M
gcc-c++ x86_64 4.8.2-16.el7 rhel7 7.1 M
………………省略部分安装过程………………
Complete!
刘遄老师已经把安装LNMP动态网站部署架构所需的16个软件源码包和1个用于检查效果的论坛网站系统软件包上传到与本书配套的站点服务器上。大家可以在Windows系统中下载后通过ssh服务传送到打算部署LNMP动态网站架构的Linux服务器中,也可以直接在Linux服务器中使用wget命令下载这些源码包文件。根据第6章讲解的FHS协议,建议把要安装的软件包存放在/usr/local/src目录中:
[root@linuxprobe ~]# cd /usr/local/src
[root@linuxprobe src] # wget https://www.linuxprobe.com/Software/cmake-2.8.11.2.tar.gz
[root@linuxprobe src] # wget https://www.linuxprobe.com/Software/Discuz_X3.2_SC_GBK.zip
[root@linuxprobe src] # wget https://www.linuxprobe.com/Software/freetype-2.5.3.tar.gz
[root@linuxprobe src] # wget https://www.linuxprobe.com/Software/jpegsrc.v9a.tar.gz
[root@linuxprobe src] # wget https://www.linuxprobe.com/Software/libgd-2.1.0.tar.gz
[root@linuxprobe src] # wget https://www.linuxprobe.com/Software/libmcrypt-2.5.8.tar.gz
[root@linuxprobe src] # wget https://www.linuxprobe.com/Software/libpng-1.6.12.tar.gz
[root@linuxprobe src] # wget https://www.linuxprobe.com/Software/libvpx-v1.3.0.tar.bz2
[root@linuxprobe src] # wget https://www.linuxprobe.com/Software/mysql-5.6.19.tar.gz
[root@linuxprobe src] # wget https://www.linuxprobe.com/Software/nginx-1.6.0.tar.gz
[root@linuxprobe src] # wget https://www.linuxprobe.com/Software/openssl-1.0.1h.tar.gz
[root@linuxprobe src] # wget https://www.linuxprobe.com/Software/php-5.5.14.tar.gz
[root@linuxprobe src] # wget https://www.linuxprobe.com/Software/pcre-8.35.tar.gz
[root@linuxprobe src] # wget https://www.linuxprobe.com/Software/t1lib-5.1.2.tar.gz
[root@linuxprobe src] # wget https://www.linuxprobe.com/Software/tiff-4.0.3.tar.gz
[root@linuxprobe src] # wget https://www.linuxprobe.com/Software/yasm-1.2.0.tar.gz
[root@linuxprobe src] # wget https://www.linuxprobe.com/Software/zlib-1.2.8.tar.gz
[root@linuxprobe src]# ls
zlib-1.2.8.tar.gz libmcrypt-2.5.8.tar.gz pcre-8.35.tar.gz
cmake-2.8.11.2.tar.gz libpng-1.6.12.tar.gz php-5.5.14.tar.gz
Discuz_X3.2_SC_GBK.zip libvpx-v1.3.0.tar.bz2 t1lib-5.1.2.tar.gz
freetype-2.5.3.tar.gz mysql-5.6.19.tar.gz tiff-4.0.3.tar.gz
jpegsrc.v9a.tar.gz nginx-1.6.0.tar.gz yasm-1.2.0.tar.gz
libgd-2.1.0.tar.gz openssl-1.0.1h.tar.gz
CMake是Linux系统中一款常用的编译工具。要想通过源码包安装服务程序,就一定要严格遵守上面总结的安装步骤—下载及解压源码包文件、编译源码包代码、生成二进制安装程序、运行二进制的服务程序安装包。接下来在解压、编译各个软件包源码程序时,都会生成大量的输出信息,下文中将其省略,请读者以实际操作为准。
[root@linuxprobe src]# tar xzvf cmake-2.8.11.2.tar.gz
[root@linuxprobe src]# cd cmake-2.8.11.2/
[root@linuxprobe cmake-2.8.11.2]# ./configure
[root@linuxprobe cmake-2.8.11.2]# make
[root@linuxprobe cmake-2.8.11.2]# make install