|NO.Z.00063|——————————|^^ 部署 ^^|——|Linux&LNMP&部署脚本.V03-|——|LNMP部署|脚本方式|
一、概述
### --- 地址
~~~ 一键安装包地址:https://lnmp.org/
~~~ 下载最新稳定版本:软件数量比较全,版本比较新
~~~ #下载版:
~~~ 里边不包含任何的源码软件包,只包含配置文件;必须连接网络才可以使用部署
~~~ #完整版:
~~~ 里面包含所有的源码软件包,不连接互联网,使用本地yum源就可以部署
~~~ 适用于个人小网站,单台服务器,集群是不合适的。
一、部署安装:环境准备
### --- 下载lnmp1.7或者1.5一键安装包
wget http://soft.vpser.net/lnmp/lnmp1.7-full.tar.gz
wget http://soft.vpser.net/lnmp/lnmp1.5-full.tar.gz
### --- 将lnmp1.7软件包上传到服务器上
### --- 可以选择安装那个版本:比如想安装lamp或者lnmp都可以自己去定义
lnmp1.7-full.tar.gz
### --- 一键执行命令
wget http://soft.vpser.net/lnmp/lnmp1.7.tar.gz -cO lnmp1.7.tar.gz && tar zxf lnmp1.7.tar.gz && cd lnmp1.7 && ./install.sh lnmp
二、部署安装
### --- 部署安装LNMP
[root@server11 ~]# tar -zxvf lnmp1.7-full.tar.gz
[root@server11 ~]# cd lnmp1.7-full/
[root@server11 lnmp1.7-full]# ./install.sh // 默认是lnmp
~~~ # OR
[root@server11 lnmp1.7-full]# ./install.sh lamp
~~~ # OR
[root@server11 lnmp1.7-full]# ./install.sh lnmp
~~~ # OR
[root@server11 lnmp1.7-full]# ./install.sh lnmpa
+------------------------------------------------------------------------+
| LNMP V1.7 for CentOS Linux Server, Written by Licess |
+------------------------------------------------------------------------+
| A tool to auto-compile & install LNMP/LNMPA/LAMP on Linux |
+------------------------------------------------------------------------+
| For more information please visit https://lnmp.org |
+------------------------------------------------------------------------+
You have 11 options for your DataBase install.
1: Install MySQL 5.1.73
2: Install MySQL 5.5.62 (Default) // 默认
3: Install MySQL 5.6.48
4: Install MySQL 5.7.30
5: Install MySQL 8.0.20
6: Install MariaDB 5.5.68
7: Install MariaDB 10.1.45
8: Install MariaDB 10.2.32
9: Install MariaDB 10.3.23
10: Install MariaDB 10.4.13
0: DO NOT Install MySQL/MariaDB
Enter your choice (1, 2, 3, 4, 5, 6, 7, 8, 9, 10 or 0): // 默认是5.5,直接回车默认
No input,You will install MySQL 5.5.62
===========================
Please setup root password of MySQL.
Please enter: 123456
MySQL root password: 123456
===========================
Do you want to enable or disable the InnoDB Storage Engine?
Default enable,Enter your choice [Y/n]:y // 是否启用存储引擎,启用
You will enable the InnoDB Storage Engine
===========================
You have 9 options for your PHP install.
1: Install PHP 5.2.17
2: Install PHP 5.3.29
3: Install PHP 5.4.45
4: Install PHP 5.5.38
5: Install PHP 5.6.40 (Default)
6: Install PHP 7.0.33
7: Install PHP 7.1.33
8: Install PHP 7.2.34
9: Install PHP 7.3.23
10: Install PHP 7.4.12
Enter your choice (1, 2, 3, 4, 5, 6, 7, 8, 9, 10): 7 // PHP的版本,默认是5.6.40,在这里我们选择7.1.33
You will install PHP 7.1.33
~~~ #默认选择LNMP部署显示以下选项
===========================
You have 3 options for your Memory Allocator install.
1: Don't install Memory Allocator. (Default)
2: Install Jemalloc
3: Install TCMalloc
Enter your choice (1, 2 or 3): // 内存优化工具,默认不安装
No input,You will not install Memory Allocator. // 直接回车安装lnmp
~~~ # OR #LAMP或LNMPA部署安装会显示以下选项
===========================
Please enter Administrator Email Address: // 管理员有限
Administrator Email Address will set to webmaster@example.com!
===========================
You have 2 options for your Apache install.
1: Install Apache 2.2.34
2: Install Apache 2.4.46 (Default)
Enter your choice (1 or 2): // Apache默认版本:2.4.46版本
~~~ # OR #LNMPA部署安装显示以下选项
===========================
Please enter Administrator Email Address:
Administrator Email Address will set to webmaster@example.com!
===========================
You have 2 options for your Apache install.
1: Install Apache 2.2.34
2: Install Apache 2.4.46 (Default)
Enter your choice (1 or 2):
Press any key to install...or Press Ctrl+c to cancel
============================== Check install ==============================
Checking ...
Nginx: OK
MySQL: OK
PHP: OK
PHP-FPM: OK
Clean Web Server src directory...
+------------------------------------------------------------------------+
| LNMP V1.7 for CentOS Linux Server, Written by Licess |
+------------------------------------------------------------------------+
| For more information please visit https://lnmp.org |
+------------------------------------------------------------------------+
| lnmp status manage: lnmp {start|stop|reload|restart|kill|status} |
+------------------------------------------------------------------------+
| phpMyAdmin: http://IP/phpmyadmin/ |
| phpinfo: http://IP/phpinfo.php |
| Prober: http://IP/p.php |
+------------------------------------------------------------------------+
| Add VirtualHost: lnmp vhost add |
+------------------------------------------------------------------------+
| Default directory: /home/wwwroot/default |
+------------------------------------------------------------------------+
| MySQL/MariaDB root password: 123456 |
+------------------------------------------------------------------------+
+-------------------------------------------+
| Manager for LNMP, Written by Licess |
+-------------------------------------------+
| https://lnmp.org |
+-------------------------------------------+
nginx (pid 109231) is running...
php-fpm is runing!
SUCCESS! MySQL running (109788)
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 50 *:3306 *:*
LISTEN 0 128 *:80 *:*
LISTEN 0 128 *:80 *:*
Install lnmp takes 31 minutes.
Install lnmp V1.7 completed! enjoy it.
### --- 安装时需要拷贝到操作系统的文件
[root@server11 ~]# ls lnmp1.7-full/ // 安装时需要拷贝到操作系统的文件
addons.sh:
install.sh: // 安装脚本
lnmp.conf:
pureftpd.sh: // ftp的软件和vsftpd是同类型的,实现的功能是一样的
uninstall.sh: // 卸载脚本
upgrade1.x-1.7.sh:
upgrade.sh: // 更新lnmp的更新脚本
conf:
include:
init.d:
src: // 安装是选择的安装包的列表
tools:
### --- 卸载:
[root@server11 lnmp1.7-full]# ./uninstall.sh
+------------------------------------------------------------------------+
| LNMP V1.7 for CentOS Linux Server, Written by Licess |
+------------------------------------------------------------------------+
| A tool to auto-compile & install Nginx+MySQL+PHP on Linux |
+------------------------------------------------------------------------+
| For more information please visit https://lnmp.org |
+------------------------------------------------------------------------+
Current Stack: unknow
Enter 1 to uninstall LNMP
Enter 2 to uninstall LNMPA
Enter 3 to uninstall LAMP
(Please input 1, 2 or 3): // 选择卸载的环境
### --- 升级:
[root@server11 lnmp1.7-full]# ./upgrade.sh
+-----------------------------------------------------------------------+
| Upgrade script for LNMP V1.7, Written by Licess |
+-----------------------------------------------------------------------+
| A tool to upgrade Nginx,MySQL/Mariadb,PHP for LNMP/LNMPA/LAMP |
+-----------------------------------------------------------------------+
| For more information please visit https://lnmp.org |
+-----------------------------------------------------------------------+
1: Upgrade Nginx
2: Upgrade MySQL
3: Upgrade MariaDB
4: Upgrade PHP for LNMP
5: Upgrade PHP for LNMPA or LAMP
6: Upgrade MySQL to MariaDB
7: Upgrade phpMyAdmin
8: Upgrade Multiple PHP
exit: Exit current script
###################################################
Enter your choice (1, 2, 3, 4, 5, 6, 7 or exit): // 选择升级的软件
三、管理维护
### --- 默认维护管理操作地址
~~~ 默认LNMP是不安装FTP服务器的,
~~~ 如需要FTP服务器:https://lnmp.org/faq/ftpserver.html
### --- 添加、删除虚拟主机及伪静态管理
https://lnmp.org/faq/lnmp-vhost-add-howto.html
### --- eAccelerator、xcache、memcached、imageMagick、ionCube、redis、opcache的安装
https://lnmp.org/faq/addons.html
### --- LNMP相关软件目录及文件位置
https://lnmp.org/faq/lnmp-software-list.html
### --- LNMP状态管理命令
https://lnmp.org/faq/lnmp-status-manager.html
### --- 维护命令
~~~ LNMP状态管理命令:
~~~ LNMP 1.2+状态管理:
lnmp {start|stop|reload|restart|kill|status}
~~~ LNMP 1.2+各个程序状态管理:
lnmp {nginx|mysql|mariadb|php-fpm|pureftpd} {start|stop|reload|restart|kill|status}
~~~ LNMP 1.1状态管理:
/root/lnmp {start|stop|reload|restart|kill|status}
~~~ Nginx状态管理:
/etc/init.d/nginx {start|stop|reload|restart}
~~~ MySQL状态管理:
/etc/init.d/mysql {start|stop|restart|reload|force-reload|status}
~~~ Memcached状态管理:
/etc/init.d/memcached {start|stop|restart}
~~~ PHP-FPM状态管理:
/etc/init.d/php-fpm {start|stop|quit|restart|reload|logrotate}
~~~ PureFTPd状态管理:
/etc/init.d/pureftpd {start|stop|restart|kill|status}
~~~ ProFTPd状态管理:
/etc/init.d/proftpd {start|stop|restart|reload}
~~~ Redis状态管理:
/etc/init.d/redis {start|stop|restart|kill}
### --- 多PHP版本状态管理:
/etc/init.d/php-fpm5.5 {start|stop|quit|restart|reload|logrotate} // 前面5.5为对应的PHP版本,其他版本自行替换。
~~~ 如重启LNMP,1.2+输入命令:lnmp restart 即可;单独重启mysql:
/etc/init.d/mysql restart // 也可以 lnmp mysql restart ,两个是一样的。
### --- LNMPA 1.2+状态管理:
lnmp {start|stop|reload|restart|kill|status}
~~~ LNMPA 1.2+各个程序状态管理:
lnmp {httpd|mysql|mariadb|pureftpd} {start|stop|reload|restart|kill|status}
~~~ LNMPA1.1状态管理:
/root/lnmpa {start|stop|reload|restart|kill|status}
~~~ Nginx状态管理:
/etc/init.d/nginx {start|stop|reload|restart}
~~~ MySQL状态管理:
/etc/init.d/mysql {start|stop|restart|reload|force-reload|status}
~~~ Memcached状态管理:
/etc/init.d/memcached {start|stop|restart}
~~~ PureFTPd状态管理:
/etc/init.d/pureftpd {start|stop|restart|kill|status}
~~~ ProFTPd状态管理:
/etc/init.d/proftpd {start|stop|restart|reload}
~~~ Apache状态管理:
/etc/init.d/httpd {start|stop|restart|graceful|graceful-stop|configtest|status}
### --- LAMP状态管理命令:
~~~ LAMP 1.2+状态管理:
lnmp {start|stop|reload|restart|kill|status}
~~~ LAMP 1.2+各个程序状态管理:
lnmp {httpd|mysql|mariadb|pureftpd} {start|stop|reload|restart|kill|status}
### --- 维护操作
[root@server11 lnmp1.7-full]# lnmp status
+-------------------------------------------+
| Manager for LNMP, Written by Licess |
+-------------------------------------------+
| https://lnmp.org |
+-------------------------------------------+
nginx (pid 109231) is running...
php-fpm is runing!
SUCCESS! MySQL running (109788)
Walter Savage Landor:strove with none,for none was worth my strife.Nature I loved and, next to Nature, Art:I warm'd both hands before the fire of life.It sinks, and I am ready to depart
——W.S.Landor
分类:
cdv007-network
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通