#!/bin/bash
#2020年3月1日
#auto_install_lnmp.
#by fly
################################
NGX_VER="$1"
NGX_SOFT="nginx-${1}"
NGX_YUM="yum install -y"
NGX_DIR="/usr/local/nginx"
NGX_SRC="nginx-${1}.tar.gz"
NGX_URL="http://nginx.org/download"
NGX_ASGC="--user=nginx --group=nginx --with-http_stub_status_module --with-http_ssl_module" #安装nginx
function install_nginx(){
$NGX_YUM gcc-c++ pcre pcre-devel zlib zlib-devel
$NGX_YUM wget make openssl openssl-devel net-tools
cd /usr/src
wget -c $NGX_URL/$NGX_SRC
tar -zxvf $NGX_SRC
cd $NGX_SOFT
useradd nginx
./configure --prefix=$NGX_DIR $NGX_ASGC
make && make install
$NGX_DIR/sbin/nginx -t
$NGX_DIR/sbin/nginx
#setenforce 0
systemctl stop firewalld.service
echo "$NGX_DIR/sbin/nginx" >>/etc/rc.local
ps -ef|grep nginx
netstat -nutlp|grep 80
echo -e "\033[32m nginx安装成功. \033[0m"
$NGX_DIR/sbin/nginx -v
exit
}
SQL_USER="mysql"
SQL_DB="/data/mysql"
SQL_SOFT="mysql-5.5.60"
SQL_YUM="yum install -y"
SQL_SER="/etc/init.d/mysqld"
SQL_DIR="/usr/local/mysql55"
SQL_SRC="mysql-5.5.60.tar.gz"
SQL_ASGC="${SQL_DIR}/scripts/mysql_install_db"
SQL_URL="http://mirrors.sohu.com/mysql/MySQL-5.5" #安装mysql
function install_mysql(){
$SQL_YUM ncurses ncurses-devel cmake make
cd /usr/src
wget -c $SQL_URL/$SQL_SRC
tar zxvf $SQL_SRC
cd $SQL_SOFT
cmake . -DCMAKE_INSTALL_PREFIX=$SQL_DIR \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DMYSQL_DATADIR=$SQL_DB \
-DSYSCONFDIR=/etc \
-DMYSQL_USER=$SQL_USER \
-DMYSQL_TCP_PORT=3306 \
-DWITH_XTRADB_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_EXTRA_CHARSETS=1 \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DEXTRA_CHARSETS=all \
-DWITH_BIG_TABLES=1 \
-DWITH_DEBUG=0
make && make install
cd $SQL_DIR/
\cp support-files/my-large.cnf /etc/my.cnf
\cp support-files/mysql.server $SQL_SER
chmod +x $SQL_SER
chkconfig --add mysqld
chkconfig --level 35 mysqld on
mkdir -p $SQL_DB
useradd $SQL_USER
$SQL_ASGC --user=${SQL_USER} --datadir=${SQL_DB}/ --basedir=${SQL_DIR}
ln -s $SQL_DIR/bin/* /usr/bin/
service mysqld restart
ps -ef|grep mysqld
netstat -nutlp|grep 3306
echo -e "\033[32m MySQL安装成功. \033[0m"
exit
}

#PHP_VER="$1"
PHP_SOFT="php-5.6.22"
PHP_YUM="yum install -y"
PHP_SRC="php-$5.6.22.tar.gz"
PHP_DIR="/usr/local/php"
PHP_SER="/etc/init.d/php-fpm"
PHP_URL="http://mirrors.sohu.com/php"
PHP_ASGC="--prefix=/usr/local/php --enable-fpm --enable-debug --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --enable-mbstring --with-curl --with-mysql=/usr/local/mysql55 --with-mysqli=/usr/local/mysql55/bin/mysql_config --with-gettext --enable-mbstring --enable-bcmath --with-libxml-dir --enable-sockets --with-curl --with-zlib --with-gd --with-freetype-dir --with-jpeg-dir --with-png-dir--with-config-file-path=/usr/local/php5/etc --with-zlib-dir " #安装PHP
function install_php(){
$PHP_YUM freetype freetype-devel libxml2 libxml2-devel
$PHP_YUM gd curl curl-devel libjpeg libjpeg-devel libpeg libpeg-devel
cd /usr/src
wget -c $PHP_URL/$PHP_SRC
tar xf $PHP_SRC
cd $PHP_SOFT
./configure $PHP_ASGC
make && make install
cp php.ini-development $PHP_DIR/etc/php.ini
cp $PHP_DIR/etc/php-fpm.conf.default $PHP_DIR/etc/php-fpm.conf
cp sapi/fpm/init.d.php-fpm $PHP_SER
chmod o+x $PHP_SER
$PHP_SER start
ps -ef|grep php-fpm
netstat -nutlp|grep 9000
echo -e "\033[32m php安装成功. \033[0m"
exit
} #LNMP_CONFIG整合
function lnmp_config(){
echo "
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location / {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
include fastcgi_params;
}
}
}" >$NGX_DIR/conf/nginx.conf echo "
<?php
phpinfo();
?>">$NGX_DIR/html/index.php
sed -i '/user/s/nobody/nginx/g;/group/s/nobody/nginx/g' /usr/local/php5/etc/php-fpm.conf
$NGX_DIR/sbin/nginx -s reload
$PHP_SER restart
cat $NGX_DIR/conf/nginx.conf
cat $NGX_SIR/html/index.php
echo -e "\033[32m lnmp_config_web 整合ok!!! \033[0m"
exit
} PS3=`echo -e "\033[32m/usr/bin/ auto_install_lnmp.sh 1)|2)|3)|4)|5)| 版本:\033[0m"`
select i in nginx_install mysql_install php_install lnmp_config_web exit
do
case $i in
nginx_install )
install_nginx
;;
mysql_install )
install_mysql
;;
php_install )
install_php
;;
lnmp_config_web )
lnmp_config
;;
exit )
;;
* )
echo -e "\033[33m------------------------\033[0m"
echo -e "\033[32m1)安装nginx. 2)安装mysql.\033[0m"
echo -e "\033[32m3)安装php. 4)lnmp-web整合\033[0m"
echo -e "\033[33m/usr/bin/ auto_install_lnmp.sh 1)|2)|3)|4) :\033[0m"
exit
;;
esac
done

  

一键安装LNMP的更多相关文章

  1. 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 ...

  2. Shell脚本一键安装LNMP环境

    https://sourceforge.net/projects/opensourcefile/files/ Nginx是一款高性能的HTTP和反向代理服务器.Nginx在反向代理,Rewrite规则 ...

  3. 一键安装LNMP(适合centos7)

    1.准备工作,下载源码包 wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.22-linux-glibc2.12-x86_64.tar ...

  4. Linux一键安装LNMP环境

    Linux一键安装LNMP环境 官方地址:https://lnmp.org/. 参考安装步骤:https://lnmp.org/install.html. 一键安装可以选择mysql版本.php版本, ...

  5. Linux安装swoole拓展 (一键安装lnmp后安装可用完美)

    一键安装lnmp后安装可用完美 swoole(一键安装完lnmp重启下,之前出现502一直解决不了,不清楚啥情况) 找到对应php版本,在lnmp文件夹的src 1.安装swoole cd /usr/ ...

  6. ubuntu 一键安装lnmp环境

    转载csdn: ubuntu 一键安装lnmp环境_手艺人小在的博客-CSDN博客 注意:采用编译安装方法,花费时间较长,这个只有稳定版的,没有高版本的. 转载vpsgo: Linux上一键安装LNM ...

  7. 一键安装Lnmp教程

    LNMP一键安装包 系统需求: CentOS/RHEL/Fedora/Debian/Ubuntu/Raspbian Linux系统 需要3GB以上硬盘剩余空间 128M以上内存,Xen的需要有SWAP ...

  8. 【Linux】Centos6.8下一键安装Lnmp/Lamp环境

    [下载一键安装软件包] 百度云地址:https://pan.baidu.com/s/1TZqGKtE-46gxW96Ptfp4gA 网址:https://lnmp.org/ [步骤] 通过第三方远程工 ...

  9. 一键安装LNMP/LAMP

    安装步骤:1.使用putty或类似的SSH工具登陆VPS或服务器: 登陆后运行:yum install screen安装  screen screen -S lnmp创建一个名字为lnmp的会话 2. ...

  10. 一键安装 lnmp/lamp/lanmp

    1.使用putty或类似的SSH工具登陆VPS或服务器 # screen -S lnmp 如果提示screen: command not found 命令不存在可以执行:yum install scr ...

随机推荐

  1. Linux中常用数据库管理系统之MariaDB

    Linux中常用数据库管理系统之MariaDB 我们生活在信息化时代,经常要跟数据打交道,它在我们的日常生活中无处不在,比如手机支付,微信聊天,淘宝购物,使用的这些在后台都会对应一个叫数据库的存在.数 ...

  2. [数据分析与可视化] 基于plottable库绘制精美表格

    plottable是一个Python库,用于在matplotlib中绘制精美定制的图形表格.plottable的官方仓库地址为:plottable.本文主要参考其官方文档,plottable的官方文档 ...

  3. 【调制解调】ISB 独立边带调幅

    说明 学习数字信号处理算法时整理的学习笔记.同系列文章目录可见 <DSP 学习之路>目录,代码已上传到 Github - ModulationAndDemodulation.本篇介绍 IS ...

  4. 2023年icpc大学生程序设计竞赛-nhr

    icpc的省赛是在洛阳举办,第一次出省,还是两天,第一次离开郑州去别的城市比赛,心情更多的是激动,非常感谢老师给了这次机会,第一天20号,打完热身赛之后回寝室,和队友一起看了一下去年省赛的题,感觉还是 ...

  5. Linux切换Root权限配置和无法切换排查

    1.wheel组 普通用户禁止su切换root 在默认的情况下,普通用户通过su可以切换到root用户下,为了加强系统安全性,使用Linux的特殊用户组wheel来实现,只有用户加入到wheel组当中 ...

  6. python打包方法

    在Python中,要编写setup.py文件,用于构建和打包你的Python项目,你可以遵循以下步骤: 创建项目目录结构:首先,你需要创建项目的目录结构,包括源代码文件.资源文件等.一个常见的项目结构 ...

  7. 一个从文件中过滤指定字符串的python3脚本

    from tabulate import tabulate plugin = [ ... ] plugin_v1 = [ ... ] filepath = "E:\\PycharmProje ...

  8. python:map函数

    参考示例 def test(x): return x * 2 mylist = [1, 2, 3, 4, 5] result = list(map(test, mylist)) print(resul ...

  9. UiAutomator2.0(转)

    1.     概述 UI测试(功能测试.黑盒测试)不需要测试者了解应用程序的内部实现细节,只需要知道当执行了某些特定的动作后是否会得到其预期的输出.这种测试方法,在团队合作中可以更好地分离的开发和测试 ...

  10. Tibos.Devops项目介绍

    诞生背景 随着微服务的普及,更多的企业选择迁移到云,传统的部署方式已经无法满足需求,市面上devops产品也应运而生,结合自己使用的经验,也制作了一款同类产品,并开源出来,与大家一起探讨学习 前置条件 ...