debian⽂件共享_如何在Debian10上使⽤Seafile同步和共享⽂
件
⽂件共享
介绍 (Introduction)
is an open-source, self-hosted, file synchronization and sharing platform. Users can store and optionally encrypt data on their own servers with storage space as the only limitation. With Seafile you can share files and folders using cross-platform syncing and password-protected links to files with expiration dates. A file-versioning feature means that users can restore deleted and modified files or folders.
是⼀个开源,⾃托管的⽂件同步和共享平台。 ⽤户可以将存储空间作为唯⼀限制,在⾃⼰的服务器上存储和选择加密数据。 使⽤Seafile,您可以使⽤跨平台同步和具有到期⽇期的⽂件的受密码保护的链接来共享⽂件和⽂件夹。 ⽂件版本控制功能意味着⽤户可以还原已删除和修改的⽂件或⽂件夹。
In this tutorial, you will install and configure Seafile on a Debian 10 server. You will use MariaDB (the default MySQL variant on Debian 10) to store data for the different components of Seafile, and Apache
as the proxy server to handle the web traffic. After completing this tutorial, you will be able use the web interface to access Seafile from desktop or mobile clients, allowing you to and share your files with other users or groups on the server or with the public.
在本教程中,您将在Debian 10服务器上安装和配置Seafile。 您将使⽤MariaDB(Debian 10的默认MySQL变体)存储Seafile不同组件的数据,并使⽤Apache作为代理服务器来处理Web流量。 完成本教程后,您将能够使⽤Web界⾯从台式机或移动客户端访问Seafile,从⽽使您可以与服务器上的其他⽤户或组或公众同步并共享⽂件。
先决条件 (Prerequisites)
Before you begin this guide, you’ll need the following:
在开始本指南之前,您需要满⾜以下条件:
One Debian 10 server with a minimum of 2GB of RAM set up by following this tutorial, including a sudo non-root user and a firewall.
通过遵循教程,可以⼀台⾄少具有2GB RAM的Debian 10服务器,包括sudo⾮root⽤户和防⽕墙。
An Apache web server with a virtual host configured for the registered domain by following . As you follow this guide, be sure to that points to your domain name.
通过遵循为已注册域配置虚拟主机 。 在遵循本指南时,请确保指向您域名 。
A MariaD
B database server installed and configured. Follow the steps in the tutorial to set this up. Skip Step 3 of this
tutorial — “(Optional) Adjusting User Authentication and Privileges”. You will only be making local connections to the database server, so changing the authentication method for the root user is not necessary.
已安装和配置MariaDB数据库服务器。 按照教程中的步骤进⾏设置。 跳过本教程的第3步-“(可选)调整⽤户⾝份验证和特权”。 您将只与数据库服务器建⽴本地连接,因此不需要更改root⽤户的⾝份验证⽅法。
An SSL certificate installed on your server by following this tutorial.
遵循此教程中安装的SSL证书。
A fully registered domain name. This tutorial will use your_domain throughout.
完全注册的域名。 本教程将整个使⽤your_domain 。
Both of the following DNS records set up for your server. You can follow this for details on how to add them.
为服务器设置了以下两个DNS记录。 您可以按照获取有关如何添加它们的详细信息。
An A record with your_domain pointing to your server’s public IP address.
A记录,其中your_domain指向服务器的公共IP地址。
An A record ur_domain pointing to your server’s public IP address.
A记录,其中ur_domain指向服务器的公共IP地址。
第1步-为Seafile组件创建数据库 (Step 1 — Creating Databases for the Seafile Components)
Seafile requires three components in order to work properly:
Seafile需要三个组件才能正常⼯作:
Seahub: Seafile’s web frontend, written in Python using the web framework. From Seahub you can access, manage, and share your files using a web browser.
Seahub :Seafile的Web前端,使⽤ Web框架以Python编写。 从Seahub,您可以使⽤Web浏览器访问,管理和共享⽂件。
Seafile server: The data service daemon that manages the raw file upload, download, and synchronization. You do not interact with the server directly, but instead use a client program or the Seahub web interface.
Seafile服务器 :数据服务守护程序,⽤于管理原始⽂件的上载,下载和同步。 您不直接与服务器交互,⽽是使⽤客户端程序或Seahub Web界⾯。
Ccnet server: The RPC service daemon to enable internal communication between the different components of Seafile.
For example, when you use Seahub, it is able to access data from the Seafile server using the Ccnet RPC service.
Ccnet服务器 :RPC服务守护程序,⽤于启⽤Seafile的不同组件之间的内部通信。 例如,当您使⽤Se
ahub时,它便可以使⽤Ccnet RPC服务从Seafile服务器访问数据。
Each of these components stores its data separately in its own database. In this step you will create the three MariaDB databases and a user before proceeding to set up the server.
这些组件中的每⼀个都将其数据分别存储在其⾃⼰的数据库中。 在此步骤中,您将创建三个MariaDB数据库和⼀个⽤户,然后继续设置服务器。
First, log in to the server using SSH with your username and IP address:
⾸先,使⽤您的⽤户名和IP地址使⽤SSH登录服务器:
ssh sammy@your_server_ip
Connect to the MariaDB database server as administrator (root):
以管理员(根)⾝份连接到MariaDB数据库服务器:
sudo mysql
须藤MySQL
At the MariaDB prompt, use the following SQL command to create the database user:
在MariaDB提⽰符下,使⽤以下SQL命令创建数据库⽤户:
CREATE USER 'sammy'@'localhost' IDENTIFIED BY 'password';
创建⽤户' sammy '@'localhost'由' password '标识;
Next, you will create the following databases to store the data of the three Seafile components:
接下来,您将创建以下数据库来存储三个Seafile组件的数据:
ccnet-db for the Ccnet server.
ccnet-db⽤于Ccnet服务器。
seahub-db for the Seahub web frontend.
seahub-db⽤于Seahub Web前端。
seafile-db for the Seafile file server.
seafile-db⽤于Seafile⽂件服务器。
At the MariaDB prompt, create your databases:
在MariaDB提⽰符下,创建数据库:
CREATE DATABASE 'ccnet-db' CHARACTER SET = 'utf8';
CREATE DATABASE'ccnet -db'CHARACTER SET ='utf8';
CREATE DATABASE 'seafile-db' CHARACTER SET = 'utf8';
CREATE DATABASE'seafile -db'CHARACTER SET ='utf8';
CREATE DATABASE 'seahub-db' CHARACTER SET = 'utf8';
CREATE DATABASE'seahub -db'CHARACTER SET ='utf8';
Then, grant all privileges to your database user to access and make changes in these databases:
然后,向您的数据库⽤户授予所有特权,以访问和更改这些数据库:
GRANT ALL PRIVILEGES ON 'ccnet-db'.* to 'sammy'@localhost;
将所有特权授予 ' ccnet-db '。*到' sammy '@localhost;
GRANT ALL PRIVILEGES ON 'seafile-db'.* to 'sammy'@localhost;
将所有特权授予 ' seafile-db '。*到' sammy '@localhost;
GRANT ALL PRIVILEGES ON 'seahub-db'.* to 'sammy'@localhost;
将所有权限授予 ' seahub-db '。*到' sammy '@localhost;
Exit the MariaDB prompt by typing exit:
通过键⼊exit退出MariaDB提⽰符:
exit
出⼝
Now that you have created a user and the databases required to store the data for each of the Seafile components, you will install dependencies to download the Seafile server package.
现在,您已经创建了⼀个⽤户和存储每个Seafile组件数据所需的数据库,您将安装依赖项以下载Seafile服务器软件包。
第2步-安装依赖项并下载Seafile (Step 2 — Installing Dependencies and Downloading Seafile)
Some parts of Seafile are written in Python and therefore require additional Python modules and programs to work. In this step, you will install these required dependencies before downloading and extracting the Seafile server package.
Seafile的某些部分是⽤Python编写的,因此需要其他Python模块和程序才能⼯作。 在此步骤中,您将在下载和提取Seafile服务器软件包之前安装这些必需的依赖项。
To install the dependencies using apt run the following command:
要使⽤apt安装依赖项,请运⾏以下命令:
sudo apt install python-setuptools python-pip python-urllib3 python-requests python-mysqldb ffmpeg
sudo apt安装python-setuptools python-pip python-urllib3 python-requests python-mysqldb ffmpeg
The python-setuptools and python-pip dependencies oversee installing and managing Python packages. The python-urllib3 and python-requests packages make requests to websites. Finally, the python-mysqldb is a library for using MariaDB from Python and ffmpeg handles multimedia files.
python-setuptools和python-pip依赖项监督安装和管理Python软件包。 python-urllib3和python-requests软件包向⽹站发出请求。 最后,python-mysqldb是⼀个使⽤Python中的MariaDB的库,⽽ffmpeg处理多媒体⽂件。
Seafile requires Pillow, a python library for image processing, and moviepy to handle movie file thumbnails. These modules are not available in the Debian package repository, so instead install them with pip:
Seafile需要Pillow (⼀个⽤于图像处理的python库)和moviepy来处理电影⽂件缩略图。 这些模块在Debian软件包存储库中不可⽤,因此请使⽤pip安装它们:
sudo pip install Pillow moviepy
sudo pip install Pillow moviepy
Now that you have installed the necessary dependencies, you can download the Seafile server pack
age.
既然您已经安装了必要的依赖项,就可以下载Seafile服务器软件包。
Seafile creates additional directories during setup. To keep them all organized, create a new directory and change into it:
Seafile在安装过程中会创建其他⽬录。 为了使它们井井有条,请创建⼀个新⽬录并将其更改为:
mkdir seafile
mkdir seafile
cd seafile
cd海⽂件
You can now download the latest version (7.0.4 as of this writing) of the Seafile server from by running the following command:
您现在可以通过运⾏以下命令从下载Seafile服务器的最新版本(截⾄撰写本⽂时为7.0.4 ):
Seafile distributes the download as a compressed tar archive, which means you will need to extract it before proceeding. Extract the archive using tar:
Seafile将下载内容作为压缩的tar存档分发,这意味着您需要先提取它,然后才能继续。 使⽤tar提取档案:
tar -zxvf seafile-server_7.0.4_
tar -zxvf seafile-server_ 7.0.4 _
Now change into the extracted directory:
现在转到提取的⽬录:
cd seafile-server-7.0.4
cd seafile-server- 7.0.4
At this stage, you have downloaded and extracted the Seafile server package and have also installed the necessary dependencies. You are now ready to configure the Seafile server.
在此阶段,您已经下载并提取了Seafile服务器软件包,还安装了必要的依赖项。 现在您可以配置Seafile服务器了。
步骤3 —配置Seafile服务器 (Step 3 — Configuring the Seafile Server)
Seafile needs some information about your setup before you start the services for the first time. This includes details like the domain name, the database configuration, and the path where it will store data. To initiate the series of question
prompts to provide this information, you can run the script setup_seafile_mysql.sh, which is included in the archive you extracted in the previous step.
⾸次启动服务之前,Seafile需要有关您的设置的⼀些信息。 这包括诸如域名,数据库配置以及它将存储数据的路径之类的详细信息。 要启动⼀系列提⽰提⽰以提供此信息,可以运⾏脚本setup_seafile_mysql.sh ,该脚本包含在上⼀步中提取的归档⽂件中。
Run the script using bash:
使⽤bash运⾏脚本:
如何共享文件夹bash setup-seafile-mysql.sh
bash安装程序seafile-mysql.sh
Press ENTER to continue when prompted.
出现提⽰时,按ENTER继续。
The script will now prompt you with a series of questions. Wherever defaults are mentioned, pressing the ENTER key will use that value.
现在,脚本将提⽰您⼀系列问题。 凡提及默认值的地⽅,按ENTER键将使⽤该值。
This tutorial uses Seafile as the server name, but you can change it if you’d like:
本教程使⽤Seafile作为服务器名称,但是您可以根据需要更改它:
1Question 1
2
3What is the name of the server?
4It will be displayed on the client. 3 - 15 letters or digits
5[ server name ] Seafile
For Question 2, enter the domain name for this Seafile instance.
对于Question 2 ,输⼊此Seafile实例的域名。
1Question 2
2
3What is the ip or domain of the server?.
4For example: pany, 192.168.1.101
5[ This server's ip or domain ] your_domain
Press ENTER to accept the default value for Question 3. If you have set up external storage, for example, using NFS or block storage, you will need to specify the path to that location here instead.
按ENTER接受Question 3的默认值。 如果您设置了外部存储(例如,使⽤NFS或块存储),则需要在此处指定该位置的路径。
发布评论