1. Rclone安装

apt update

apt-get install fuse -y

apt install fuse3 -y

curl https://rclone.org/install.sh | bash

2. Rclone config 配置

  1. No remotes found, make a new one?

n) New remote ##新建远程挂载配置

  1. Enter name for new remote ##输入新的远程挂载名
    name> alist ##输入名称
  2. Option Storage,Type of storage to configure,Choose a number from below, or type in your own value.配置的存储类型,从下面选择一个数字,或键入您自己的值。
    55 / WebDAV
    \ (webdav)
    Storage> 55 ##选择协议55
  3. Option url.URL of http host to connect to. ##配置url
    url> http://127.0.0.1:5244/dav/ ##设置alist的地址和端口,注意alist的webdav挂载链接加dav后缀
  4. Option vendor.Name of the WebDAV site/service/software you are using.Choose a number from below, or type in your own value.
    6 / Other site/service or software ##其他网站/服务或软件
    \ (other)
    vendor> 6 # 选择6
  5. Option user,User name. 配置用户名密码
    user> alist #输入用户名alist
    y) Yes, type in my own password #选择Y,输入密码
  6. Option bearer_token.
  7. Edit advanced config? #是否进入高级配置
    n) No (default) #选择默认N
  8. Configuration complete. #配置完成

3. Rclone挂载

挂载命令:/usr/bin/rclone mount alist:/百度云盘 /data/webdav --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000 --use-mmap --daemon

alist: /data/webdav 挂载名称alist,挂载目录/data/webdav

--dir-cache-time 24h 缓存时间24小时

--cache-dir=/data/cache 缓存目录/data/cache

4. Rclone自动启动

编辑文件

nano /lib/systemd/system/rc-local.service

[Unit]
Description=/etc/rc.local Compatibility
Documentation=man:systemd-rc-local-generator(8)
ConditionFileIsExecutable=/etc/rc.local
After=network.target

[Service]
Type=forking
ExecStart=/usr/bin/rclone mount alist:/百度云盘 /data/webdav --copy-links --no-gzip-encoding --no-check-certificate --allow-other --umask 000 --use-mmap --daemon
TimeoutSec=0
RemainAfterExit=yes
GuessMainPID=no

以下是另一条命令,设置开机自启命令

systemctl enable rc-local.service

5. Rclone管理命令

使用 df -h 可查看是否挂载成功如果挂载成功,运行rclone tree alist:/(alist为你挂载的名称)即可看到目录

取消挂载:fusermount -qzu /data/webdav

启动:systemctl start rc-local.service
重启:systemctl restart rc-local.service
停止:systemctl stop rc-local.service
状态:systemctl status rc-local.service

6. Rclone Docker-compose

version: "3"
services:
  rclone:
    image: mumiehub/rclone-mount
    container_name: rclone
    user: root
    network_mode: host
    restart: always
    cap_add:
      - SYS_ADMIN
    devices:
      - /dev/fuse
    security_opt:
      - apparmor:unconfined
    volumes:
      - /root/.config/rclone:/root/.config/rclone
      - /theater:/mnt/mediaefs:shared
    environment:
      - RemotePath=gdtry:/
      - ConfigDir=/root/.config/rclone
      - ConfigName=rclone.conf
      - MountCommands=--use-mmap --umask 000 --default-permissions --no-check-certificate --allow-other --allow-non-empty --vfs-cache-mode full --buffer-size 256M --vfs-read-ahead 512M --vfs-read-chunk-size 32M --vfs-read-chunk-size-limit off --vfs-cache-max-size 30G --low-level-retries 200

如果觉得我的文章对你有用,请随意赞赏