One-click installation of LNMP environment using Shell scripts

Source: Internet
Author: User
Tags imagemagick

One-click installation of LNMP environment using Shell scripts

Nginx is a high-performance HTTP and reverse proxy server. Nginx has a strong advantage in reverse proxy, Rewrite rules, stability, static file processing, and memory consumption. Therefore, most of the company's online and testing environment WEB services use the LNMP environment, and the LNMP environment is often set up. The following is a one-click installation script of the LNMP environment written using SHELL scripts.
1) System Environment Introduction
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 of the LNMP Environment

cd /root/sh wgethttp: //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 password 9b14

3) view the SHELL script of the one-click installation script of LNMP.

cat Install_Centos_LNMP_v.0.1.sh #!/bin/bash #author:sfzhang mkdir -p /software cd /software wgethttp: //sourceforge .net /projects/opensourcefile/files/Centos_LNMP_v .0.1. tar .gz /download if [$?- eq 0] then unzipCentos_LNMP_v.0.1. tar .gz rm -fCentos_LNMP_v.0.1. tar .gz else echo "Downloadinghttp://sourceforge.net/projects/opensourcefile/files/Centos_LNMP_v.0.1.tar.gz/downloadfailured!" exit 1 fi echo "Installinglnmpdependpackages..." sh /software/install_packages .sh if [$?- eq 0] then echo "Lnmpdependpackagesinstallsucessfull!" else echo "Lnmpdependpackagesinstallfailured!" exit 1 fi echo "Installingphplibraryfiles..." sh /software/install_php_lib .sh if [$?- eq 0] then echo "PHPlibraryinstallsucessfull!" else echo "PHPlibraryinstallfailured!" exit 1 fi echo "Installingmysql,pleasewaitting..." sh /software/install_mysql_5 .6.sh if [$?- eq 0] then echo "mysqlinstallsucessfull!" else echo "mysqlinstallfailured!" exit 1 fi echo "NowInstallingphp,pleasewaitting..." sh /software/install_php_5 .3.sh if [$?- eq 0] then echo "PHPinstallsucessfull!" else echo "PHPinstallfailured!" exit 1 fi echo "Installingphpextensions...." sh /software/install_php_ext .sh if [$?- eq 0] then echo "PHPextensionsinstallsucessfull!" else echo "PHPextensionsinstallfailured!" exit 1 fi echo "Installingnginx....." sh /software/install_nginx .sh if [$?- eq 0] then echo "Nginxinstallsucessfull!" else echo "Nginxinstallfailured!" exit 1 fi echo "optimizingtheenvironmentofthelnmp!" sh /software/install_optimiz .sh if [$?- eq 0] then echo "optimizingtheenvironmentofthelnmpsucessfull!" else echo "optimizingtheenvironmentofthelnmpfailured!" exit 1 fi echo "Congratulationstoyou,akeyinstallationLNMPissuccessful!"

Script Description: This script uses (if... fi) statements are divided into the following eight parts to facilitate the readability of the script, and facilitate user-defined installation with different requirements, such as Nginx installation, you only need to manually execute the sh/software/install_nginx.sh script.
To install mysql, run the script/software/install_mysql_5.6.sh.
1. Download The LNMP source code package and its installation scripts.
2. Install the LNMP dependent package in yum.
3. Install the library files required by PHP in the source code.
4. Install the mysql database with the source code.
5. install PHP in the source code.
6. install PHP extensions in the source code.
7. Install NGINX with the source code.
8. Optimized LNMP performance.
4) one-click LNMP installation script Test
1. After one-click LNMP installation is complete, Congratulations to you and a key installation LNMP is successfull characters will appear in the deployment.
2. Start the nginx and php-fpm services.

[root@WEB25sh] #/usr/local/nginx/sbin/nginx [root@WEB25sh] #/usr/local/php/sbin/php-fpm-D

3. View nginx and php-fpm ports.

[root@WEB25sh] ##netstat-antlp|grepLISTEN tcp00127.0.0.1:90000.0.0.0:*LISTEN2002 /php-fpm tcp000.0.0.0:800.0.0.0:*LISTEN1991 /nginx

4. view the php test page.


Summary: PHP extensions installed in LNM:
1) eAccelerator is a free and open source php accelerator, which optimizes and dynamically caches content, improves the cache performance of php scripts, and enables PHP scripts to be compiled, the server overhead is almost completely eliminated. It also optimizes scripts to accelerate execution efficiency. This improves the code execution efficiency of your PHP program by 1-10 times. Currently, only PHP5.4 is supported.
2) PDO_MYSQL, PDO introduction PDO is a "database access abstraction layer", used to unify various databases (MySQL, MSSQL, Oracle, DB2, PostgreSQL ......) Allows you to easily switch between different databases, making porting between databases easy.
3) ImageMagick and ImageMagick are powerful, stable, and free toolkit that can be used to read, write, and process image files in over 89 basic formats, popular formats include TIFF, JPEG, GIF, PNG, PDF, and PhotoCD (ImageMagick is required for installation ).

4) Zend Optimizer improves the execution speed of php applications by optimizing code. The principle of implementation is to optimize the code generated by the Run-Time Compiler before it is finally executed.

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.