最完整rclone挂载网盘到本地(Alist篇)解决方案


Recommended Posts

rclone挂载网盘到本地(Alist篇)

 

alist

最近折腾unraid存储服务器,对于云盘有很多的APP特别麻烦,所以想把所有不同的网盘都放在一起进行管理,先是用了CloudDrive2感觉很不错,图形界面设置很简单,小白都会。我也喜欢,但免费版只能挂两个云盘,一个本地。着实有点失望,开终身会员499.论价格只是unraid一半,但对免费用户来说 ,有点小贵。直到听说alist的大名,rclone是全系列的产品。苹果,Windows,linux等系统全支持。以前还没有用过,这次就来试试。如遇到问题可以去官方网站研究。

 

本次我们跳过所有官方方法安装,在unraid安装插件来实现本地挂载云盘。

安装

1.打开unRaid,到应用

2.搜索“rclone”

3.最新版会有两个rclone,一个docker版,一个插件版。

4.我们下载插件版。

5.如果无法安装。先下载一个docker版的v2rayA。架梯子安装。我用正版unRaid没有任何系统设置,把梯子架好后,添加节点。选择美丽的节点。运行梯子。就能正常下载rclone,不像网上说的那样要在系统go文件,或是在etc网络文件中添加设置才能用 

5.安装完成后,选择插件,看看rclone有没有在插件中。如果有。

6.点右上角的“终端”打开

7.下面我们将开始配置rclone。

 

配置rclone

rclone config    # 进入rclone设置

 

1.

342151888_2024-02-0915_37_24.png.331957c5c25d01b021a9eee74e6e763d.png

No remotes found, make a new one?

n) New remote                 # 创建新配置

s) Set configuration password     # 为配置设置密码

q) Quit config                  # 退出配置

n/s/q> n   enter。  #这里选择n

 

2.

1222987824_2024-02-0915_38_11.png.8684b436cdc4c8f6ed5f66d8e35deec8.png

Enter name for new remote.

name> 189Cloud  enter。  # 设置名字(网络教程都是用remote为配置名)。

 

3.

2046784606_2024-02-0915_38_35.png.4b0035fefdedb9dfb0dfbfed5aae218a.png

Option Storage.

Type of storage to configure.

Choose a number from below, or type in your own value.

前面省略50种连接…….

51 / Uptobox

   \ (uptobox)

52 / WebDAV

   \ (webdav)

53 / Yandex Disk

   \ (yandex)

54 / Zoho

   \ (zoho)

55 / premiumize.me

   \ (premiumizeme)

56 / seafile

   \ (seafile)

Storage>52  enter。  #输入你做连接的服务器序号,这儿我们用webdav做连接,所以选择52

 

 

4.

截屏2024-02-09 15.38.44.png

Option url.

URL of http host to connect to.

E.g. https://example.com.

Enter a value.

url> http://192.168.xxx.xxx:5244/dav/天翼云盘  enter

# 设置远程地址url: http://your_alist_ip:port/dav/网盘名

#这里在alist的地址和端口后加/dav,是alist官方端口挂载要求的

 

5.

2119696981_2024-02-0915_39_19.png.a82561349900847df63cb615ef76e5d2.png

# 这里选7就可以了,1-6都不是我们使用的

Name of the WebDAV site/service/software you are using

Choose a number from below, or type in your own value

Option vendor.

Name of the WebDAV site/service/software you are using.

Choose a number from below, or type in your own value.

Press Enter to leave empty.

 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 / rclone WebDAV server to serve a remote over HTTP via the WebDAV protocol

   \ (rclone)

 7 / Other site/service or software

   \ (other)

vendor>7   enter。

#因为我们选择的是webdav方法挂载云盘。这里选择其它方式连接到服务器就可以了

 

6.

2110677828_2024-02-0915_39_45.png.015e1939b61f2399b4fead260421443e.png

Option user.

User name.

In case NTLM authentication is used, the username should be in the format 'Domain\User'.

Enter a value. Press Enter to leave empty.

user> admin

#这里是你alist的用户名

 

7.

451349435_2024-02-0915_53_38.png.f924950fc3b54e8315f13cecc3e4da12.png

Option pass.

Password.

Choose an alternative below. Press Enter for the default (n).

y) Yes, type in my own password   #是的,输入我自己的密码

g) Generate random password     #生成随机密码

n) No, leave this optional password blank (default)   # 否,将此可选密码留空(默认)

y/g/n>y   enter    #这里输入y

Enter the password:

password:       #这输入你的密码,密码是看不到的

Confirm the password:

password:       #再次输入你的密码

enter

 

8.

342313843_2024-02-0915_53_46.png.210d36e123eea4f6e9d1b54c9ccd8f25.png

Option bearer_token.

Bearer token instead of user/pass (e.g. a Macaroon).

Enter a value. Press Enter to leave empty.

bearer_token>   enter   # 这里是填写密钥的,如果没有可以留空

#直接回车

 

9.

2047803600_2024-02-0915_54_28.png.75bba6c85a0289c8d753fba7f61d991c.png

Edit advanced config?

y) Yes

n) No (default)

y/n>n   enter     #默认配置就可以了

#高级配置或默认配置。

 

10.

1678088536_2024-02-0915_54_53.png.0877b5afa0c9f39f0708e486c231d187.png

 

Configuration complete.

Options:

- type: webdav

- url: http://192.168.xxx.xxx:5244/dav/天翼云盘

- vendor: other

- user: admin

- pass: *** ENCRYPTED ***

Keep this "189Cloud" remote?

y) Yes this is OK (default)      #是的,我确认默认配置

e) Edit this remote           #编辑配置

d) Delete this remote         #删除配置

y/e/d> y    enter

确认配置无误后,确认。

 

11.

1884049040_2024-02-0915_55_38.png.a6fad074365f7d394cfbb854ae6e4ff8.png

Current remotes:

 

Name                 Type

====                 ====

189Cloud             webdav

alist                webdav

 

e) Edit existing remote

n) New remote

d) Delete remote

r) Rename remote

c) Copy remote

s) Set configuration password

q) Quit config

e/n/d/r/c/s/q> q

# 最后按q退出设置

 

 

挂载到本地

1:

查看是否连接成功,使用以下命令可以确认是否已经挂载上了alist和天翼云盘

445102233_2024-02-0916_13_36.png.310fb8d6024cc7d19a46dfae44cc7521.png

rclone lsd Onedrive:

rclone lsd 189Cloud:

# 查看alist的文件目录

#查看天翼云盘的文件目录

 

2:

1128399695_2024-02-1015_06_12.thumb.png.e386c4d547891b859965b7e735026d5d.png

rclone ls Onedrive:

rclone ls 189Cloud:

# 查看Onedrive的文件

#查看天翼云盘的文件

 

如果发生下面的结构,应该检查,你输入的运行脚本是不是正确,查找错误,更正后,就可以看到你的网盘结构了。

截屏2024-02-09 16.07.55.png

 

#

一、    前台模式挂载到本地  (建议用户使用后台挂载)

#1.将Onedrive挂载到本地目录/webdav

rclone mount Onedrive:/ /mnt/user/webdav/alist/Onedrive --copy-links --no-gzip-encoding --no-check-certificate --allow-

other --allow-non-empty --umask 000 --use-mmap

挂载完成后,发现控制台就卡住了,在官方文档看了半天,发现这是前台命令,会一直运行,ctrl+c之后就会退出本地挂载。

 

#2. 将天翼挂载到本地目录/webdav (建议用户使用后台挂载)

rclone mount 189Cloud:/ /mnt/user/webdav/alist/189Cloud --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000 --use-mmap

 

二、    后台模式挂载到本地

# 1.将Onedrive挂载到本地目录/webdav

# --daemon 强制后台模式

 

rclone mount Onedrive:/ /mnt/user/webdav/alist/Onedrive --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000 --use-mmap --daemon

 

官方文档只是提了以下这个命令,并没有太详细的信息。

 

# 2.将189Cloud挂载到本地目录/webdav

# --daemon 强制后台模式

rclone mount 189Cloud:/ /mnt/user/webdav/alist/天翼云盘 --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000 --use-mmap --daemon

 

# 3.将189Cloud挂载到本地目录/webdav

# --daemon 强制后台模式

rclone mount baiduCloud:/ /mnt/user/webdav/alist/百度网盘 --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000 --use-mmap --daemon

 

其它的云盘挂都是一样的配置。只是把下面改在成你所用的云盘就行。

Onedrive:/ /mnt/user/webdav/alist/Onedrive

189Cloud:/ /mnt/user/webdav/alist/天翼云盘

baiduCloud:/ /mnt/user/webdav/alist/百度网盘

115:/ /mnt/user/webdav/alist/115

 

结构简析:

Onedrive:/ /mnt/user/webdav/alist/Onedrive

Onedrive:/      rclone配置名称(自己创建)。为网盘的名字不特指微软网盘test为要挂载的网盘文件夹路径,不填留为挂载整个网盘

/mnt/user/rclone/onedrive      本地用于挂载的目录

关于其他参数含义,可自行查阅最下方命令说明

 

如需要给emby之类使用,挂载文件夹不显示文件,请修改--umask 000

在emby终端输入 umask

/ # umask

0022

/ #

将示例中--umask 000修改为--umask 0022emby即可正常访问文件

 

解除本地挂载

# 解除本地挂载,后面跟的是挂载的本地目录

# 当自动取消挂载失败时,也可以这样手动取消挂载

fusermount -qzu /webdav

 

开机自动挂载

上面的手动挂载方式,在机器重启后,就失效了,每次都要手动在设置一遍,很麻烦。我们可以使用service文件来进行自动挂载。

 

一、使用User Scripts插件新建开机任务

在 Unraid 应用中心安装 User Script 插件。安装后打开插件,添加新脚本,此处命名为 automount_rclone

930205467_2024-02-1015_30_46.png.6d61d20ee0d90bd778c4588300050c30.png

1.    添加新脚本

2.    脚本名称命名为:automount_rclone

3.    保存

 

 

 

4.    编辑脚本

5.    把要挂载的网盘的后台运行脚本全都添加到编辑栏中

 

312714415_2024-02-1015_19_55.thumb.png.58a1ed21dcab14f256c7d8941aeed7db.png

6.    如果有两条或更多回车后再添加一条。

7.    保存脚本。

8.    计划任务以“陈列启动时运行”

 

1542495211_2024-02-1014_44_00.png.2fcde966e024bb1deb028bb34649533f.png

9. Apply(应用)

10.Done(完成)

 

 

设置好之后,就可以开机启动阵列自动挂载了。

 

二、      修改Service文件新建开机任务,输入示例命令 (本人未测试,但作为保留)

设置service文件

#创建service文件

vim /usr/lib/systemd/system/rclone.service

 

文件内容:

[Unit]

Description=rclone

 

[Service]

User=root

ExecStart=/usr/bin/rclone mount alist: /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,会出现报错情况,只能一点一点排查,如果按照文档走,大概率可以规避掉一些问题。

 

Edited by wuyongjun
  • Like 3
Link to comment
  • 3 weeks later...

感谢大哥的完整教程,rclone用了好长时间,现在又温故知新。

但有一件事不明白,alist的本地挂载功能是怎么弄的?之前看到作者已经集成了本地挂载的功能,但好像跟rclone比起来还是有功能上的差异?alist没办法单独挂载单个云盘到本地?

Edited by Marshmallow
Link to comment
  • 2 weeks later...
On 3/2/2024 at 3:42 AM, Marshmallow said:

感谢大哥的完整教程,rclone用了好长时间,现在又温故知新。

但有一件事不明白,alist的本地挂载功能是怎么弄的?之前看到作者已经集成了本地挂载的功能,但好像跟rclone比起来还是有功能上的差异?alist没办法单独挂载单个云盘到本地?

alist本身是不提供本地挂载功能的。它只提供云盘集成本地功能。就是在那个网页上看的功能。要挂载到本地上像硬盘一样用。就得用rclone来挂载了,当然你要是用mac或是用windows来挂载像硬盘一样用就下载rclone的mac版和windows版本来配置。当然也可以映像服务器的上的本地目录挂载到mac或Windows上使用

Link to comment
  • 3 weeks later...
  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.