一键安装lnmp脚本
前段时间一直在找一个快速部署lnmp环境的方法,也没找着,就自己写了一个,结合网上的大神们的。我的方法是脚本结合源码包,很多依赖裤都是yum安装的,这都在脚本里面,需要的源码包我都下载好了,打包成压缩包,源码包+lnmp.sh文件,上传到百度云了,需要的可以download下来:
压缩包地址:
链接:http://pan.baidu.com/s/1jHCP6iM 密码:5q4c
在这里需要说明的是,脚本下载之后,打开的时候用notepad++打开,然后全选复制之后,自己在linux下,vi lnmp.sh一个新文件,把内容粘贴进去,这样就不会报windows到Linux的错误
先上传一下脚本:
#!/bin/bash
# by huowuzhao 2017.1.
yum -y install gcc gcc-c++
if [ ! -d /home/tools ]
then
mkdir /home/tools -p
fi
cd /home/tools
PING=`ping -c www.baidu.com |grep ttl=|wc -l`
if [ "$PING" -eq ]
then
echo "Network does not work"
exit
fi
if [ -e /home/tools/pcre-8.39.tar.gz ]
then
tar xf pcre-8.39.tar.gz
else
echo "no file /home/tools/pcre-8.39.tar.gz"
fi
cd pcre-8.39 &&\
./configure
if [ $? -ne ]
then
echo "pcre configure is false"
exit
fi
make && make install
if [ $? -ne ]
then
echo "pcre make install is false"
exit
fi
cd ..
RPM=`rpm -qa|grep "openssl-"|wc -l`
if [ $RPM -ne ]
then
yum -y install openssl openssl-devel
else
echo "yum install openssl openssl-devel is error"
exit
fi
cd /home/tools
if [ ! -e nginx-1.8..tar.gz ]
then
echo " nginx-1.8.0.tar.gz is false"
exit
fi
tar xf nginx-1.8..tar.gz
cd nginx-1.8.
NGINXUSER=`cat /etc/passwd |grep nginx|wc -l`
if [ "$NGINXUSER" -eq ]
then
useradd nginx -s /sbin/nologin -M
fi
./configure --user=nginx --group=nginx --prefix=/home/nginx-1.8. --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module
if [ $? -eq ]
then
make
else
echo "nginx configure is error"
exit
fi
if [ $? -eq ]
then
make install
else
echo "nginx make is error"
exit
fi
if [ $? -ne ]
then
echo "nginx make install is error"
exit
fi
cd ..
if [ -d /home/nginx-1.8./ ]
then
ln -s /home/nginx-1.8. /home/nginx
else
echo "no directory /home/nginx-1.8.0/"
exit
fi
if [ -f /etc/ld.so.conf ]
then
echo "/usr/local/lib/" >>/etc/ld.so.conf
else
echo "no file /etc/ld.so.conf"
exit
fi
if [ -d /lib64 ]
then
ln -s /usr/local/lib/libpcre.so. /lib64
else
echo "no directory /lib64"
exit
fi
/home/nginx/sbin/nginx -t
if [ $? -eq ]
then
echo "nginx is ok"
else
echo "nginx is false"
exit
fi
/home/nginx/sbin/nginx
chown -R nginx.nginx /home/nginx/*
clear
echo "==================nginx install is all finish=================="
sleep 2
cd /home/tools
echo "=====================starting cmake install======================="
tar xf cmake-3.7.1.tar.gz
cd cmake-3.7.1
./configure
if [ $? -ne 0 ]
then
echo "cmake configure is error"
exit 1
fi
gmake
if [ $? -ne 0 ]
then
echo " cmake gmake is error"
exit 1
fi
gmake install
if [ $? -ne 0 ]
then
echo " cmake gmake install is error"
exit 1
fi
cd ../
PING=`ping -c 1 www.baidu.com |grep ttl=|wc -l`
if [ "$PING" -ne 1 ]
then
echo "Network does not work"
exit 1
fi
echo "=====================starting ncurses-devel install======================="
RPM=`rpm -qa |grep ncurses-devel |wc -l`
if [ $RPM -ne 1 ]
then
yum install ncurses-devel -y
fi
echo "=====================next is install mysql...======================="
cd /home/tools/
if [ -e /home/tools/mysql-5.6.34.tar.gz ]
then
tar zxf mysql-5.6.34.tar.gz
else
echo "no file /home/tools/mysql-5.6.34.tar.gz"
fi
NGINXUSER=`cat /etc/passwd |grep mysql|wc -l`
if [ "$NGINXUSER" -eq 0 ]
then
useradd mysql -s /sbin/nologin -M
fi
cd mysql-5.6.34
cmake . -DCMAKE_INSTALL_PREFIX=/home/mysql-5.6.34 \
-DMYSQL_DATADIR=/home/mysql-5.6.34/data \
-DMYSQL_UNIX_ADDR=/home/mysql-5.6.34/tmp/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DEXTRA_CHARSETS=gbk,gb2312,utf8,ascii \
-DENABLED_LOCAL_INFILE=ON \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \
-DWITH_FAST_MUTEXES=1 \
-DWITH_ZLIB=bundled \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_READLINE=1 \
-DWITH_EMBEDDED_SERVER=1 \
-DWITH_DEBUG=0
if [ $? -ne 0 ]
then
echo "mysql cmake is error"
exit 1
fi
make
if [ $? -ne 0 ]
then
echo "mysql make is error"
exit 1
fi
make install
if [ $? -ne 0 ]
then
echo "mysql make install is error"
exit 1
fi
echo "=====================configuration mysql======================="
if [ -d /home/mysql-5.6.34 ]
then
ln -s /home/mysql-5.6.34/ /home/mysql
else
echo "no directory /home/mysql-5.6.34/"
exit 1
fi
cd /home/mysql
cp /home/tools/my.cnf /etc/my.cnf
chown -R mysql.mysql /home/mysql/
chown -R mysql.mysql /tmp
echo "=====================mysql is INIT======================="
/home/mysql/scripts/mysql_install_db --basedir=/home/mysql --datadir=/home/mysql/data --user=mysql
INIT=`/home/mysql/scripts/mysql_install_db --basedir=/home/mysql --datadir=/home/mysql/data --user=mysql|grep OK|wc -l`
if [ "$INIT" -eq 2 ]
then
echo "=====================mysql INIT is ok====================="
fi
if [ -f /home/mysql/support-files/mysql.server ]
then
cp /home/mysql/support-files/mysql.server /etc/init.d/mysqld
else
echo "no file /home/mysql/support-files/mysql.server"
fi
chmod +x /etc/init.d/mysqld
/etc/init.d/mysqld start
echo 'PATH=/home/mysql/bin/:$PATH' >>/etc/profile
. /etc/profile
chkconfig mysqld on
mysqladmin -u root password '123456'
MYSQLLOGIN=`mysql -uroot -p123456 -e "select version();"|wc -l`
if [ $MYSQLLOGIN -ne 0 ]
then
echo "mysql is installed and mysql login is ok..."
else
echo "mysql don't login..."
fi
clear
echo "Pls input user@localhost and password login!!!!!"
sleep 1
clear
echo "==============other installation package=============="
cd /home/tools/
yum install zlib libxml libjpeg freetype libpng gd curl libiconv zlib-devel libxml2-devel libjpeg-devel freetype-devel libpng-devel gd-devel curl-devel libtool-ltdl-devel -y
yum install libxslt libxslt-devel -y
YUM=`rpm -qa zlib-devel libxml2-devel libjpeg-devel freetype-devel libpng-devel gd-devel|wc -l`
if [ $YUM -lt 3 ]
then
echo "yum bag is error,bag is lack..."
exit 1
fi
if [ ! -e libiconv-1.9.2.tar.gz ]
then
echo "no gz libiconv-1.9.2.tar.gz"
exit 1
fi
tar zxf libiconv-1.9.2.tar.gz
cd libiconv-1.9.2
./configure --prefix=/usr/local/libiconv
if [ $? -ne 0 ]
then
echo "libiconv-1.9.2 configure is error"
exit 1
fi
make&&make install
if [ $? -ne 0 ]
then
echo "libiconv-1.9.2 make&&make install is error"
exit 1
fi
cd ../
if [ ! -e libmcrypt-2.5.8.tar.gz ]
then
echo "no gz libmcrypt-2.5.8.tar.gz"
exit 1
fi
tar zxf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure
if [ $? -ne 0 ]
then
echo "libmcrypt-2.5.8 configure is error"
exit 1
fi
make&&make install
if [ $? -ne 0 ]
then
echo "libmcrypt-2.5.8 make&&make install is error"
exit 1
fi
sleep 2
/sbin/ldconfig
cd libltdl/
./configure --enable-ltdl-install
if [ $? -ne 0 ]
then
echo "libmcrypt-2.5.8/libltdl configure is error"
exit 1
fi
make&&make install
if [ $? -ne 0 ]
then
echo "libmcrypt-2.5.8/libltdl make&&make install is error"
exit 1
fi
cd ../../
if [ ! -e mhash-0.9.9.9.tar.gz ]
then
echo "no gz mhash-0.9.9.9.tar.gz"
exit 1
fi
tar zxf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9/
./configure
if [ $? -ne 0 ]
then
echo "mhash-0.9.9.9 configure is error"
exit 1
fi
make&&make install
if [ $? -ne 0 ]
then
echo "mhash-0.9.9.9 make&&make install is error"
exit 1
fi
sleep 2
cd ../
rm -f /usr/lib64/libmcrypt.*
rm -f /usr/lib64/libmhash*
ln -s /usr/local/lib64/libmcrypt.la /usr/lib64/libmcrypt.la
ln -s /usr/local/lib64/libmcrypt.so /usr/lib64/libmcrypt.so
ln -s /usr/local/lib64/libmcrypt.so.4 /usr/lib64/libmcrypt.so.4
ln -s /usr/local/lib64/libmcrypt.so.4.4.8 /usr/lib64/libmcrypt.so.4.4.8
ln -s /usr/local/lib64/libmhash.a /usr/lib64/libmhash.a
ln -s /usr/local/lib64/libmhash.la /usr/lib64/libmhash.la
ln -s /usr/local/lib64/libmhash.so /usr/lib64/libmhash.so
ln -s /usr/local/lib64/libmhash.so.2 /usr/lib64/libmhash.so.2
ln -s /usr/local/lib64/libmhash.so.2.0.1 /usr/lib64/libmhash.so.2.0.1
ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config
if [ ! -e mcrypt-2.6.8.tar.gz ]
then
echo "no gz mcrypt-2.6.8.tar.gz"
exit 1
fi
tar zxf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8/
/sbin/ldconfig
./configure LD_LIBRARY_PATH=/usr/local/lib
if [ $? -ne 0 ]
then
echo "mcrypt-2.6.8 configure is error"
exit 1
fi
make&&make install
if [ $? -ne 0 ]
then
echo "mcrypt-2.6.8 make&&make install is error"
exit 1
fi
cd ../
clear
echo "==============other installation package is ok=============="
sleep 2
echo "==================starting install php===================="
if [ ! -e php-5.6.11.tar.gz ]
then
echo "no gz php-5.6.11.tar.gz"
exit 1
fi
tar xf php-5.6.11.tar.gz
cd php-5.6.11
echo "/home/mysql-5.6.25/lib/" >>/etc/ld.so.conf
ldconfig
./configure \
--prefix=/home/php-5.6.11 \
--with-mysql=/home/mysql \
--with-iconv-dir=/usr/local/libiconv \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--with-libxml-dir=/usr \
--enable-xml \
--disable-rpath \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--with-curl \
--enable-mbregex \
--enable-fpm \
--enable-mbstring \
--with-mcrypt \
--with-gd \
--enable-gd-native-ttf \
--with-openssl \
--with-mhash \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-zip \
--enable-soap \
--enable-short-tags \
--enable-static \
--with-xsl \
--with-fpm-user=nginx \
--with-fpm-group=nginx \
--enable-ftp
if [ $? -ne 0 ]
then
echo "php-5.6.11.tar.gz configure is error"
exit 1
fi
make
if [ $? -eq 0 ]
then
make install
else
echo "make is error"
exit 1
fi
ln -s /home/php-5.6.11/ /home/php
cp php.ini-production /home/php/lib/php.ini
cd /home/php/etc/
cp /home/tools/php-fpm.conf ./
CONF=`ls php-fpm.conf|wc -l`
if [ $CONF -ne 1 ]
then
echo "no file /home/php/etc/php-fpm.conf"
exit 1
fi
clear
echo "=====================php install is ok========================"
sleep 1
/home/php/sbin/php-fpm
PHPSTART=`ss -luntp |grep php-fpm|wc -l`
if [ $PHPSTART -eq 0 ]
then
echo "php-fpm is stopped..."
fi
clear
echo "===========lnmp all install is ok============="
echo "==============!!!!happy!!!!================"
echo " * * * * "
echo " * * * * * * "
echo " ***** * * * * "
echo " * * * * * * "
echo " * * * * * "
echo "==============!!!!happy!!!!================"
一键安装lnmp脚本的更多相关文章
- Centos7一键安装lnmp脚本
mkdir /root/softwarewget http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-boost-5.7.18.tar.gzwget https ...
- 一键安装LNMP(适合centos7)
1.准备工作,下载源码包 wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.22-linux-glibc2.12-x86_64.tar ...
- Shell脚本一键安装LNMP环境
https://sourceforge.net/projects/opensourcefile/files/ Nginx是一款高性能的HTTP和反向代理服务器.Nginx在反向代理,Rewrite规则 ...
- linux一键安装vncserver脚本
title: linux一键安装vncserver脚本 date: 2016-04-11 14:32:04 tags: --- linux多数情况下是作为服务器使用的,管理员一般也喜欢使用命令行来管理 ...
- Centos6.5中 一键安装LNMP 安装Yii2.0 手工配置
1.一键安装LNMP cd /usr wget -c http://soft.vpser.net/lnmp/lnmp1.2-full.tar.gz tar zxf lnmp1.-full.tar.gz ...
- Rehat一键安装mysql脚本和备份数据库脚本
Rehat一键安装mysql脚本 ##说明:适用,Rehat 5 6 7 1.运行状态,运行成功输出mysql临时密码 2.代码如下 #!/bin/bash #获取系统信息 sudo cat /etc ...
- (转)CentOS一键安装Nginx脚本
原文:https://www.xiaoz.me/archives/10301 https://blog.slogra.com/post-676.html-----centos7一键安装nginx脚本
- Linux一键安装LNMP环境
Linux一键安装LNMP环境 官方地址:https://lnmp.org/. 参考安装步骤:https://lnmp.org/install.html. 一键安装可以选择mysql版本.php版本, ...
- Linux安装swoole拓展 (一键安装lnmp后安装可用完美)
一键安装lnmp后安装可用完美 swoole(一键安装完lnmp重启下,之前出现502一直解决不了,不清楚啥情况) 找到对应php版本,在lnmp文件夹的src 1.安装swoole cd /usr/ ...
随机推荐
- javascript基础学习(九)
javascript之基本包装类型 学习要点: 基本包装类型概述 Boolean类型 Number类型 String类型 一.基本包装类型概述 为了便于操作基本类型值,提供了3种特殊的引用类型:Boo ...
- 我的项目:一个chrome插件的诞生记,名字叫jumper
选课是个问题,为了选课,便有了以下的故事. 最开始,萌生想法于2013年7月. 接着网上了解了chrome的结构知识,却发现例子是假的. 幸好有之前师兄的一个同功能插件开源,但代码写得很乱,我喜欢逻辑 ...
- Centos JAVA Eclipse
wget http://download.oracle.com/otn-pub/java/jdk/8u5-b13/jdk-8u5-linux-i586.tar.gz vi /etc/profile 在 ...
- 简单概述 .NET Framework 各版本区别
目前已发行的版本有1.0.1.1.2.0.3.0.3.5.4.0.4.5(及4.5.1.4.5.2).4.6(及4.6.1). 1.0版本:最初的.net framework版本,作为一个独立的工具包 ...
- Jquery 全选、反选
jQuery 1.9以后用 prop(); 不用attr 等 $(function() { $('#inputCheck').click(function() { $("input[name ...
- AspNet WebApi: 了解下HttpControllerDispatcher,控制器的创建和执行
HttpControllerDispatcher作为ASPNET WEB API消息处理管道中重要的部分,负责最后控制器系统的激活,action方法的执行,以及最后的响应生成. HtppControl ...
- 基于cx_freeze编译PyQt4程序(numpy & scipy)
当开发完成PyQt4程序后,需要提供给他人使用,这时最好的办法是将Python程序编译成exe文件. 通常我采用cx_freeze完成这个工作,即编写setup.py文件,执行python setup ...
- HTML部分标签的含义
标签的用途:我们学习网页制作时,常常会听到一个词,语义化.那么什么叫做语义化呢,说的通俗点就是:明白每个标签的用途(在什么情况下使用此标签合理)比如,网页上的文章的标题就可以用标题标签,网页上的各个栏 ...
- RocksDB介绍:一个比LevelDB更彪悍的引擎
关于LevelDB的资料网上还是比较丰富的,如果你尚未听说过LevelDB,那请稍微预习一下,因为RocksDB实际上是在LevelDB之上做的改进.本文主要侧重在架构上对RocksDB对LevelD ...
- The Wedding Juicer
poj2227:http://poj.org/problem?id=2227 题意:给你一块矩形区域,这个矩形区域是由一个个方格拼起来的,并且每个方格有一个高度.现在给这个方格灌水,问最多能装多少水. ...