Seafile server 安装记

@vrqq  November 21, 2025

服务器环境

CentOS Stream release 9
Seafile server 13 with docker

Step0 准备dnf安装一些软件

dnf install epel-release
dnf install podman podman-compose git vim

Step1 准备梯子

由于docker.io github等连接困难,因此需准备一份临时梯子
首先确保自己本地主机可以精品上网,假设局域网中有一http代理地址为http://192.168.122.1:20172
由于按流量计费 我们需要在linux上运行一份临时代理 而非使用ssh client提供的代理proxy

a) ssh到服务器时将本地http proxy端口透传给远程

ssh -R 20172:192.168.122.1:20172 ux1@remote.host

b) 设置临时http_proxy并安装v2sub

export http_proxy="http://127.0.0.1:20172"
export https_proxy="http://127.0.0.1:20172"

c) 安装v2ray和v2raysub
https://github.com/v2fly/v2ray-core/releases
https://github.com/12CrazyPaul21/v2raysub?tab=readme-ov-file

# Download v2ray linux x86_64 version and unzip to specific dir
mkdir -p /home/ux1/v2ray
cd /home/ux1/v2ray
wget https://github.com/v2fly/v2ray-core/releases/download/v5.41.0/v2ray-linux-64.zip
unzip v2ray-linux-64.zip

# set path env
export PATH=$PATH:/home/ux1/v2ray

# Install v2raysub to current user bin
pip install v2raysub

# Add subscribe and update
v2sub init
v2sub subscribe add https://my-v2ray-subscription-url
v2sub subscribe update

# select 'groups' then select a server in subscription, then start
v2sub node select
v2sub node start

# Then using 'export' command to set the new proxy, for example
# export http_proxy="http://127.0.0.1:23339"
# export https_proxy="http://127.0.0.1:23339"

Step2 准备podman-compose 并且运行之

  1. 参考https://cloud.seafile.com/wiki/publish/seafile-manual/hk5G/ 准备好.env文件

    cd /opt/seafile
    set -a
    source .env
    set +a
    podman compose up -d
  2. 换Nginx,因为使用caddy莫名其妙起不来
    参考 https://manual.seafile.com/latest/setup/use_other_reverse_proxy 修改上述podman env文件 然后
    若域名无法备案:创建自签名ip证书
    https://zhuanlan.zhihu.com/p/28621550092

运行下列命令生成自签名证书

openssl req -x509 -nodes -days 720 -newkey rsa:4096 \
  -keyout selfsign_seafile.key -out selfsign_seafile.crt \
  -config selfsign_cert.conf -extensions v3_req

查看证书信息之后在客户端核实: openssl x509 -text -in selfsign_seafile.crt -noout

若有备案 使用acme.sh 或certbot等自动更新证书

Appendix:运行发现caddy启动不起来 报错如下 故更换nginx

"level":"error","ts":1763741714.9799314,"logger":"docker-proxy","msg":"Docker ping failed","error":"Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?"} Error: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Bug: 在将文件夹映射到nfs时,podman-compose卡住
使用podman ps -a 查看发现 只有seafile-mysql和seafile-redis运行了,另外两个seafileseadoc均显示为created 说明还没有运行到他俩,一定在前面两个卡住了。
等一会儿发现 seafile-mysql 显示unhalthy 说明 healthy test失败了,我们手动进入该container看一下
podman exec -it seafile-mysql bash然后执行他的健康检查命令/usr/local/bin/healthcheck.sh --connect --mariadbupgrade --innodb_initialized,发现返回错误。

同时podman logs seafile-mysql也显示log例如: 9 [Warning] Access denied for user 'seafile'@'10.89.1.5' (using password: YES)

这个容器卡住了。。

发现当该容器的存储目录映射到nfs时,就会出错。于是改为映射到本地磁盘,遂修改.env文件,我使用的参数如下

SEAFILE_VOLUME=/mnt/nfs/seafile-data
SEAFILE_MYSQL_VOLUME=/opt/seafile-mysql/db
SEAFILE_CADDY_VOLUME=/mnt/nfs/seafile-caddy
SEADOC_VOLUME=/mnt/nfs/seadoc-data

问题2: web登录提示CSRF verification failed. Request aborted
https://bbs.seafile.com/t/topic/21913
vim /mnt/nfs/seafile-data/seafile/conf/seahub_settings.py
新增 CSRF_TRUSTED_ORIGINS = [‘https://域名:端口’,‘http://域名:端口’]


添加新评论