如何在 Ubuntu 20.04 LTS 上安装 Seafile

2023年 7月 21日 37.5k 0

Seafile 是一个开源的、自托管的文件同步,它共享具有高性能和可靠性的解决方案。Seafile 使您能够将文件放在自己的服务器上,并允许其他人和您的不同设备同步和访问它。Seafile 是用 C 和 Python 编程语言编写的,并提供类似的功能,如 Dropbox、mega.co.nz 等。Seafile-logo

在 Ubuntu 20.04 LTS Focal Fossa 上安装 Seafile

apt步骤 1. 首先,通过在终端中运行以下命令,确保所有系统包都是最新的。

sudo apt update
sudo apt upgrade

第 2 步。第 2 步。安装所需的依赖项。

apt现在使用以下命令安装 Seafile 服务器安装所需的所有依赖项:

sudo apt install python3 python3-{pip,pil,ldap,urllib3,setuptools,mysqldb,memcache,requests}
sudo apt install ffmpeg memcached libmemcached-dev
sudo pip3 install --upgrade pip
sudo pip3 install --timeout=3600 Pillow pylibmc captcha jinja2 sqlalchemy==1.4.3
sudo pip3 install --timeout=3600 django-pylibmc django-simple-captcha python3-ldap mysqlclient

步骤 3. 安装 LEMP 堆栈。

需要 Ubuntu 20.04 LEMP 服务器。如果您没有安装 LEMP,您可以在此处按照我们的指南进行操作。

步骤 4. 配置 MariaDB。

默认情况下,MariaDB 未加固。mysql_secure_installation您可以使用脚本保护 MariaDB 。您应该仔细阅读下面的每个步骤,这些步骤将设置 root 密码、删除匿名用户、禁止远程 root 登录、删除测试数据库和访问安全 MariaDB:

mysql_secure_installation

像这样配置它:

- Set root password? [Y/n] y
- Remove anonymous users? [Y/n] y
- Disallow root login remotely? [Y/n] y
- Remove test database and access to it? [Y/n] y
- Reload privilege tables now? [Y/n] y

接下来,我们需要登录 MariaDB 控制台并为 Seafile 创建一个数据库。运行以下命令:

mysql -u root -p

这将提示您输入密码,因此请输入您的 MariaDB 根密码并按 Enter。我们将为这些服务器组件中的每一个创建一个数据库。

MariaDB [(none)]> CREATE DATABASE seafile_server;
MariaDB [(none)]> CREATE DATABASE ccnet_server;
MariaDB [(none)]> CREATE DATABASE seahub_server;

然后,创建一个数据库用户并为创建的数据库授予权限:

MariaDB [(none)]> CREATE USER 'seafile'@'localhost' IDENTIFIED BY 'Your-Strong-Password';
MariaDB [(none)]> GRANT ALL ON seafile_server.* TO 'seafile'@'localhost';
MariaDB [(none)]> GRANT ALL ON ccnet_server.* TO 'seafile'@'localhost';
MariaDB [(none)]> GRANT ALL ON seahub_server.* TO 'seafile'@'localhost';
MariaDB [(none)]> QUIT;

步骤 5. 在 Ubuntu 20.04 上安装 Seafile。

默认情况下,Seafile 在 Ubuntu 20.04 基础存储库中不可用。现在运行以下命令从官方页面下载最新版本的 Seafile:

wget https://s3.eu-central-1.amazonaws.com/download.seadrive.org/seafile-server_9.0.4_x86-64.tar.gz

接下来,解压下载的文件:

sudo tar -xvf seafile-server_9.0.4_x86-64.tar.gz -C /srv
sudo mv /srv/seafile-server_9.0.4_x86-64 /srv/seafile

之后,运行安装脚本:

cd /srv/seafile/
sudo ./setup-seafile-mysql.sh

在安装过程中,您将被要求回答一些关于您的服务器的问题(名称、地址、端口等)。您还将被询问有关初始化数据库的问题。

安装完成后,现在使用以下命令启动 Seafile 服务器:

cd /srv/seafile
sudo ./seafile.sh start

然后启动 Seahub ( Django ) web 前端服务:

sudo ./seahub.sh start

步骤 6. 创建 Seafile Systemd 服务。

现在我们将 seafile 和 seahub 设置为systemd服务:

sudo tee /etc/systemd/system/seafile.service

相关文章

服务器端口转发,带你了解服务器端口转发
服务器开放端口,服务器开放端口的步骤
产品推荐:7月受欢迎AI容器镜像来了,有Qwen系列大模型镜像
如何使用 WinGet 下载 Microsoft Store 应用
百度搜索:蓝易云 – 熟悉ubuntu apt-get命令详解
百度搜索:蓝易云 – 域名解析成功但ping不通解决方案

发布评论