个人建议使用Google Drive,对API的管制较松,且目前市面上仍可买到无限容量的团队盘/套餐。
申请谷歌API
浏览器打开此链接,选择项目
新建一个项目
找到下面的Google Drive API,启用
创建一个OAuth 客户端ID,但在这之前我们还需要配置同意屏幕
User Type选择外部,信息随便填一下就行
发布一下应用,不然过几天就不能用了
继续创建OAuth客户端ID
拿到了客户端ID和客户端密钥,保存备用,至此申请完毕
安装Rclone
curl https://rclone.org/install.sh | sudo bash
配置Rclone
rclone config
进入rclone配置界面,我们输入n
新建一个,为它起一个名字
Enter name for new remote.
name>
选择你到底需要挂载那种云盘,输入前面对应的数字或者名字都可以
Option Storage.
Type of storage to configure.
Choose a number from below, or type in your own value.
1 / 1Fichier
\ (fichier)
2 / Akamai NetStorage
\ (netstorage)
3 / Alias for an existing remote
\ (alias)
4 / Amazon Drive
\ (amazon cloud drive)
5 / Amazon S3 Compliant Storage Providers including AWS, Alibaba, Ceph, China Mobile, Cloudflare, ArvanCloud, DigitalOcean, Dreamhost, Huawei OBS, IBM COS, IDrive e2, IONOS Cloud, Liara, Lyve Cloud, Minio, Netease, RackCorp, Scaleway, SeaweedFS, StackPath, Storj, Tencent COS, Qiniu and Wasabi
\ (s3)
6 / Backblaze B2
\ (b2)
7 / Better checksums for other remotes
\ (hasher)
8 / Box
\ (box)
9 / Cache a remote
\ (cache)
10 / Citrix Sharefile
\ (sharefile)
11 / Combine several remotes into one
\ (combine)
12 / Compress a remote
\ (compress)
13 / Dropbox
\ (dropbox)
14 / Encrypt/Decrypt a remote
\ (crypt)
15 / Enterprise File Fabric
\ (filefabric)
16 / FTP
\ (ftp)
17 / Google Cloud Storage (this is not Google Drive)
\ (google cloud storage)
18 / Google Drive
\ (drive)
19 / Google Photos
\ (google photos)
20 / HTTP
\ (http)
21 / Hadoop distributed file system
\ (hdfs)
22 / HiDrive
\ (hidrive)
23 / In memory object storage system.
\ (memory)
24 / Internet Archive
\ (internetarchive)
25 / Jottacloud
\ (jottacloud)
26 / Koofr, Digi Storage and other Koofr-compatible storage providers
\ (koofr)
27 / Local Disk
\ (local)
28 / Mail.ru Cloud
\ (mailru)
29 / Mega
\ (mega)
30 / Microsoft Azure Blob Storage
\ (azureblob)
31 / Microsoft OneDrive
\ (onedrive)
32 / OpenDrive
\ (opendrive)
33 / OpenStack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
\ (swift)
34 / Oracle Cloud Infrastructure Object Storage
\ (oracleobjectstorage)
35 / Pcloud
\ (pcloud)
36 / Put.io
\ (putio)
37 / QingCloud Object Storage
\ (qingstor)
38 / SMB / CIFS
\ (smb)
39 / SSH/SFTP
\ (sftp)
40 / Sia Decentralized Cloud
\ (sia)
41 / Storj Decentralized Cloud Storage
\ (storj)
42 / Sugarsync
\ (sugarsync)
43 / Transparently chunk/split large files
\ (chunker)
44 / Union merges the contents of several upstream fs
\ (union)
45 / Uptobox
\ (uptobox)
46 / WebDAV
\ (webdav)
47 / Yandex Disk
\ (yandex)
48 / Zoho
\ (zoho)
49 / premiumize.me
\ (premiumizeme)
50 / seafile
\ (seafile)
Storage>
输入之前的ID和Secret
Option client_id.
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 value. Press Enter to leave empty.
client_id>
Option client_secret.
OAuth Client Secret.
Leave blank normally.
Enter a value. Press Enter to leave empty.
client_secret>
选择读写权限,选1就好
Option scope.
Scope that rclone should use when requesting access from drive.
Choose a number from below, or type in your own value.
Press Enter to leave empty.
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>
这个就是上一步的JSON文件,我们这里不需要,跳过
Option service_account_file.
Service Account Credentials JSON file path.
Leave blank normally.
Needed only if you want use SA instead of interactive login.
Leading `~` will be expanded in the file name as will environment variables such as `${RCLONE_CONFIG_DIR}`.
Enter a value. Press Enter to leave empty.
service_account_file>
不编辑,跳过
Edit advanced config?
y) Yes
n) No (default)
y/n>
如果你看的是比较老一些的教程,他会教你选择y
然后拿到链接去认证。不过目前新版本已经不支持了,你需要拷贝到本机去验证。由于我们的Linux系统并非桌面端,无法在服务器上登录网页进行验证,所以我们选择n
,到电脑上来验证
Use web browser to automatically authenticate rclone with remote?
* Say Y if the machine running rclone has a web browser you can use
* Say N if running rclone on a (remote) machine without web browser access
If not sure try Y. If Y failed, try N.
y) Yes (default)
n) No
y/n>
电脑上下载Rclone,解压,打开CMD,cd
到目录下,执行给出的指令rclone authorize "drive" "XXXXXXXXXXXXXXXX"
,到浏览器中授权。复制CMD中给出的config_token,粘过来
Option config_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 "drive" "XXXXXXXXXXXXXXXX"
Then paste the result.
Enter a value.
config_token>
是否挂载团队盘,选择要挂哪一个
Configure this as a Shared Drive (Team Drive)?
y) Yes
n) No (default)
y/n>
然后会罗列出所有的信息,最后确认
Keep this "1" remote?
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d>
将Rclone链接云盘挂载
首先安装依赖fuse
yum install -y fuse
或
apt install fuse3
创建要挂载的目录文件夹,没有文件夹的话是不会自动创建的。创建完成后使用一下指令挂载
rclone mount 名字: /路径 \
--umask 0000 \
--allow-non-empty \
--allow-other \
--attr-timeout 5m \
--transfers 15 \
--buffer-size 32M \
--low-level-retries 200 \
--vfs-read-chunk-size 32M \
--vfs-read-chunk-size-limit 128M \
--vfs-cache-mode full \
--vfs-cache-max-age 24h \
--vfs-cache-max-size 10G \
--cache-dir /root/.cache/rclone/vfs \
--daemon
解释一下里面的参数:
- vfs-cache-mode full 启用VFS文件缓存
- vfs-cache-max-age 24h 文件缓存时间
- vfs-cache-max-size 文件缓存空间上限
- vfs-read-chunk-size-limit 128M 分块读取大小
- cache-dir 缓存路径,不加就是默认的/root/.cache/rclone/vfs
- transfers 15 传输数量
如果需要取消挂载,使用
fusermount -qzu 挂载路径