rclone+onedrive+jellyfin+Nginx实操
使用Rclone上传你的宝塔备份到Onedrive或其他主流网盘 (henu.gay)
Linux 服务器使用 Rclone 挂载 OneDrive - Mr. Ma's Blog (misterma.com)
Rclone安装配置教程: 挂载OneDrive同步文件 – 瓦力箱子 (walixz.com)
使用Docker搭建Aria2+AriaNG+TG Bot (notion.site)
怎样在Debian 10 Buster上安装Jellyfin Media Server - 月灯依旧 (bynss.com)
怎样在 Linux 中使用 Jellyfin 设置流媒体服务器 - 月灯依旧 (bynss.com)
基于Plex + Rclone+ Onedrive 打造家用流媒体中心 - Lblog
docker安装transmission、qbittorrent、flexget | VPS小白 (vpsxb.net)
Windows运行rclone
在本地Windows电脑上下载rclone,下载地址:https://rclone.org/downloads/
。然后解压出来,比如我解压到D盘,文件夹命名rclone,此时点击Win+R,然后输入cmd,确定。再输入以下命令:
cd /d d:\rclone
rclone authorize "onedrive"
然后浏览器会弹出窗口,按提示登录要挂载OneDrive的Office账户,登录完成后选择同意授权,接着回到cmd窗口中,复制{"access_token":"XXXX"}
这一串Token信息,后续需要用到。(如果cmd窗口中没有输出Token信息,可能是失去鼠标焦点而停止运行了,在cmd窗口中多回车几下可解决。)
Linux安装rclone
root用户下直接执行(非root权限将下面的bash替换为 sudo bash
):
curl https://rclone.org/install.sh | bash
配置rclone
rclone config
会出现以下信息(rclone各个版本可能有所出入,自行判断):
- root@debian:~# rclone config
- No remotes found - make a new one
- n) New remote
- s) Set configuration password
- q) Quit config
- n/s/q> n #1.选择新建
- name> Cimen #2.名称随意
- Type of storage to configure.
- Enter a string value. Press Enter for the default ("").
- Choose a number from below, or type in your own value
- 1 / 1Fichier
- \ "fichier"
- 2 / Alias for an existing remote
- \ "alias"
- 3 / Amazon Drive
- \ "amazon cloud drive"
- 4 / Amazon S3 Compliant Storage Providers including AWS, Alibaba, Ceph, Digital Ocean, Dreamhost, IBM COS, Minio, and Tencent COS
- \ "s3"
- 5 / Backblaze B2
- \ "b2"
- 6 / Box
- \ "box"
- 7 / Cache a remote
- \ "cache"
- 8 / Citrix Sharefile
- \ "sharefile"
- 9 / Compress a remote
- \ "compress"
- 10 / Dropbox
- \ "dropbox"
- 11 / Encrypt/Decrypt a remote
- \ "crypt"
- 12 / Enterprise File Fabric
- \ "filefabric"
- 13 / FTP Connection
- \ "ftp"
- 14 / Google Cloud Storage (this is not Google Drive)
- \ "google cloud storage"
- 15 / Google Drive
- \ "drive"
- 16 / Google Photos
- \ "google photos"
- 17 / Hadoop distributed file system
- \ "hdfs"
- 18 / Hubic
- \ "hubic"
- 19 / In memory object storage system.
- \ "memory"
- 20 / Jottacloud
- \ "jottacloud"
- 21 / Koofr
- \ "koofr"
- 22 / Local Disk
- \ "local"
- 23 / Mail.ru Cloud
- \ "mailru"
- 24 / Mega
- \ "mega"
- 25 / Microsoft Azure Blob Storage
- \ "azureblob"
- 26 / Microsoft OneDrive
- \ "onedrive"
- 27 / OpenDrive
- \ "opendrive"
- 28 / OpenStack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
- \ "swift"
- 29 / Pcloud
- \ "pcloud"
- 30 / Put.io
- \ "putio"
- 31 / QingCloud Object Storage
- \ "qingstor"
- 32 / SSH/SFTP Connection
- \ "sftp"
- 33 / Sugarsync
- \ "sugarsync"
- 34 / Tardigrade Decentralized Cloud Storage
- \ "tardigrade"
- 35 / Transparently chunk/split large files
- \ "chunker"
- 36 / Union merges the contents of several upstream fs
- \ "union"
- 37 / Webdav
- \ "webdav"
- 38 / Yandex Disk
- \ "yandex"
- 39 / Zoho
- \ "zoho"
- 40 / http Connection
- \ "http"
- 41 / premiumize.me
- \ "premiumizeme"
- 42 / seafile
- \ "seafile"
- Storage> 26 #3.选择Microsoft OneDrive,不同版本序号可能会不同!
- ** See help for onedrive backend at: https://rclone.org/onedrive/ **
- OAuth Client Id
- Leave blank normally.
- Enter a string value. Press Enter for the default ("").
- client_id> #4.直接回车留空
- OAuth Client Secret
- Leave blank normally.
- Enter a string value. Press Enter for the default ("").
- client_secret> #5.同样回车留空
- Choose national cloud region for OneDrive.
- Enter a string value. Press Enter for the default ("global").
- Choose a number from below, or type in your own value
- 1 / Microsoft Cloud Global
- \ "global"
- 2 / Microsoft Cloud for US Government
- \ "us"
- 3 / Microsoft Cloud Germany
- \ "de"
- 4 / Azure and Office 365 operated by 21Vianet in China
- \ "cn"
- region> 1 #6.由于我挂载的是E5的OneDrive,因此选择1,世纪互联请选择4,不同版本序号可能不同!
- Edit advanced config? (y/n)
- y) Yes
- n) No (default)
- y/n> #7.直接回车默认
- Remote config
- Use auto config?
- * Say Y if not sure
- * Say N if you are working on a remote or headless machine
- y) Yes (default)
- n) No
- y/n> n #8.这里请选择n,后续能手动输入Token
- For this to work, you will need rclone available on a machine that has
- a web browser available.
- For more help and alternate methods see: https://rclone.org/remote_setup/
- Execute the following on the machine with the web browser (same rclone
- version recommended):
- rclone authorize "onedrive"
- Then paste the result below:
- result> #9.这里粘贴你获取到的Token信息并回车,格式大致为{"access_token":"XXXX"}
- Choose a number from below, or type in an existing value
- 1 / OneDrive Personal or Business
- \ "onedrive"
- 2 / Root Sharepoint site
- \ "sharepoint"
- 3 / Sharepoint site name or URL (e.g. mysite or https://contoso.sharepoint.com/sites/mysite)
- \ "url"
- 4 / Search for a Sharepoint site
- \ "search"
- 5 / Type in driveID (advanced)
- \ "driveid"
- 6 / Type in SiteID (advanced)
- \ "siteid"
- 7 / Sharepoint server-relative path (advanced, e.g. /teams/hr)
- \ "path"
- Your choice> 1 #10.选1挂载OneDrive
- Found 1 drives, please select the one you want to use:
- 0: OneDrive (business) id=b!o44VutxxxxxxxxxxxxxxxxxxxxxztxqCMZG-
- Chose drive to use:> 0 #11.输入冒号前的序号,这里输入0
- Found drive 'root' of type 'business', URL: https://xxx-my.sharepoint.com/personal/xxx_xxx_onmicrosoft_com/Documents
- Is that okay?
- y) Yes (default)
- n) No
- y/n> #11.直接回车,默认确认
- --------------------
- [Cimen] #你最初输入的名称
- type = onedrive #挂载的类型
- region = global #你选择的区域
- token = {"access_token":""} #这里是你之前粘贴的Token信息
- drive_id = b!o44VutxxxxxxxxxxxxxxxxxxxxxztxqCMZG- #这里是磁盘ID
- drive_type = business #挂载的云盘属性(默认识别),如不正确请选择e进行修改,或者选择d删除,重新配置
- --------------------
- y) Yes this is OK (default)
- e) Edit this remote
- d) Delete this remote
- y/e/d> y #12.确认信息无误后输入y,或直接默认值回车
- Current remotes:
- Name Type
- ==== ====
- Cimen onedrive
- 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 #13.退出rclone配置
安装Fuse
apt install fuse
挂载
说明:需要先将本地的Windows,获取到的rclone配置文件rclone.config
,上传到vps的rclone配置文件所在位置。
#新建本地文件夹,路径自己定,即下面的LocalFolder
mkdir /OneDrive
#挂载为磁盘,下面的三个参数需要替换,详细看下面的说明
rclone mount DriveName:Folder LocalFolder --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000
#DriveName 为初始化配置填的名称
#Folder 为OneDrive里的文件夹
#LocalFolder 为VPS上的本地文件夹,如果不存在请先新建它!
例如:rclone mount Cimen:Backupload /OneDrive --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000
然后按Ctrl+c退出挂载。
开机自启
新建systemd配置文件
同样修改三个参数,然后全部粘贴到ssh中执行。
#将后面修改成你上面手动运行命令中,除了rclone的全部参数
command="mount DriveName:Folder LocalFolder --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000"
#以下是一整条命令,一起复制到SSH客户端运行
cat > /etc/systemd/system/rclone.service <<EOF
[Unit]
Description=Rclone
After=network-online.target
[Service]
Type=simple
ExecStart=$(command -v rclone) ${command}
Restart=on-abort
User=root
[Install]
WantedBy=default.target
EOF
使用的是下面的脚本,上面这条没太看懂!为了方便以后挂载,所以用了下面这条,比较清晰明了。
相关命令
#开始启动:
systemctl start rclone
#设置开机自启:
systemctl enable rclone
#其他命令:
#重启:systemctl restart rclone
#停止:systemctl stop rclone
#状态:systemctl status rclone
问题
如果挂载过程中出现NOTICE: One drive root 'vpsbackup': --vfs-cache-mode writes or full is recommended for this remote as it can't stream
错误,可以无视该错误。
可能用到的命令
卸载磁盘
fusermount -qzu LocalFolder #LocalFolder为你vps本地文件夹
其它参数
#如果你还涉及到读取使用,比如使用H5ai等在线播放,就在后面多加上以下三条参数
--dir-cache-time 12h
--vfs-read-chunk-size 32M
--vfs-read-chunk-size-limit 1G
jellyfin安装
其实jellyfin/emby/plex,这三个随意,plex不知道是我帐号的原因,没成功,emby和本地服务冲突,所以选择了jellyfin
jellyfin采用docker的方式进行安装
1、安装docker
wget -qO- get.docker.com | bash
2、部署jellyfin
docker run -d \
--name=jellyfin \
-e PUID=1000 \
-e PGID=1000 \
-e TZ=Asia/Shanghai \
-p 8096:8096 \
-p 8920:8920 \
-p 7359:7359/udp \
-p 1900:1900/udp \
-v /docker/jellyfin/config:/config \
-v /disk:/data \
--restart unless-stopped \
ghcr.io/linuxserver/jellyfin
这几个为对应的端口,可以自行修改,最主要的是8096
,这个是jellyfin的web ui端口
-p 8096:8096 \
-p 8920:8920 \
-p 7359:7359/udp \
-p 1900:1900/udp \
这几个为jellyfin映射的本地磁盘,例如:jellyfin里的/data
,就相当于VPS的 /disk
目录,/dsk
则为rclone挂载的onedirve的位置!
-v /docker/jellyfin/config:/config \
-v /disk:/data \
如果直接运行的以上命令就可以通过,VPS的https://IP地址:8096
,访问jellyfin了
Nginx反向代理+SSL
暂时不需要,所以还没测试
但可以参考这片文章
版权声明:
作者:Jays
链接:https://ijays.com/2022/03/rclone-onedrive-jellyfin-nginx.html
来源:颓废的美
文章版权归作者所有,未经允许请勿转载。
共有 0 条评论