LNMP一键安装包是什么?

  • L:Linux,N:Nginx,M:MySQL,P:PHP

    LNMP一键安装包是一个用Linux Shell编写的可以为CentOS/RHEL/Fedora/Aliyun/Amazon、Debian/Ubuntu/Raspbian/Deepin/Mint Linux VPS或独立主机安装LNMP(Nginx/MySQL/PHP)、LNMPA(Nginx/MySQL/PHP/Apache)、LAMP(Apache/MySQL/PHP)生产环境的Shell程序。
    具体可以参考LNMP官网

LNMP下载安装

准备工作

开始安装

  • 由于新版本LNMP可一键设置SSL,故推荐优先安装最新版本,我选择的是1.6版本。
  • 创建screen会话:screen -S lamp
  • 如果安装过程中出现异常中断,重新登入服务器后,可以输入screen -r lamp恢复安装界面。
1
wget -c http://soft.vpser.net/lnmp/lnmp1.6-full.tar.gz && tar -zxf lnmp1.6-full.tar.gz && cd lnmp1.6-full && ./install.sh lamp
  • 选项一般默认就可以了,如果需要修改,具体含义可以参照官网介绍
  • 设置的数据库ROOT密码一定要记着,以后会用到的!!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
+------------------------------------------------------------------------+
| LNMP V1.5 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 10 options for your DataBase install.
1: Install MySQL 5.1.73
2: Install MySQL 5.5.62 (Default)
3: Install MySQL 5.6.44
4: Install MySQL 5.7.26
5: Install MySQL 8.0.13
6: Install MariaDB 5.5.63
7: Install MariaDB 10.0.38
8: Install MariaDB 10.1.40
9: Install MariaDB 10.2.24
10: Install MariaDB 10.3.15
0: DO NOT Install MySQL/MariaDB
Enter your choice (1, 2, 3, 4, 5, 6, 7, 8, 9, 10 or 0): 2
You will install MySQL 5.5.62
===========================
Please setup root password of MySQL.
Please enter: mysqlpasswd
===========================
Do you want to enable or disable the InnoDB Storage Engine?
Default enable,Enter your choice [Y/n]: n
You will disable the InnoDB Storage Engine!
===========================
You have 8 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.29
8: Install PHP 7.2.18
9: Install PHP 7.3.5
Enter your choice (1, 2, 3, 4, 5, 6, 7 8 or 9): 8
You will install PHP 7.2.18
===========================
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): 1
You will install not install Memory Allocator.
===========================
Please enter Administrator Email Address: admin@seoimo.com
===========================
Server Administrator Email: admin@seoimo.com
===========================
You have 2 options for your Apache install.
1: Install Apache 2.2.34
2: Install Apache 2.4.39 (Default)
Enter your choice (1 or 2): 2
You will install Apache 2.4.39
Press any key to install...or Press Ctrl+c to cancel
  • 当出现Press any key to install...or Press Ctrl+c to cancel后,按回车键确认开始安装。
  • 安装时间可能会几十分钟到几个小时不等,主要是机器的配置网速等原因会造成影响。
1
2
3
4
5
6
7
8
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp6 0 0 :::80 :::* LISTEN
tcp6 0 0 :::22 :::* LISTEN
Install lnmp takes 41 minutes.
Install lnmp V1.6 completed! enjoy it.
  • LAMP环境搭建完成。在浏览器中输入服务器的IP地址,就会出现以下界面。
    tututu

注意事项

  • 建议将phpmyadmin目录重命名一下,防止别人能随意的发现admin地址。
1
2
cd /home/wwwroot/default
mv phpmyadmin xxxadmin
  • 当前这个页面是用IP访问时的默认页面(不是域名),最好不要让这个页面存在。
1
rm /home/wwwroot/default/index.html
  • 如果需要开启IP访问网站域名,可以更改IP访问默认路径(自己没有试过,不建议使用)。
1
vim /usr/local/apache/conf/extra/httpd-vhosts.conf

把DocumentRoot “/home/wwwroot/default” 和 Directory “/home/wwwroot/default” 两处中的 “/home/wwwroot/default” 修改为需要IP访问的域名,如 “/home/wwwroot/wxy.email”。