前段时间一直在找一个快速部署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/ ...
随机推荐
-
sql 删除数据库表 外键
--/第1步**********删除所有表的外键约束*************************/ DECLARE c1 cursor for select 'alter table ['+ ...
-
iOS网络开发-打造自己的视频客户端
一.展示实现 效果 客户端: 服务器端: 二.创建表 create table CourseV ...
-
Java程序猿笔试面试之String1
1.怎样实现字符串的反转比如:"how are you"--->"you are how" public class InverseString { pu ...
-
ACM 重建二叉树
重建二叉树 时间限制:1000 ms | 内存限制:65535 KB 难度:3 描述 题目很简单,给你一棵二叉树的后序和中序序列,求出它的前序序列(So easy!). 输入 输入有多组数 ...
-
nodejs爬虫初试---superagent和cheerio
前言 早就听过爬虫,这几天开始学习nodejs,写了个爬虫 demo ,爬取 博客园首页的文章标题.用户名.阅读数.推荐数和用户头像,现做个小总结. 使用到这几个点: 1.node的核心模块-- 文件 ...
-
【BZOJ3529】【SDOI2014】数表
Time Limit: 1000 ms Memory Limit: 512 MB Description 有一张n×m的数表,其第i行第j列 (1≤i≤n,1≤j≤m)的数值为能同时整除i和j的所有自 ...
-
乡下人重拾MVC——@RenderBody @RenderSection @Html.Partial @Html.Action @Html.RenderPartial @Html.RenderAction
1. @RenderBody() 代表:是一个占位符,是留给子页面的位置,子页面使用这个模版,子页面中的内容会被放到@RenderBody的位置.合并后当作一个整体加载 2. @Render ...
-
HAAR与DLib的实时人脸检测之实现与对比
人脸检测方法有许多,比如opencv自带的人脸Haar特征分类器和dlib人脸检测方法等. 对于opencv的人脸检测方法,优点是简单,快速:存在的问题是人脸检测效果不好.正面/垂直/光线较好的人脸, ...
-
CentOS 6.5 yum安装mysql5.6或其他版本【默认yum只能安装mysql 5.1】 by jason
by jason [备份配置文件] CentOS 6.5 默认yum只能安装mysql 5.1 安装前要检查机器原来是否安装过mysql,如有安装需要先进行数据备份.清理. [root@snails ...
-
The MATLAB Profiler
function a = myFunc(a,b,c,d,e) : a = a-b + c^d*log(e); end end >> profile on; myFunc(a,b,c,d,e ...