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/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 Password 9b14
3) Check the shell script for the LNMP one-click installation script
cat
Install_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
[ $? -
eq
0 ]
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!"
exit
1
fi
echo
"Installing lnmp depend packages... "
sh
/software/install_packages
.sh
if
[ $? -
eq
0 ]
then
echo
"Lnmp depend packages install sucessfull!"
else
echo
"Lnmp depend packages install failured!"
exit
1
fi
echo
"Installing php library files..."
sh
/software/install_php_lib
.sh
if
[ $? -
eq
0 ]
then
echo
"PHP library install sucessfull!"
else
echo
"PHP library install failured!"
exit
1
fi
echo
"Installing mysql,please waitting..."
sh
/software/install_mysql_5
.6.sh
if
[ $? -
eq
0 ]
then
echo
"mysql install sucessfull!"
else
echo
"mysql install failured!"
exit
1
fi
echo
"Now Installing php,please waitting..."
sh
/software/install_php_5
.3.sh
if
[ $? -
eq
0 ]
then
echo
"PHP install sucessfull!"
else
echo
"PHP install failured!"
exit
1
fi
echo
"Installing php extensions...."
sh
/software/install_php_ext
.sh
if
[ $? -
eq
0 ]
then
echo
"PHP extensions install sucessfull!"
else
echo "PHP extensions install failured!"
exit
1
fi
echo
"Installing nginx....."
sh
/software/install_nginx
.sh
if
[ $? -
eq
0 ]
then
echo
"Nginx install sucessfull!"
else
echo
"Nginx install failured!"
exit
1
fi
echo
"optimizing the environment of the lnmp!"
sh
/software/install_optimiz
.sh
if
[ $? -
eq
0 ]
then
echo
"optimizing the environment of the lnmp sucessfull!"
else
echo "optimizing the environment of the lnmp failured!"
exit
1
fi
echo
"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 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 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