shell Script Combat
----One-click Deployment LNMP Architecture
LNMP uses the shell to deploy, directly on the topic, first needs to prepare the package files, which I named here as Zhunbei files.
650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M01/9A/B2/wKioL1lZsmbh-g4XAAAFZtrKTJI131.png-wh_500x0-wm_ 3-wmp_4-s_2579901889.png "title=" 1.png "alt=" Wkiol1lzsmbh-g4xaaafztrktji131.png-wh_50 "/>
Zhunbei File Contents:
GCC gcc-c++ automake autoconf libtool make OpenSSL openssl-devel mhash-devel libxslt-devel libjpeg libjpeg-devel libpng li Bpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-d Evel ncurses Ncurses-devel Curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel OpenSSL openssl-d Evel Mysql-server
These are the installation packages that need to be installed in the Zhunbei file, laying the groundwork for the following LNMP shell scripts.
Lnmpshell Script writing:
#!/bin/bash
#定义变量
Aa=/soft
bb=$ (Cat/zhunbei.txt)
#检测目录 (not created)
if [!-d/soft]
Then
Mkdir/soft
Fi
#下载软件包
wget Http://ftp.exim.llorien.org/pcre/pcre-8.36.tar.gz-P $AA
wget Http://zlib.net/zlib-1.2.8.tar.gz-P $AA
wget Http://www.openssl.org/source/openssl-1.0.1c.tar.gz-P $AA
wget Ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gz-P $AA
wget Http://tengine.taobao.org/download/tengine-2.1.2.tar.gz-P $AA
wget Http://museum.php.net/php5/php-5.6.1.tar.gz-P $AA
For a in $BB/*
Do
Yum-y Install $BB
Done
CD $AA
For I in $AA/*.tar.gz
Do
Tar-xzf $i-C $AA
Done
#安装pcre
CD $AA/pcre-8.36/
./configure && make && make install
#安装zlib
CD $AA/zlib-1.2.8/
./configure && make && make install
#安装nginx
CD $AA/TENGINE-2.1.2/
./configure--sbin-path=/usr/local/nginx--conf-path=/usr/local/nginx/nginx.conf--pid-path=/usr/local/nginx/ Nginx.pid--with-http_ssl_module--with-http_stub_status_module--with-pcre=/soft/pcre-8.36--with-zlib=/soft/ zlib-1.2.8--with-openssl=/soft/openssl-1.0.1c
Make && make install
#启动nginx服务
/usr/local/nginx/nginx
#安装libmcrypt
CD $AA/libmcrypt-2.5.7/
./configure--prefix=/usr/local && make && make install
#安装php软件包
CD $AA/PHP-5.6.1/
./configure--prefix=/usr/local/php--enable-fpm--with-mcrypt--enable-mbstring--disable-pdo--with-curl-- Disable-debug--disable-rpath--enable-inline-optimization--with-bz2--with-zlib--enable-sockets--enable-sysvsem- -enable-sysvshm--enable-pcntl--enable-mbregex--with-mhash--with-pcre-regex--with-mysql--with-mysqli--WITH-GD-- With-jpeg-dir--enable-opcache=no
Make && make install
#配置PHP-FPM configuration file
Cp/usr/local/php/etc/php-fpm.conf.default/usr/local/php/etc/php-fpm.conf
#重启nginx服务
/usr/local/nginx/nginx-s Reload
Start the PHP-FPM service
/usr/local/php/sbin/php-fpm
Start MySQL
Service mysqld Start
Execute permissions on the shell to install the deployment!
This article from "Lu Chunning" blog, declined reprint!
Shell Script--LNMP Architecture-real-combat deployment