转载注明出处!!!!!!!!!

不足之处望多多指教。

不明之处站内私。

#!/bin/bash
#########################################################
#by:kingle #
#use: fast lnmp #
#version:1.0 #
#php:php-7.2.8 #
#nginx:1.15.1 #
#mysql:5.6.41 #
#cenos:2.6.32-754.2.1.el6.x86_64 #
#########################################################
dir=/root/opt
nginx_install_dir="/lnmp/nginx"
mysql_install_dir="/lnmp/mysql"
php_install_dir="/lnmp/php"
nginx_name="nginx-1.15.1.tar.gz"
mysql_name="mysql-5.6.41.tar.gz"
php_name="php-7.2.8.tar.gz"
[ -f /etc/init.d/functions ] && . /etc/init.d/functions || exit
#安装nginx
install_nginx(){
#跟新源
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-.repo
#安装依赖包
yum install -y pcre pcre-devel openssl openssl-devel gcc make gcc-c++
[ -e $dir ] && cd $dir
if [ -f $nginx_name ]
then
echo 'nginx need have'
# t解压文件
tar zxf $nginx_name && cd nginx-1.15.
# 添加僵尸用户
useradd nginx -s /sbin/nologin -M
# 编译安装
./configure --user=nginx --group=nginx --prefix=/lnmp/nginx-1.15./ --with-http_stub_status_module --with-http_ssl_module
[ $(echo $?) -eq ] && make && make install
[ $(echo $?) -eq ] && echo "nginx install success...."
#创建软链接
ln -s /lnmp/nginx-1.15. /lnmp/nginx
fi
}
#开启脚本
start_nginx(){
service iptables stop
setenforce
/lnmp/nginx/sbin/nginx -c /lnmp/nginx-1.15.//conf/nginx.conf
$nginx_install_dir/sbin/nginx -t
if [ $(echo $?) -eq ]
then
$nginx_install_dir/sbin/nginx -s reload
if [ $(netstat -lutnp|grep |wc -l) -eq ]
then
action "nginx success..." /bin/true
else
echo "nginx error!"
fi
fi
}
install_mysql(){
yum install -y ncurses-devel automake autoconf bison libtool-ltdl-devel
[ -e $dir ] && cd $dir
if [ -f $mysql_name ]
then
yum install cmake -y
tar zxvf $mysql_name
if [ ! -d $mysql_install_dir ]
then
mkdir -p $mysql_install_dir
fi
groupadd mysql
useradd -s /sbin/nologin -g mysql -M mysql
mkdir -p /lnmp/mysql-5.6./data
cd $dir/mysql-5.6.
cmake -DCMAKE_INSTALL_PREFIX=/lnmp/mysql-5.6. -DMYSQL_DATADIR=/lnmp/mysql-5.6./data -DMYSQL_UNIX_ADDR=/lnmp/mysql-5.6./tmp/mysql.sock -DWITH_MYISAM_STORAGE_ENGINE= -DWITH_INNOBASE_STORAGE_ENGINE= -DWITH_ARCHIVE_STORAGE_ENGINE= -DWITH_BLACKHOLE_STORAGE_ENGINE= -DWITH_ZLIB=bundled -DWITH_SSL=bundled -DWITH_EMBEDDED_SERVER= -DENABLED_LOCAL_INFILE= -DENABLE_DOWNLOADS= -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DMYSQL_TCP_PORT= -DWITH_DEBUG=
make && make install
ln -s /lnmp/mysql-5.6./ /lnmp/mysql
/lnmp/mysql-5.6./scripts/mysql_install_db --user=mysql --basedir=/lnmp/mysql-5.6. --datadir=/lnmp/mysql-5.6./data --user=mysql
#授权
chown -R mysql:mysql /lnmp/mysql-5.6./
#创建目录,默认不会创建,但是启动会报错
mkdir /lnmp/mysql/tmp
[ $(echo $?) -eq ] && \cp -f /lnmp/mysql-5.6./support-files/my*.cnf /etc/my.cnf
cp /lnmp/mysql-5.6./support-files/mysql.server /etc/init.d/mysqld
# 加权限
chmod +x /etc/init.d/mysqld
# 自启
chkconfig --add mysqld
chkconfig mysqld on
# 加环境
PATH=$PATH:/lnmp/mysql-5.6./bin/
#添加环境
echo "export PATH=$PATH:/lnmp/mysql/bin/" >>/etc/profile
source /etc/profile
fi
}
#启动函数
start_mysql(){
/etc/init.d/mysqld start
if [ $(netstat -lutnp|grep |wc -l) -eq ]
then
action "mysql success" /bin/true
else
echo "mysql error!"
fi
} # 安装php
install_php(){
yum install zlib-devel openssl-devel openssl libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel libxslt-devel libmcrypt-devel mcrypt mhash -y
[ -e $dir ] && cd $dir
if [ -f $php_name ]
then
tar zxf $php_name && cd php-7.2. echo "Please witing loding................................................................"
#编译安装
./configure --prefix=/lnmp/php7.2.8 --with-mysql=/lnmp/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-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --enable-gd-native-ttf --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --enable-short-tags --enable-zend-multibyte --enable-static --with-xsl --with-fpm-user=nginx --with-fpm-group=nginx --enable-ftp
[ $(echo $?) -eq ] && ln -s /lnmp/mysql/lib/libmysqlclient.so. /usr/lib64/ && touch ext/phar/phar.phar
make >> /dev/null >&
make install
ln -s /lnmp/php7.2.8 /lnmp/php
cp ./php.ini-production /lnmp/php/lib/php.ini
cp /lnmp/php/etc/php-fpm.conf.default /lnmp/php/etc/php-fpm.conf
cp /lnmp/php/etc/php-fpm.d/www.conf.default /lnmp/php/etc/php-fpm.d/www.conf
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
#授予权限最好是700
chmod +x /etc/init.d/php-fpm
PATH=$PATH:/lnmp/php/bin/
echo "export PATH=$PATH:/lnmp/php/bin/" >>/etc/profile
source /etc/profile
chkconfig --add php-fpm
chkconfig php-fpm on
fi
} # 启动函数
start_phpfpm(){
/etc/init.d/php-fpm start
if [ $(netstat -lutnp|grep |wc -l) -eq ]
then
action "php-fpm success" /bin/true
else
echo "php-fpm error"
fi } main(){
install_nginx
sleep
install_mysql
sleep
install_php
start_nginx
sleep
start_mysql
sleep
start_phpfpm
}
main

环境搭建为lnmp

#by:kingle #
#use: fast lnmp #
#version:1.0 #
#php:php-7.2.8 #
#nginx: 1.15.1 #
#mysql:5.6.41 #
#cenos: 2.6.32-754.2.1.el6.x86_64

安装包需要自行下载,官网下载最好,下载完毕自己更改路径,这个脚本为最垃圾的脚本,纯小白编写,有兴趣可以一起讨论,编写内容很简单,因为完全贴合自己系统编写。

lnmp 一键搭建脚本的更多相关文章

  1. Linux系统下LNMP一键搭建Linux、PHP、MySQL环境(适合新手搭建linux下的web生成环境)

    一. 首先要解释一下,什么是LNMP,LNMP起源于LAMP,LAMP是Linux+Apache+Mysql/MariaDB+Perl/PHP/Python的缩写,这里将Web服务端的Apache替换 ...

  2. [svc]lnmp一键安装脚本(含有np与mysql分离)

    基于lanny一键安装包:(含lnmp所需软件及配置文件) 安装nginx: wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliy ...

  3. LNMP 一键安装脚本

    这个脚本是使用shell编写,为了快速在生产环境上部署lnmp/lamp/lnmpa(Linux.Nginx/Tengine/OpenResty.MySQL/MariaDB/Percona.PHP), ...

  4. LNMP一键安装脚本

    #!/bin/bash #LNMP(Fastcgi) #CentOS + MySQL 5.5 #-- iptables -F iptables -X iptables -Z iptables -A I ...

  5. 一键搭建LNMP脚本

    还有不足的地方,请谅解   2天时间刚做到安装mysql这里.... # [root@localhost ~]# cat /etc/centos-release # CentOS release 6. ...

  6. CentOS下Web服务器环境搭建LNMP一键安装包

    CentOS下Web服务器环境搭建LNMP一键安装包 时间:2014-09-04 00:50来源:osyunwei.com 作者:osyunwei.com 举报 点击:3797次 最新版本:lnmp- ...

  7. WIN10 vagrant和virtualbox虚拟机和一键搭建lnmp环境配置thinkphp虚拟主机

    版本:win10系统 virtualbox:5.1.26 vagrant :1.9.7 centos 7.0 xshell/git 首先下载好对应版本的软件 配置vagrant和virtualbox ...

  8. Linux下Web服务器环境搭建LNMP一键安装包[20130911更新]

    2012年08月14日 ⁄ LNMP ⁄ 评论数 73 ⁄ 被围观 25,200次+ 最新版本:lnmp-2.4 安装说明:请保证服务器能够正常上网.服务器系统时间准确.yum命令可以正常使用! 1. ...

  9. LNMP、LAMP、LANMP一键安装脚本(定期更新)[转]

    这个脚本是使用shell编写,为了快速在生产环境上部署LNMP/LAMP/LANMP(Linux.Nginx/Tengine.MySQL/MariaDB/Percona.PHP),适用于CentOS/ ...

随机推荐

  1. JAVA WEB第0课

            在这学期内要掌握JAVA WAB高级网站开发的所有知识,并可以实际运用到.每周将花费20小时左右的时间来学习此门课程,每一天,在当天其他课程任务完成后将开始学习该课程,具体时间要看当天 ...

  2. could not read data from '/Users/lelight/Desktop/ViewControllerLife/ViewControllerLife/Info.plist': The file “Info.plist” couldn’t be opened because there is no such file.

    1.Info.plist放置至新文件夹下,路径被修改了,报错. could not read data from '/Users/lelight/Desktop/ViewControllerLife/ ...

  3. 采样器----Debug Sampler

    Debug Sampler可以产生所有JMeter变量和属性的样本,可以在View Tree Result的响应中查看变量的值,此取样器在调试脚本阶段可以很方便的看到变量的值,在正式运行脚本的过程中应 ...

  4. 「BZOJ 3123」「SDOI 2013」森林「启发式合并」

    题意 你有一个森林,你需要支持两个操作 查询两个结点路径上权值第\(k\)小 两个点之间连一条边 强制在线,结点数\(\leq 8\times 10^4\) 题解 如果可以离线,这就是一个主席树板子题 ...

  5. 20165219 2017-2018-2 《Java程序设计》第5周学习总结

    20165219 2017-2018-2 <Java程序设计>第5周学习总结 课本知识总结 第7章 内部类与异常类 一 1 内部类:类的一种成员 2 外嵌类:包含内部类的类称为内部类的外嵌 ...

  6. scrapy 爬取天猫商品信息

    spider # -*- coding: utf-8 -*- from urllib.parse import urlencode import requests import scrapy impo ...

  7. 【ARC083E】Bichrome Tree 树形dp

    Description 有一颗N个节点的树,其中1号节点是整棵树的根节点,而对于第ii个点(2≤i≤N)(2≤i≤N),其父节点为PiPi 对于这棵树上每一个节点Snuke将会钦定一种颜色(黑或白), ...

  8. 1. UML统一建模语言

    (1)UML概述: 建模: 对现实系统进行适当的过滤, 用适当的表现规则描述出简洁的模型. 建模是一种深入解决问题的方法. UML: UML(United Modeling Language, 统一建 ...

  9. python3入门之列表和元组

    获得更多资料欢迎进入我的网站或者 csdn或者博客园 前面一张主要学习了Python的安装,以及第一个程序helloword的编写,以及简单的输入和输出函数,这章主要介绍序列,列表,元组 序列  这章 ...

  10. centos安装mysql57

    下载源安装文件 https://dev.mysql.com/downloads/repo/yum/ wget http://repo.mysql.com//mysql57-community-rele ...