加入收藏 | 设为首页 | 会员中心 | 我要投稿 佛山站长网 (https://www.0757zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 服务器 > 搭建环境 > Linux > 正文

Centos中使用Shell脚本一键安装LNMP环境

发布时间:2016-11-04 04:29:34 所属栏目:Linux 来源:网络整理
导读:由于Nginx是一款高性能的HTTP和反向代理服务器。Nginx在反向代理,Rewrite规则,稳定性,静态文件处理,内存消耗等方面表现了很强的优势。因此公司线上和测试环
副标题[/!--empirenews.page--]

由于Nginx是一款高性能的HTTP和反向代理服务器。Nginx在反向代理,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!"

(编辑:佛山站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

热点阅读