自建云盘同步盘Seafile安装配置(全) 您所在的位置:网站首页 nginx配置url 自建云盘同步盘Seafile安装配置(全)

自建云盘同步盘Seafile安装配置(全)

2023-03-11 19:37| 来源: 网络整理| 查看: 265

Seafile 是一款开源的企业云盘,注重可靠性和性能。支持 Windows, Mac, Linux, iOS, Android 平台。支持文件同步或者直接挂载到本地访问。

一、准备环境

1、MySQL/MariaDB数据库已具备

2、Seafile服务器端下载

下载到本地,或者复制下载地址使用wget下载。

官网下载:

下载 - Seafile

最下方服务器端,按需要选择,推荐Debian安装,其他Ubuntu/CentOS均可。

https://seafile-downloads.oss-cn-shanghai.aliyuncs.com/seafile-server_9.0.10_x86-64.tar.gz

官方安装参考文档

using_mysql - Seafile Cloud

webdav - Seafile Cloud

二、基础环境安装

注意:1、以下环境已经安装的可以省略要装;2、按顺序执行安装,部分场景存在版本依赖等异常情况不能一次性安装;3、如果是全新安装python3,可以先将安装源切换为国内。

apt install python3 python3-setuptools python3-pip python3-ldap libmariadb-dev-compat apt install libmariadb-dev libmemcached-dev libffi-dev pip3 install --timeout=3600 django==3.2.* future mysqlclient pymysql Pillow captcha jinja2 pip3 install --timeout=3600 sqlalchemy==1.4.3 django-simple-captcha pycryptodome==3.12.0 pip3 install --timeout=3600 pylibmc django-pylibmc cffi==1.14.0 pip3 install --timeout=3600 psd-tools

ARM版本安装不上psd-tools,使用apt先安装以下插件,然后再安装psd-tools

apt install python3-scipy apt install python3-skimage

Python3修改国内源

Linux下,修改 ~/.pip/pip.conf (没有就创建一个文件夹及文件。文件夹要加“.”,表示是隐藏文件夹)

内容如下:

[global] index-url = https://pypi.tuna.tsinghua.edu.cn/simple [install] trusted-host=mirrors.aliyun.com

三、Seafile安装

1、上传文件、建立安装目录、解压

cd /opt;mkdir /opt/seafile;mkdir /opt/seafile/installed; cd /opt/seafile; #上传下载的服务器端文件,或者直接wget下载 wget https://seafile-downloads.oss-cn-shanghai.aliyuncs.com/seafile-server_9.0.10_x86-64.tar.gz #解压 tar -zxvf *gz #移除安装包 mv *gz /opt/seafile/installed

2、建数据库、用户、分配权限

注:此部分可以在安装Seafile根据引导自动配置,也可以手动配置,如果是重装则手动配置用户和数据。

自动配置时注意创建用户默认授权为允许本机登录,其他地方访问需要增加授权。

数据库:ccnet/seafile/seahub

用户:sea

//创建用户: create user sea identified by "123456"; //创建数据库: create database ccnet; create database seafile; create database seahub; //授权: grant all privileges on ccnet.* to sea@"%"; grant all privileges on seafile.* to sea@"%"; grant all privileges on seahub.* to sea@"%"; flush privileges;

3、Seafile安装

#开始安装 cd /opt/seafile/seafile-server-* ./setup-seafile-mysql.sh

4、默认配置修改、开启WebDAV(按需修改)

seafile:8082

#对应配置文件/opt/seafile/conf/seafile.conf

seahub:8000

#修改为8081对应配置文件 #/opt/seafile/conf/gunicorn.conf.py bind = "127.0.0.1:8000" #修改为 bind = "0.0.0.0:8081" #注:1、若开启了防火墙,需要放开Seahub对应端口限制; rm /opt/seafile/conf/__pycache__/*.pyc #2、若修改了seahub的端口,需要删除对应的缓存文件。

seafdav:8080-------开启webdav对应配置文件/opt/seafile/conf/seafdav.conf

[WEBDAV] enabled = true #开启webdav port = 8080 #端口 share_name = /seafdav #与nginx转发路径要一致,后续使用nginx代理转发访问,如果不使用nginx转发,则保持默认值

5、启动Seafile

注:若需要将数据放在其他硬盘,可以将/opt/seafile/seafile-data链接到其他磁盘。

#将数据存储到其他目录 mkdir -p /data/Appfiles/seafile cd /opt/seafile;mv seafile-data /data/Appfiles/seafile/ ln -s /data/Appfiles/seafile/seafile-data seafile-data #启动Seafile、Seahub,按顺序启动 cd /opt/seafile/seafile-server-latest ./seafile.sh start #第一次启动seahub会要求设备管理员账号、密码 ./seahub.sh start #停止Seahub、Seafile,按顺序停止 ./seahub.sh stop ./seafile.sh stop

6、登录Seafile

http://192.168.1.9:8081

7、配置通过nginx代理访问

#nginx安装 apt install nginx #配置nginx cd /etc/nginx/sites-enabled #在nginx配置目录创建Seafile配置 vi seafile server { listen 8181 default_server; listen [::]:8181 default_server; server_name hd11; location / { proxy_pass http://127.0.0.1:8081; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Host $server_name; proxy_read_timeout 1200s; # used for view/edit office file via Office Online Server client_max_body_size 0; access_log /var/log/nginx/seahub.access.log; error_log /var/log/nginx/seahub.error.log; } location /seafhttp { rewrite ^/seafhttp(.*)$ $1 break; proxy_pass http://127.0.0.1:8082; client_max_body_size 0; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_connect_timeout 36000s; proxy_read_timeout 36000s; proxy_send_timeout 36000s; send_timeout 36000s; } location /seafdav { #与Seafile的WEBDAV配置share_name = /seafdav路径要一致 proxy_pass http://127.0.0.1:8080/seafdav; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Host $server_name; proxy_set_header X-Forwarded-Proto $scheme; proxy_read_timeout 1200s; client_max_body_size 0; #access_log /var/log/nginx/seafdav.access.log seafileformat; access_log /var/log/nginx/seafdav.access.log; error_log /var/log/nginx/seafdav.error.log; } location /media { root /opt/seafile/seafile-server-latest/seahub; } location /:dir_browser { #alias /opt/seafile/seafile-server-latest/seahub/thirdpart/wsgidav/dir_browser/htdocs; proxy_pass http://127.0.0.1:8080/:dir_browser; } } #重启nginx使用代理生效 systemctl restart nginx #使用新端口访问 http://192.168.1.9:8001

四、系统配置

1、配置外部访问URL,如果不配置会导致文件下载、WEBDAV访问异常

用户管理员登录系统,用户头像--系统管理--设置

SERVICE_URL:http://test.cn:8001

FILE_SERVER_ROOT:http://test.cn:8001/seafhttp

2、若出现头像显示不正常,系统的BUG,最快解决办法,新建一个用户或者上传一个新图像即可

五、注意事项

1、按上配置后WebDAV路径:

http://test.cn:8001/seafdav

2、若需要修改数据信息,需要修改以下文件:

/opt/seafile/conf/ccnet.conf

/opt/seafile/conf/seafile.conf

/opt/seafile/conf/seahub_settings.py



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有