357全球通 357全球通

用rclone在VPS上挂载Google Drive网盘

in 默认分类 read (1195) 文章转载请注明来源!

更新

1、解决直接在线观看问题(不用通过GoogleDrive)

2、增加直接下载功能

3、自动同步下载完的内容到谷歌网盘


前言

刚才在俄罗斯的小鸡上用Aria2下了个BT,奈何无法在线看。可以部署一下可道云在线观看,不过小鸡没装LAMP,LNMP也没装,装好也要半小时,再说硬盘还有5G,于是想能不能把VPS挂载到别的网盘上?俺正好手里还有三个教育邮箱,无限的Google Drive储存空间....

Rat's Blog看到了篇文章,给我带来了解决办法

我不是药神
注意:Rat博客的教程只适用Debian/Ubuntu系统,如果你是CentOS,请参考:https://rclone.org/install/,安装rclone。挂载方法和下面差不多。

安装rclone

rclone可以帮助我们在Linux上挂载一些储存服务,包括Google drive, onedrive, box, AWS S3等等,同时不会占用硬盘空间

wget https://www.moerats.com/usr/shell/rclone_debian.sh && bash rclone_debian.sh

备用下载

wget https://xz.357global.top/Bash/rclone_debian.sh && bash rclone_debian.sh

初始化配置

rclone config

会出现以下信息

n) New remote
s) Set configuration password
q) Quit config
n/s/q> n #此处填n
name> John #随便命名,一会要用到
Type of storage to configure.
Choose a number from below, or type in your own value
 1 / Alias for a existing remote
   \ "alias"
 2 / Amazon Drive
   \ "amazon cloud drive"
 3 / Amazon S3 Compliant Storage Providers (AWS, Ceph, Dreamhost, IBM COS, Minio)
   \ "s3"
 4 / Backblaze B2
   \ "b2"
 5 / Box
   \ "box"
 6 / Cache a remote
   \ "cache"
 7 / Dropbox
   \ "dropbox"
 8 / Encrypt/Decrypt a remote
   \ "crypt"
 9 / FTP Connection
   \ "ftp"
10 / Google Cloud Storage (this is not Google Drive)
   \ "google cloud storage"
11 / Google Drive
   \ "drive"
12 / Hubic
   \ "hubic"
13 / Local Disk
   \ "local"
14 / Mega
   \ "mega"
15 / Microsoft Azure Blob Storage
   \ "azureblob"
16 / Microsoft OneDrive
   \ "onedrive"
17 / OpenDrive
   \ "opendrive"
18 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
   \ "swift"
19 / Pcloud
   \ "pcloud"
20 / QingCloud Object Storage
   \ "qingstor"
21 / SSH/SFTP Connection
   \ "sftp"
22 / Webdav
   \ "webdav"
23 / Yandex Disk
   \ "yandex"
24 / http Connection
   \ "http"
Storage> 11 #选择11,Google Drive
Google Application Client Id - leave blank normally.
client_id>  #留空,回车
Google Application Client Secret - leave blank normally.
client_secret> #留空,回车
Scope that rclone should use when requesting access from drive.
Choose a number from below, or type in your own value
 1 / Full access all files, excluding Application Data Folder.
   \ "drive"
 2 / Read-only access to file metadata and file contents.
   \ "drive.readonly"
   / Access to files created by rclone only.
 3 | These are visible in the drive website.
   | File authorization is revoked when the user deauthorizes the app.
   \ "drive.file"
   / Allows read and write access to the Application Data folder.
 4 | This is not visible in the drive website.
   \ "drive.appfolder"
   / Allows read-only access to file metadata but
 5 | does not allow any access to read or download file content.
   \ "drive.metadata.readonly"
scope> #设置权限,选择1
ID of the root folder - leave blank normally.  Fill in to access "Computers" folders. (see docs).
root_folder_id> #留空,回车 
Service Account Credentials JSON file path  - leave blank normally.
Needed only if you want use SA instead of interactive login.
service_account_file>  #留空,回车 
Remote config
Use auto config?
 * Say Y if not sure
 * Say N if you are working on a remote or headless machine or Y didn't work
y) Yes
n) No
y/n> n #选n
If your browser doesn't open automatically go to the following link: https://accounts.google.com/o/oauth2/auth?...........................(此处网址已省略复制到浏览器打开,获取验证码) 
Log in and authorize rclone for access 
Enter verification code>  #填入上面获取到的验证码
Configure this as a team drive?
y) Yes
n) No
y/n> y #填y
Fetching team drive list...
No team drives found in your account--------------------
[John]
type = drive
client_id = 
client_secret = 
scope = drive
root_folder_id = 
service_account_file = 
token = {"access_token":""} #此处我已省略
team_drive = 
--------------------
y) Yes this is OK
e) Edit this remote
d) Delete this remote
y/e/d> y #选择y
Current remotes:

Name                 Type
====                 ====
John                 drive

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退出
e/n/d/r/c/s/q> q
root@ih1083690:~#

挂载为磁盘

#新建本地文件夹,路径自己定,即下面的LocalFolder
mkdir /root/GoogleDrive
#挂载为磁盘
rclone mount DriveName:Folder LocalFolder --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000
####比如,我的Folder是VPSe,本地文件夹是GoogleDrive,所以
rclone mount John:VPSe GoogleDrive --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000
###另外可能会卡在这一步中,其实可能已经成功了。建议等一小会,新开一个窗口查看下

DriveName为初始化配置填的nameFolderGoogle Drive里的文件夹,LocalFolderVPS上的本地文件夹。

挂载成功后,输入df -h命令查看即可!


这一步卡住了
卡住了
新开一个窗口查看,其实已经成功了
ok

卸载磁盘

fusermount -qzu LocalFolder
##我的fusermount -qzu GoogleDrive

之后要让他自启动

下载并编辑脚本

wget https://www.moerats.com/usr/shell/rcloned && nano rcloned

备用下载地址

wget https://xz.357global.top/Bash/rcloned && nano rcloned

修改一下内容:

NAME=""  #rclone name名,及配置时输入的Name
REMOTE=''  #远程文件夹,Google Drive网盘里的挂载的一个文件夹
LOCAL=''  #挂载地址,VPS本地挂载目录

设置自启

#Debian系统
apt-get install sudo -y

#设置自启
mv rcloned /etc/init.d/rcloned
chmod +x /etc/init.d/rcloned
update-rc.d -f rcloned defaults
bash /etc/init.d/rcloned start

检测信息显示rclone启动成功即可。

成功了!

这时候俺在/GoogleDrive找到下好的视频,发现谷歌网盘中也存在了一份!
666
无限的网盘空间,可以放多少小姐姐啊........
观影愉快!再见!

关于版权问题,大部分地区是禁止下载BT和盗版文件的
用VPS下载BT可能导致主机商封你的服务器!使用前请仔细阅读主机商的TOS
一般乌克兰、罗马尼亚等地的VPS抗版权比较厉害
也要多支持国产电影啦,我只是做个测试随便找个视频下一下....
That's all!


查看更新

通过部署Directory Lister来实现下载内容在线观看(免翻墙)以及分享、下载等
自动同步下载完的内容到谷歌网盘

jrotty WeChat Pay

微信打赏

jrotty Alipay

支付宝打赏

文章二维码

扫描二维码,在手机上阅读!

本文基于《署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)》许可协议授权
文章链接:http://www.357global.com/archives/rclone.html (转载时请注明本文出处及文章链接)

Aria2
发表新评论
PREVIOUS NEXT
雷姆
拉姆