在Debian 10(Buster)上安装和配置NextCloud 19

时间:2020-02-23 14:32:41  来源:igfitidea点击:

本教程将专注于如何在Debian 10(Buster)上安装NextCloud 19.
NextCloud是从OwnCloud项目叉中叉出的开源,自托管文件共享服务器。
它使我们可以在集中位置存储文档,图片,视频,电影和任何其他媒体内容,就像Dropbox函数一样。

我们可以与朋友,队友或者客户/客户共享存储的文件。
它旨在重新设计安全性,以确保敏感数据永远不会出现错误。
使用Sync函数,我们可以在设备中保留文件,联系人,日历和更同步。

让我们开始。

在Debian 10 Buster上安装NextCloud 19

nextCloud具有必须事先安装的许多依赖项。
为我们提供更好的体验,我们将涵盖所有依赖项的安装。

第1步:安装MariaDB数据库服务器

数据库服务器是NextCloud的重要组成部分。
使用下面的命令在Debian 10上安装它。

sudo apt -y install mariadb-server mariadb-client

通过设置root密码,禁用远程根登录和删除测试数据库来保护数据库安装。

$sudo mysql_secure_installation 
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none): 
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y
 ... Success!
Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] y
 ... Success!
By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y
 ... Success!
Cleaning up...
All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!

创建NextCloud数据库和用户:

$mysql -u root -p 
CREATE USER 'nextcloud'@'localhost' IDENTIFIED BY 'Hyman@theitroad$d';
CREATE DATABASE nextcloud;
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud'@'localhost';
FLUSH PRIVILEGES;
QUIT

第2步:安装PHP和Apache Web服务器

我们还需要PHP和Apache WebServer来运行NextCloud。
运行以下命令以确保已安装这些依赖项。

sudo apt -y install php php-{cli,xml,zip,curl,gd,cgi,mysql,mbstring}
sudo apt -y install apache2 libapache2-mod-php

设置PHP变量以适合使用。

$sudo nano /etc/php/7.3/apache2/php.ini
date.timezone = Africa/Nairobi
memory_limit = 512M
upload_max_filesize = 500M
post_max_size = 500M
max_execution_time = 300

重新启动Apache2服务:

sudo systemctl restart apache2

第3步:在Debian 10上下载NextCloud 19(Buster)

安装了所有依赖项,我们可以继续向本地系统下载最新的NextCloud存档。
访问NextCloud发布页面以检查最新版本。

sudo apt -y install wget unzip
wget https://download.nextcloud.com/server/releases/latest-19.zip
unzip latest-19.zip

解压缩存档并移动到Apache Web文件夹并设置正确的所有权和权限。

sudo mv nextcloud /var/www/html/
sudo chown -R www-data:www-data /var/www/html/nextcloud
sudo sudo chmod -R 755 /var/www/html/nextcloud

步骤4:在Debian 10(Buster)上运行NextCloud Web安装程序

对于下一步,我们将在Web控制台上执行此操作。
打开我们喜欢的浏览器和URL http://{serverip | hostname]

通过提供用户名和密码创建管理员帐户。

设置数据目录 - 这通常是从系统的单独分区。

还提供正确的数据库凭据。

单击"完成设置"按钮以完成Debian 10上的NextCloud的安装。

然后,我们将针对NextCloud Admin仪表板,我们可以其中创建用户,组,设置双因素身份验证,电子邮件服务器并安装我们认为适合的添加插件。