Shell script one-click Installation LNMP Environment

Source: Internet
Author: User
Tags fpm install php imagemagick

https://sourceforge.net/projects/opensourcefile/files/

Nginx is a high-performance HTTP and reverse proxy server. Nginx in reverse proxy, rewrite rules, stability, static file processing, memory consumption and other aspects of the performance of a strong advantage. Therefore, most of the Web services in the company's online and test environments are LNMP environments, often with LNMP environments, and the following is a script written with a shell script to install the LNMP environment.
1) Introduction to the system environment
Centos 5.8 64-bit (tested)
Nginx:nginx-1.4.1.tar.gz
Php:php-5.3.27.tar.gz
Mysql:mysql-5.6.5-m8.tar.gz
2) One-click Installation LNMP Environment

cd/root/shwget http://sourceforge.net/projects/opensourcefile/files/Install_Centos_LNMP_v.0.1.sh/downloadInstall_Centos_LNMP_v.0.1.sh

http://yunpan.cn/cZEfjNTe3Xw5q Access Password 9b14

3) Check the shell script for the LNMP one-click installation script

catInstall_Centos_LNMP_v.0.1.sh#!/bin/bash#author:sfzhangmkdir-p /softwarecd/softwarewget http://sourceforge.net/projects/opensourcefile/files/Centos_LNMP_v.0.1.tar.gz/downloadif[ $? -eq0 ]  then  unzip Centos_LNMP_v.0.1.tar.gz  rm-f Centos_LNMP_v.0.1.tar.gzelse  echo"Downloading http://sourceforge.net/projects/opensourcefile/files/Centos_LNMP_v.0.1.tar.gz/download failured!"  exit1fiecho"Installing lnmp depend  packages... "sh /software/install_packages.shif[ $? -eq0 ]  then    echo"Lnmp depend packages install sucessfull!"else    echo"Lnmp depend packages install failured!"   exit1fiecho"Installing php library files..."sh /software/install_php_lib.shif[ $? -eq0 ]  then    echo"PHP library install sucessfull!"else    echo"PHP library install failured!"   exit1fiecho"Installing mysql,please waitting..."sh /software/install_mysql_5.6.shif[ $? -eq0 ]  then    echo"mysql install sucessfull!"else    echo"mysql install failured!"   exit1fiecho"Now Installing php,please waitting..."sh /software/install_php_5.3.shif[ $? -eq0 ]  then    echo"PHP install sucessfull!"else    echo"PHP install failured!"   exit1fiecho"Installing php extensions...."sh /software/install_php_ext.shif[ $? -eq0 ]  then    echo"PHP extensions install sucessfull!"else    echo "PHP extensions install failured!"   exit1fiecho"Installing nginx....."sh /software/install_nginx.shif[ $? -eq0 ]  then    echo"Nginx install sucessfull!"else    echo"Nginx install failured!"   exit1fiecho"optimizing the environment of the lnmp!"sh /software/install_optimiz.shif[ $? -eq0 ]  then    echo"optimizing the environment of the lnmp sucessfull!"else    echo "optimizing the environment of the lnmp failured!"   exit1fiecho"Congratulations to you,a key installation LNMP is successful!"

Script Description: The script with (if...fi) statements are divided into the following 8 parts, convenient script readability, and more different requirements to facilitate user-defined installation, such as the need to install Nginx, just manually execute sh/software/install_nginx.sh this script
Then, if you need to install MySQL, execute the/software/install_mysql_5.6.sh script.
1. Download the installation script for the LNMP source package and its parts.
2.yum installs the package that the LNMP depends on.
3. The source code to install PHP required library files.
4. Source installation MySQL database.
5. Source code to install PHP.
6. Source code to install PHP extensions.
7. SOURCE installation Nginx.
8. Optimize LNMP performance.
4) Lnmp One-click installation script Test
1.LNMP The terminal will appear congratulations to you,a key installation Lnmp is successfull character after a key installation is complete.
2. Start the Nginx and PHP-FPM services.

[[email protected] sh]# /usr/local/nginx/sbin/nginx[[email protected] sh]# /usr/local/php/sbin/php-fpm -D

3. View the Nginx and PHP-FPM ports.

[[email protected] sh]## netstat -antlp |grep LISTENtcp        0      0 127.0.0.1:9000              0.0.0.0:*                   LISTEN      2002/php-fpmtcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      1991/nginx

4. View the PHP test page.


Summary: LNM installed PHP extension Description:
1) eaccelerator is a free open source PHP accelerator, optimized and dynamic content caching, improving the caching performance of PHP scripts, so that PHP scripts in the compiled state, the cost of the server almost completely eliminated. It also has the effect of optimizing the script to speed up its execution efficiency. Make your PHP program code 1-10 times more efficient, currently only support PHP5.4 version.
2) Pdo_mysql,pdo Introduction PDO is a "database access abstraction Layer" that unifies various databases (MYSQL, MSSQL, Oracle, DB2, PostgreSQL ...). ), it is easy to switch between different databases, which makes porting between databases easy to implement.
3) Imagemagick,imagemagick is a powerful, stable and free toolset and development package that can be used to read, write, and process image files in more than 89 basic formats, including popular TIFF, JPEG, GIF, PNG, Formats such as PDF and PHOTOCD (installation ImageMagick requires Imagick support).

4) Zend Optimizer uses optimized code to improve the execution speed of PHP applications. The principle of implementation is to optimize the code that is generated by running the compiler (Run-time Compiler) before it is finally executed.

Shell script one-click Installation LNMP Environment

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.