最近折腾家庭存储这块时,感觉大多数文件都在阿里云盘
,百度网盘
这些公共网盘里,各种APP特别麻烦,所以想把所有不同的网盘都放在一起进行管理,一直听说alist
的大名,还没有用过,这次就来试试。
github
地址:https://github.com/alist-org/alistalist
主页:https://alist.nn.ci/
Alist通过docker部署,本文不做步骤分析。
rclone
在设置好alist
之后,因为alist
是webdav
的形式,jellyfin
是没办法直接读取的,所以需要将alist
挂载到本地,供jellyfin
使用。
github
地址:https://github.com/rclone/rclonerclone
主页:https://rclone.org/
安装rclone
安装rclone
我没有使用docker
进行部署,主要是因为要挂载在宿主机上,来回映射路径相对来说比较麻烦。所以我就根据rclone
的官方教程进行安装:
- 安装依赖
apt-get install fuse3
主体安装
方式一:脚本安装
wget https://www.moerats.com/usr/shell/rclone_debian.sh && bash rclone_debian.sh
方式二:二进制文件安装
# 创建rclone目录
mkdir /opt/rclone
# 进入该目录
cd /opt/rclone
# 下载rclone预编译二进制文件压缩包
curl -O https://downloads.rclone.org/rclone-current-linux-amd64.zip
# 解压
unzip rclone-current-linux-amd64.zip
# 将rclone二进制文件放入/usr/bin目录下
cp rclone /usr/bin/
# 授权
chmod 755 /usr/bin/rclone
# 验证是否成功,显示版本号证明成功
rclone --versio
设置rclone
要将alist
挂载到本地,先要设置rclone remote
,rclone文档说的比较清晰,可以跟着以下命令进行操作:
# 进入rclone设置
rclone config
# 选择新远程
No remotes found, make a new one?
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n #这里选择n
# 设置名字
name> alist
Type of storage to configure.
Choose a number from below, or type in your own value
[snip]
XX / WebDAV
\ "webdav"
[snip]
Storage> webdav #这里输入远程的名字,之后就是你的远程名称
# 设置远程地址url http://your_alist_ip:port/dav
URL of http host to connect to
Choose a number from below, or type in your own value
1 / Connect to example.com
\ "https://example.com"
url> http://127.0.0.1:8080/dav #这里设置alist的地址和端口,后面要带dav,这是alist要求的
# 这里选6就可以了,1-5都不是我们使用的
Name of the WebDAV site/service/software you are using
Choose a number from below, or type in your own value
1 / Fastmail Files
\ (fastmail)
2 / Nextcloud
\ (nextcloud)
3 / Owncloud
\ (owncloud)
4 / Sharepoint Online, authenticated by Microsoft account
\ (sharepoint)
5 / Sharepoint with NTLM authentication, usually self-hosted or on-premises
\ (sharepoint-ntlm)
6 / Other site/service or software
\ (other)
vendor> 6
# 设置远程账号
User name
user> admin #这里是你alist的密码
# 设置远程密码
Password.
y) Yes type in my own password
g) Generate random password
n) No leave this optional password blank
y/g/n> y #这里输入y
Enter the password: #这输入你的密码,密码是看不到的
password:
Confirm the password: #再次输入你的密码
password:
# 这里直接回车即可
Bearer token instead of user/pass (e.g. a Macaroon)
bearer_token>
Remote config
# 这里可能会问你是默认还是高级,选择默认即可
# 你的远程信息
--------------------
[alist]
type = webdav
url = http://127.0.0.1:8080/dav
vendor = Other
user = admin
pass = *** ENCRYPTED ***
--------------------
# 确认
y) Yes this is OK
e) Edit this remote
d) Delete this remote
y/e/d> y #输入y即可,
# 最后按q退出设置
挂载到本地
查看是否连接成功,使用以下命令可以确认是否已经挂载上了alist
# 查看alist的目录
rclone lsd alist:
# 查看alist的文件
rclone ls alist:
后台模式挂载到本地
# 将alist挂载到本地目录 /webdav
# --daemon 强制后台模式
rclone mount alist:/ /mnt/webdav --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000 --use-mmap --daemon
解除本地挂载
# 解除本地挂载,后面跟的是挂载的本地目录
# 当自动取消挂载失败时,也可以这样手动取消挂载
fusermount -qzu /mnt/webdav
开机自动挂载
上面的手动挂载方式,在机器重启后,就失效了,每次都要手动在设置一遍,很麻烦。我们可以使用service
文件来进行自动挂载。
- 设置
service
文件
#创建service文件
vim /usr/lib/systemd/system/rclone.service
文件内容:
[Unit]
Description=rclone
Before=docker.service
[Service]
User=root
ExecStart=/usr/bin/rclone mount alist: /mnt/webdav --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000 --use-mmap
[Install]
WantedBy=multi-user.target
设置开机自启
# reload守护进程
systemctl daemon-reload
# 设置service文件自启
systemctl enable rclone.service
# 启动service文件
systemctl start rclone.service
相对来说alist
配置还是比较简单,很快就能通过文档设置好。相对比较麻烦的是rclone
,会出现报错情况,只能一点一点排查,如果按照文档走,大概率可以规避掉一些问题。