10 一键部署LNMP网站平台
#!/bin/bash
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin NGINX_V=1.19.1
PHP_V=7.2.19
TMP_DIR=/tmp
INSTALL_DIR=/usr/local
PWD_C=$PWD echo
echo -e "\tMenu\n"
echo -e "1. Install Nginx"
echo -e "2. Install PHP"
echo -e "3. Install MySQL"
echo -e "4. Deploy LNMP"
echo -e "9. Quit" if ! id nginx &> /dev/null; then
groupadd -g 1200 nginx
useradd -M -s /sbin/nologin -u 1200 -g nginx nginx &> /dev/null
fi function command_status_check() {
if [ $? -ne 0 ]; then
echo $1
exit
fi
} function install_nginx() {
cd $TMP_DIR
yum install -y gcc gcc-c++ make openssl-devel pcre-devel wget
wget http://nginx.org/download/nginx-${NGINX_V}.tar.gz
tar zxf nginx-${NGINX_V}.tar.gz
cd nginx-${NGINX_V}
./configure --prefix=$INSTALL_DIR/nginx \
--user=nginx \
--group=nginx \
--with-http_ssl_module \
--with-http_stub_status_module \
--with-stream
command_status_check "Nginx - 平台环境检查失败!"
make -j 4
command_status_check "Nginx - 编译失败!"
make install
command_status_check "Nginx - 安装失败!"
mkdir -p $INSTALL_DIR/nginx/conf/conf.d
cp -a $PWD_C/nginx.conf $INSTALL_DIR/nginx/conf
rm -rf $INSTALL_DIR/nginx/html/*
echo "ok" > $INSTALL_DIR/nginx/html/status.html
echo '<?php phpinfo(); ?>' > $INSTALL_DIR/nginx/html/status.php
# $INSTALL_DIR/nginx/sbin/nginx
cp -a $PWD_C/nginx.service /usr/lib/systemd/system
systemctl daemon-reload
systemctl enable nginx.service
systemctl start nginx.service
command_status_check "Nginx - 启动失败!"
} function install_php() {
cd $TMP_DIR
yum install -y gcc gcc-c++ make gd-devel libxml2-devel \
libcurl-devel libjpeg-devel libpng-devel openssl-devel \
libmcrypt-devel libxslt-devel libtidy-devel
wget http://docs.php.net/distributions/php-${PHP_V}.tar.gz
tar zxf php-${PHP_V}.tar.gz
cd php-${PHP_V}
./configure --prefix=$INSTALL_DIR/php \
--with-config-file-path=$INSTALL_DIR/php/etc \
--enable-fpm --enable-opcache \
--with-fpm-user=nginx \
--with-fpm-group=nginx \
--with-mysql --with-mysqli --with-pdo-mysql \
--with-openssl --with-zlib --with-curl --with-gd \
--with-jpeg-dir --with-png-dir --with-freetype-dir \
--enable-mbstring --enable-hash
command_status_check "PHP - 平台环境检查失败!"
make -j 4
command_status_check "PHP - 编译失败!"
make install
command_status_check "PHP - 安装失败!"
cp -a php.ini-production $INSTALL_DIR/php/etc/php.ini
cp -a $INSTALL_DIR/php/etc/php-fpm.conf.default $INSTALL_DIR/php/etc/php-fpm.conf
cp -a $INSTALL_DIR/php/etc/php-fpm.d/www.conf.default $INSTALL_DIR/php/etc/php-fpm.d/www.conf
cp -a sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm
# /etc/init.d/php-fpm start
cp -a $PWD_C/php.service /usr/lib/systemd/system
systemctl daemon-reload
systemctl enable php.service
systemctl start php.service
command_status_check "PHP - 启动失败!"
} function install_mysql() {
yum install mariadb-server -y
command_status_check "mysql - 安装失败!"
systemctl enable mariadb.service
systemctl start mariadb.service
command_status_check "mysql - 启动失败!"
} read -p "请输入编号:" number
case $number in
1)
install_nginx;;
2)
install_php;;
3)
install_mysql;;
4)
install_mysql
install_nginx
install_php
;;
9)
exit;;
esac
10 一键部署LNMP网站平台的更多相关文章
- Docker Compose 一键部署LNMP
Docker Compose 一键部署LNMP 目录结构 [root@localhost ~]# tree compose_lnmp/ compose_lnmp/ ├── docker-compose ...
- Docker: 快速搭建LNMP网站平台
快速搭建LNMP网站平台 步骤: 1.自定义网络(这里建立一个自定义网络,名字叫 lnmp, 让LNMP网站的服务,都加入这个自定义网络)docker network create lnmp2.创建M ...
- 红象云腾CRH 一键部署大数据平台
平台: arm 类型: ARM 模板 软件包: azkaban hadoop 2.6 hbase hive kafka spark zeppelin azkaban basic software bi ...
- 一键部署lnmp
一键部署lnmp 提前将nginx .mysql .php 所需安装包都放在/opt目录下 脚本启动结束时,重启一下nginx 服务,就能在火狐浏览器更新出php测试页 脚本如下:(脚本里的软件 ...
- Docker进阶之八:搭建LNMP网站平台实战
搭建LNMP网站平台实战 LNMP是指一组通常一起使用来运行动态网站或者服务器的自由软件名称首字母缩写.L指Linux,N指Nginx,M一般指MySQL,也可以指MariaDB,P一般指PHP,也可 ...
- 【shell脚本】一键部署LNMP===deploy.sh
一键部署mysql,php,nginx,通过源码安装部署 #!/bin/bash # 一键部署 LNMP(源码安装版本) menu() { clear echo " ############ ...
- 使用Docker 一键部署 LNMP+Redis 环境
使用Docker 部署 LNMP+Redis 环境 Docker 简介 Docker 是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的 Linu ...
- Git+Gitlab+Ansible剧本实现一键部署动态网站(二)--技术流ken
项目前言 之前已经写了一篇关于git和ansible的博客<Git+Gitlab+Ansible剧本实现一键部署Nginx--技术流ken>.关于git,gitliab,ansible在我 ...
- Git+Gitlab+Ansible剧本实现一键部署动态网站(5)
项目前言 之前已经写了一篇关于git和ansible的博客<Git+Gitlab+Ansible剧本实现一键部署Nginx–技术流ken>.关于git,gitliab,ansible在我以 ...
随机推荐
- [Java] 分布式消息队列(MQ)
概述 场景 服务解耦 削峰填谷 异步化缓冲:最终一致性/柔性事务 MQ应用思考点 生产端可靠性投递 消费端幂等:消息只能消费一次 高可用.低延迟.可靠性 消息堆积能力 可扩展性 业界主流MQ Acti ...
- mysql基础之mysql双主(主主)架构
一.概念 在企业中,数据库高可用一直是企业的重中之重,中小企业很多都是使用mysql主从方案,一主多从,读写分离等,但是单主存在单点故障,从库切换成主库需要作改动.因此,如果是双主或者多主,就会增加m ...
- linux中级之lvs配置(命令)
一.nat模式配置 环境说明: DS:nat网卡(自动获取也可以,充当vip): 192.168.254.13 255.255.255.0 vmnet3网卡(仅主机): 172.16.100.1 25 ...
- 3.14-19 wc、iconv、dos2unix、diff、vimdiff、rev
3.14 wc:统计文件的行数.单词数或字节数 wc命令用于统计文件的行数.单词数或字节数. -c 统计字节数 -w 统计单词数 -l 统计行数 -L 打印最长行的长度 -m 统计字符数 ...
- 有关Git基础操作的学习
Git简介 Git是一个免费的开源 分布式版本控制系统,旨在快速高效地处理从小型到大型项目的所有内容. Git 易于学习, 占地面积小,具有闪电般的快速性能.它具有诸如Subversion,CVS,P ...
- paramiko 详解
Paramiko是用python语言写的一个模块,远程连接到Linux服务器,查看上面的日志状态,批量配置远程服务器,文件上传,文件下载等 初始化一些参数: host = "120.24.2 ...
- GO学习-(12) Go语言基础之函数
Go语言基础之函数 函数是组织好的.可重复使用的.用于执行指定任务的代码块.本文介绍了Go语言中函数的相关内容. 函数 Go语言中支持函数.匿名函数和闭包,并且函数在Go语言中属于"一等公民 ...
- Go语言协程并发---条件变量
package main import ( "fmt" "sync" "time" ) func main() { //要监听的变量 bit ...
- ZooKeeper学习笔记二:API基本使用
Grey ZooKeeper学习笔记二:API基本使用 准备工作 搭建一个zk集群,参考ZooKeeper学习笔记一:集群搭建. 确保项目可以访问集群的每个节点 新建一个基于jdk1.8的maven项 ...
- final 修饰符
修饰属性,方法,类 1.修饰属性 属性只能被赋值一次 基本类型:值不能改变 引用类型:引用不可以被修改 2.修饰方法 表示方法不可以被重写,但可以被子类访问 3.修饰类 表示类不可以被继承 //fin ...