Shell scripting environment a key installation LNMP

Nginx is a high performance HTTP and reverse proxy server. Nginx reverse proxy, Rewrite rule, stability, static file processing, memory consumption is a strong advantage. So the company online and WEB services in most of the test environment uses LNMP environment often LNMP environmental structures, is written in SHELL script below oneclick installation script LNMP environment.
1) system environment
Centos 5.8 64 bits (tested)
Nginx: nginx-1.4.1.tar.gz
PHP: php-5.3.27.tar.gz
Mysql: mysql-5.6.5-m8.tar.gz
2) the oneclick installation LNMP environment
cd /root/sh
wget http://sourceforge.net/projects/opensourcefile/files/Install_Centos_LNMP_v.0.1.sh/download
Install_Centos_LNMP_v.0.1.sh
Http://yunpan.cn/cZEfjNTe3Xw5q access code 9B14
3) see LNMP a key setup for SHELL scripts
catInstall_Centos_LNMP_v.0.1.sh
#!/bin/bash
#author:sfzhang
mkdir-p /software
cd/software
wget http://sourceforge.net/projects/opensourcefile/files/Centos_LNMP_v.0.1.tar.gz/download
if[ $? -eq0 ]
  then
  unzip Centos_LNMP_v.0.1.tar.gz
  rm-f Centos_LNMP_v.0.1.tar.gz
else
  echo"Downloading http://sourceforge.net/projects/opensourcefile/files/Centos_LNMP_v.0.1.tar.gz/download failured!"
  exit1
fi
echo"Installing lnmp depend  packages... "
sh /software/install_packages.sh
if[ $? -eq0 ]
  then
    echo"Lnmp depend packages install sucessfull!"
else
    echo"Lnmp depend packages install failured!"
   exit1
fi
echo"Installing php library files..."
sh /software/install_php_lib.sh
if[ $? -eq0 ]
  then
    echo"PHP library install sucessfull!"
else
    echo"PHP library install failured!"
   exit1
fi
echo"Installing mysql,please waitting..."
sh /software/install_mysql_5.6.sh
if[ $? -eq0 ]
  then
    echo"mysql install sucessfull!"
else
    echo"mysql install failured!"
   exit1
fi
echo"Now Installing php,please waitting..."
sh /software/install_php_5.3.sh
if[ $? -eq0 ]
  then
    echo"PHP install sucessfull!"
else
    echo"PHP install failured!"
   exit1
fi
echo"Installing php extensions...."
sh /software/install_php_ext.sh
if[ $? -eq0 ]
  then
    echo"PHP extensions install sucessfull!"
else
    echo"PHP extensions install failured!"
   exit1
fi
echo"Installing nginx....."
sh /software/install_nginx.sh
if[ $? -eq0 ]
  then
    echo"Nginx install sucessfull!"
else
    echo"Nginx install failured!"
   exit1
fi
echo"optimizing the environment of the lnmp!"
sh /software/install_optimiz.sh
if[ $? -eq0 ]
  then
    echo"optimizing the environment of the lnmp sucessfull!"
else
    echo"optimizing the environment of the lnmp failured!"
   exit1
fi
echo"Congratulations to you,a key installation LNMP is successful!"
Script Description: The script used (if … fi) The following statement is divided into eight parts, easy readability of the script, and to facilitate more needs of different user-defined installation, such as the need to install Nginx, only manual execution sh /software/install_nginx.sh this script
Then, if you need to install mysql, then /software/install_mysql_5.6.sh this script.
1. Download and install the script source package LNMP each part.
2.yum LNMP installation package depends.
3. Source Installation PHP library files needed.
The source installation mysql database.
5. Source Installation PHP.
6. Source PHP extension installation.
7. The source installation NGINX.
8. LNMP performance optimization.
4) LNMP a key installation script test
Terminal will be a key after installation is complete 1.LNMP Congratulations to you, a key installation LNMP is successfull characters.
2. Start nginx and php-fpm service.
[Root @ WEB25 sh] # / usr / local / nginx / sbin / nginx
[Root @ WEB25 sh] # / usr / local / php / sbin / php-fpm -D

3. Review nginx and php-fpm port.
[Root @ WEB25 sh] ## netstat -antlp | grep LISTEN
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 2002 / php-fpm
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1991 / nginx

4. View php test page.

151328155.jpg
Summary: LNM installation of PHP extension Description:
1) eAccelerator is a free open source php accelerator, optimization, and dynamic content caching, improved cache performance php scripts, making PHP scripts compiled in the state, the cost of the server almost completely eliminated. It is also optimized for the script plays role in accelerating its efficiency. Make your PHP code execution efficiency can be increased 1-10 times, currently only supports PHP5.4 version.
2) PDO_MYSQL, PDO About PDO is a “database access abstraction layer”, is to unify the various databases (MySQL, MSSQL, Oracle, DB2, PostgreSQL ……) access interface, can easily complete the switch between different databases migration between, making the database easier to achieve.
3) ImageMagick, ImageMagick is a powerful, stable and free set of tools and development kits can be used to read, write and process more than 89 kinds of basic format of image files, including the popular TIFF, JPEG, GIF, PNG, PDF and PhotoCD format (install ImageMagick need imagick support).

4) Zend Optimizer to increase the execution speed of the application with php code optimization methods. Realization of the principle is that code before it is finally executed by running the compiler (Run-Time Compiler) generates optimized.

Leave a Reply

Your email address will not be published. Required fields are marked *