Use shell script to install LNMP environment in CentOS

Source: Internet
Author: User
Tags exit web services centos

Because Nginx is a high-performance http and reverse proxy server. Nginx has a strong advantage in reverse proxy, rewrite rules, stability, static file processing, memory consumption and so on. Therefore, most of the Web services on the company's online and test environments are LNMP environments, often for LNMP environments, and the following are scripts written with shell scripts to install the LNMP environment.

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 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

3) View 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!"

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.