树莓派搭建轻量级NAS系统[2]

Share

在上一篇OpenMediaVault 5的部署基础上,搭建Syncthing文件同步系统于树莓派3B上,并自动备份手机相册到外置移动硬盘。
1.用户权限设置
进入OMV5后,左侧“控制台”-“访问权限管理”-“用户”
右侧选择对应用户,选择“特权”,将对应的共享文件夹给予“可读写”权限

2.安装Docker和Portainer
左侧“控制台”-“系统”-“OMV-Extras”-“Docker”
安装Docker-安装Portainer
选择“打开Web页” 进入Portainer管理界面
用pi账号登录

3.在Portainer中部署Syncthing到Docker
进入local-Images,确保“Registry”为DockerHub,下方的Image框里填写“linuxserver/syncthing”
将自动查询到:latest结尾的字符,选择“pull the image”
左侧Volumes-右侧Add Volume-Name:syncthing_config-Create the Volume
左侧Containers-右侧Add Container
Name:syncthing
Image:linuxserver/syncthing (在下拉菜单里中选择自动匹配的条目)

Network ports configuration:
21027 → 21027 UDP
8384 → 8384 TCP
22000 → 22000 TCP

Advanced container settings:
-Volumes Tab:map additional volume
container: /config [Volume]
volume: syncthing_config – local [Writable]
container:/srv/dev-disk-by-label-xxx/xxx [Bind]
host:/srv/dev-disk-by-label-xxx/xxx [Writable]
(外置硬盘地址为/srv/dev-disk-by-label-xxx/xxx)
-Env Tab:add environment variable
name:PUID value:1001 {ssh下id 查询}
name:PGID value:100 {ssh下id 查询}
name:TZ value:Country/City (国家/城市)
name:UMASK_SET value:022
name:PATH value:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
name:PS1 value:$(whoami)@$(hostname):$(pwd)\$
name:HOME value:/config
name:TERM value:xterm
-Restart policy Tab: Unless Stopped

4.配置服务端和客户端
进入https://syncthing.net/downloads/下载安装对应系统的客户端
进入http://192.168.1.XX:8384/服务端进行操作,首次需配置用户名密码
删除默认文件夹,添加客户端ID(在客户端获取ID),并在客户端上确认添加的设备
在服务端添加同步文件夹,文件夹路径设置为/srv/dev-disk-by-label-xxx/xxx/xxx
-若输错路径,比如/config/xxx,可ssh进/var/lib/docker/volumes/syncthing_config/_data 清除
共享标签选择对应的客户端,确认后,在客户端等待请求并同意

SQ.DO

MCITP Enterprise Administrator

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.