Nextcloud 生产环境部署保姆级教程

CUE 下前篇

先前发布一篇名为《在 Docker 中部署 NextCloud》教程,分享如何通过 Docker 快速部署 NextCloud。

此种部署方式适合个人用户使用,如需部署在生产环境用,建议使用 LAMP 架构加源码部署,详见下文。

环境介绍

杜老师的实验环境为虚拟机加 CentOS7 系统,使用的 LAMP 脚本来自 https://lnmp.org,Nextcloud 为此文撰写时的最新版本。

这里需要注意的是:因 Nextcloud 需要 PHP7.3 以上的版本,所以必须 1G 以上的内存。

服务安装

使用官方命令进行环境部署:

1
wget http://soft.vpser.net/lnmp/lnmp1.9.tar.gz -cO lnmp1.9.tar.gz && tar zxf lnmp1.9.tar.gz && cd lnmp1.9 && ./install.sh lamp

部署时的环境设置如下:

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
60
61
62
63
64
65
66
+------------------------------------------------------------------------+
| LNMP V1.9 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.51
4: Install MySQL 5.7.38
5: Install MySQL 8.0.30
6: Install MariaDB 5.5.68
7: Install MariaDB 10.3.35
8: Install MariaDB 10.4.25
9: Install MariaDB 10.5.16
10: Install MariaDB 10.6.8
0: DO NOT Install MySQL/MariaDB
Enter your choice (1, 2, 3, 4, 5, 6, 7, 8, 9, 10 or 0): 4
Using Generic Binaries [y/n]: y
You will install MySQL 5.7.38 Using Generic Binaries.
===========================
Please setup root password of MySQL.
Please enter: Dusays@1234
MySQL root password: Dusays@1234
===========================
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.33
10: Install PHP 7.4.30
11: Install PHP 8.0.20
12: Install PHP 8.1.7
Enter your choice (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12): 11
You will install PHP 8.0.20
===========================
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: teacherdu@dusays.com
===========================
Server Administrator Email: teacherdu@dusays.com
===========================
===========================
You have 2 options for your Apache install.
1: Install Apache 2.2.34
2: Install Apache 2.4.53 (Default)
Enter your choice (1 or 2): 2
You will install Apache 2.4.53

Press any key to install...or Press Ctrl+c to cancel

环境部署完成后会出现如下提示:

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
+------------------------------------------------------------------------+
| LNMP V1.9 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: Dusays@1234 |
+------------------------------------------------------------------------+
+-------------------------------------------+
| Manager for LNMP, Written by Licess |
+-------------------------------------------+
| https://lnmp.org |
+-------------------------------------------+
Apache is running.
SUCCESS! MySQL running (89612)
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:111 *:*
LISTEN 0 5 192.168.122.1:53 *:*
LISTEN 0 128 *:22 *:*
LISTEN 0 128 127.0.0.1:631 *:*
LISTEN 0 128 [::]:3306 [::]:*
LISTEN 0 128 [::]:111 [::]:*
LISTEN 0 128 [::]:80 [::]:*
LISTEN 0 128 [::]:22 [::]:*
LISTEN 0 128 [::1]:631 [::]:*
Install lnmp takes 6 minutes.
Install lnmp V1.9 completed! enjoy it.

使用浏览器访问虚拟机的 IP,即可显示如下页面:

Nextcloud 的部署

直接在默认网站根目录中使用 Nextcloud 官方下载地址进行源码下载,然后对其进行解压操作,并修改对应文件的权限:

1
2
3
4
cd /home/wwwroot/default/
wget https://download.nextcloud.com/server/releases/latest.zip
unzip latest.zip
chown www. /home/wwwroot/default/nextcloud/ -R

在浏览器中使用 IP/nextcloud 打开网站,其中 nextcloud 是刚解压的目录,如有需要可以将其放入根目录中。依次设置管理员账号和密码,生产环境数据量比较大,数据库需要选择 MySQL,并输入数据库连接信息「这里用 root 用户连接,数据库不需要提前创建」

安装后的界面展示:

文件浏览器的界面展示:

媒体界面展示:

动态界面展示:

本文链接:https://my.lmcjl.com/post/16614.html

展开阅读全文

4 评论

留下您的评论.