• :twisted: :twisted: 真的是一万头草泥马狂奔了~~目前只有重庆被劫持~据说是,哪个地区 ip 访问多,就会屏蔽哪个地区!

  • 博客图片原来是放到 google drive,然后通过 cloudflare workers 反代的,但是发现在兲朝速度不佳,所以就趁着空闲分离出来,重新做了图床程序。

  • 豆博今天增加了 Railgun 来加速博客动态文件了,折腾了半天终于完成!

  • 感觉上好久都没换新衣服了,换个新衣服,换个好心情吧!

记录一下vps挂载google drive

网络汇集 豆子 2个月前 (12-25) 709次浏览 已收录 0个评论 扫描二维码
文章目录[隐藏]

为了上传文件方便一点,所以豆子偷空在vps上装了 rclone,并使用 rclone挂载google drive。为了查找方便,特记录一下步骤。
首先,

vps 需要安装 rclone。操作环境是 ubuntu 20.04,其他系统雷同。

 

apt install rclone -y

查看 rclone 版本:

rclone --version

显示:

rclone v1.50.2
- os/arch: linux/arm64
- go version: go1.13.8

接下来配置 rclone 挂载

输入:

rclone config

显示:

2023/12/25 09:15:24 NOTICE: Config file "/root/.config/rclone/rclone.conf" not found - using defaults
No remotes found - make a new one
n) New remote
s) Set configuration password
q) Quit config
n/s/q>

输入 n,回车

然后输入配置的名字(需要英文输入),然后回车

显示:

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 Provider (AWS, Alibaba, Ceph, Digital Ocean, Dreamhost, IBM COS, Minio, etc)
   \ "s3"
 5 / Backblaze B2
   \ "b2"
 6 / Box
   \ "box"
 7 / Cache a remote
   \ "cache"
 8 / Citrix Sharefile
   \ "sharefile"
 9 / Dropbox
   \ "dropbox"
10 / Encrypt/Decrypt a remote
   \ "crypt"
11 / FTP Connection
   \ "ftp"
12 / Google Cloud Storage (this is not Google Drive)
   \ "google cloud storage"
13 / Google Drive
   \ "drive"
14 / Google Photos
   \ "google photos"
15 / Hubic
   \ "hubic"
16 / JottaCloud
   \ "jottacloud"
17 / Koofr
   \ "koofr"
18 / Local Disk
   \ "local"
19 / Mail.ru Cloud
   \ "mailru"
20 / Microsoft Azure Blob Storage
   \ "azureblob"
21 / Microsoft OneDrive
   \ "onedrive"
22 / OpenDrive
   \ "opendrive"
23 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
   \ "swift"
24 / Pcloud
   \ "pcloud"
25 / Put.io
   \ "putio"
26 / SSH/SFTP Connection
   \ "sftp"
27 / Transparently chunk/split large files
   \ "chunker"
28 / Union merges the contents of several remotes
   \ "union"
29 / Webdav
   \ "webdav"
30 / Yandex Disk
   \ "yandex"
31 / http Connection
   \ "http"
32 / premiumize.me
   \ "premiumizeme"

输入你要挂载的类型,比如豆子挂载的是 google drive,这里就输入 13,然后回车

** See help for drive backend at: https://rclone.org/drive/ **

Google Application Client Id
Setting your own is recommended.
See https://rclone.org/drive/#making-your-own-client-id for how to create your own.
If you leave this blank, it will use an internal key which is low performance.
Enter a string value. Press Enter for the default ("").
client_id>     ##这里输入 client_id,不知道的可以自行 google 然后回车
Google Application Client Secret
Setting your own is recommended.
Enter a string value. Press Enter for the default ("").
client_secret>     ## 这里输入密钥,然后回车
Scope that rclone should use when requesting access from drive.
Enter a string value. Press Enter for the default ("").   ##这里直接回车

然后让你选择权限:

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,然后回车
接着,需要选择挂载硬盘的路径,如果是全盘挂载,那么直接回车,但是豆子是挂载的指定文件夹,所以需要输入 folder 的 id

ID of the root folder
Leave blank normally.

Fill in to access "Computers" folders (see docs), or for rclone to use
a non root folder as its starting point.

Note that if this is blank, the first time rclone runs it will fill it
in with the ID of the root folder.

Enter a string value. Press Enter for the default ("").
root_folder_id>     ##输入文件夹的 id 后,回车

接着提示是否进行高级配置,这里豆子选 n,然后回车
然后询问是否自动配置,照样选 n,然后回车

Service Account Credentials JSON file path 
Leave blank normally.
Needed only if you want use SA instead of interactive login.
Enter a string value. Press Enter for the default ("").
service_account_file> 
Edit advanced config? (y/n)
y) Yes
n) No
y/n> n
Remote config
Use auto config?
 * Say Y if not sure
 * Say N if you are working on a remote or headless machine
y) Yes
n) No
y/n> n

然后会返回一个网址,复制出来,在浏览器中打开,然后授权,会给你一个授权密钥,复制密钥后,返回到 ssh 界面,然后粘贴进去,回车。
然后会询问是否团队协作盘,这里豆子的并非是团队盘,所以选 n,回车。

Configure this as a team drive?
y) Yes
n) No
y/n> n

然后会返回一大堆刚才的配置,接着询问是否完成等等

y) Yes this is OK
e) Edit this remote
d) Delete this remote
y/e/d> y
Current remotes:

Name                 Type
====                 ====
XXX                   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

到这一步,rclone 配置完成,现在使用命令进行挂载到 vps 上。

创建挂载目录,并进行挂载:

mkdir -p /opt/gd
rclone mount XXX: /opt/gd --allow-other --allow-non-empty --vfs-cache-mode writes --daemon

其中opt/gd路径,是可以自己选择自己想要的路径。到这里,就基本完成,如果你vps装的有面板,那么重启一下面板就可以看到你挂载的硬盘已经展示出来了。


豆博 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA4.0 协议进行授权
转载请注明原文链接:记录一下vps挂载google drive
喜欢 (0)
[sablog@yahoo.cn]
分享 (0)
豆子
关于作者:
豆博站长
发表我的评论
取消评论
声明: 本博采用 BY-NC-SA 协议进行授权
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址