2020年11月17日星期二

在ubuntu上用Docker安装私有云盘seafile

1. 创建目录,并拷贝证书到ssl文件夹

cd /opt
mkdir seafile-data
cd seafile-data
mkdir ssl
cp /你的证书目录/fullchain.pem /opt/seafile-data/ssl/seafile.xxxx.com.crt
cp /你的证书目录/privkey.pem /opt/seafile-data/ssl/seafile.xxxx.com.key

2. 用docker安装并运行seafile:

docker run --restart=always \
  -d --name seafile \
  --restart unless-stopped \
  -e SEAFILE_SERVER_LETSENCRYPT=true \
  -e SEAFILE_SERVER_HOSTNAME=seafile.xxxx.com \
  -e SEAFILE_ADMIN_EMAIL=你的邮箱@mail.com \
  -e SEAFILE_ADMIN_PASSWORD=你的seafile管理员密码\
  -v /opt/seafile-data:/shared \
  -p 443:443 \
  seafileltd/seafile:latest

3. 打开seafile.xxxx.com网页登录。或者下载seafile的应用登录。

Seafile的进阶配置

有时候想改变seafile的配置,比如端口,安全性等等。可以通过下面方式

docker run --restart=always \
  -d --name seafile \
  --restart unless-stopped \
  -e SEAFILE_SERVER_LETSENCRYPT=true \
  -e SEAFILE_SERVER_HOSTNAME=seafile.xxxx.com \
  -e SEAFILE_ADMIN_EMAIL=你的邮箱@mail.com \
  -e SEAFILE_ADMIN_PASSWORD=你的seafile管理员密码\
  -v /opt/seafile-data:/shared \
  -v /opt/seafile-data/seafile-nginx:/etc/nginx/sites-enabled \
  -p 443:443 \
  seafileltd/seafile:latest

增加了一行-v /opt/seafile-data/seafile-nginx:/etc/nginx/sites-enabled ,运行后,在目录/opt/seafile-data/seafile-nginx下生成了一个seafile-nginx.conf的配置文件。可以对其进行修改,但修改后,docker重启后,又会自动回复原来的样子。

所以需要建修改好的seafile-nginx.conf配置备份

cp /opt/seafile-data/seafile-nginx/seafile-nginx.conf /opt/seafile-data/seafile-nginx/seafile-nginx.conf-bak

然后在/etc/rc.local 文件中加入三条启动命令。(ubuntu20的rc.local如何能生效,之前文章有介绍:链接

sleep 30
cp -f /opt/seafile-data/seafile-nginx/seafile-nginx.conf-bak /opt/seafile-data/seafile-nginx/seafile-nginx.conf
docker exec -di nginx -s reload

sleep 30秒是让docker启动完成再进行操作。时间可以根据自己机子的情况调节。

对于seafile-nginx.conf的修改,就和普通nginx修改一样,这里不做详细介绍。

没有评论:

发表评论

安装 PaddleOCR的方法

  安装飞桨版本:https://www.paddlepaddle.org.cn/install/quick?docurl=/documentation/docs/zh/develop/install/pip/windows-pip.html 命令:  python -m pip...