Centos中使用Shell指令碼一鍵安裝LNMP環境

來源:互聯網
上載者:User

由於Nginx是一款高效能的HTTP和反向 Proxy伺服器。Nginx在反向 Proxy,Rewrite規則,穩定性,靜態檔案處理,記憶體消耗等方面表現了很強的優勢。因此公司線上和測試環境的WEB服務大多數採用的是LNMP環境,經常要進行LNMP環境的搭建,下面是用SHELL指令碼寫的一鍵安裝LNMP環境的指令碼。

1)系統內容介紹

Centos 5.8 64位 (已測試)

Nginx: nginx-1.4.1.tar.gz

PHP:   php-5.3.27.tar.gz

Mysql: mysql-5.6.5-m8.tar.gz

2)一鍵安裝LNMP環境

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)查看LNMP一鍵安裝指令碼的SHELL指令碼

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

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.