简介
Rclone是一个用于云存储管理的命令行工具,支持多种云服务提供商,例如Google Drive、Amazon S3、Microsoft OneDrive等等。使用rclone,用户可以方便地将文件上传、下载、同步到不同的云存储服务中,同时也支持加密、压缩、筛选等多种功能。
Rclone是一个跨平台工具,可以在Linux、macOS、Windows等系统上运行。用户可以使用命令行界面或者Web界面进行操作,而且还有大量的命令和选项,可供用户进行高度自定义和配置。
除了常见的云存储服务,rclone还支持许多其他类型的服务,例如FTP、SFTP等,这使得用户可以方便地将文件传输到本地计算机或其他服务器。
总之,rclone是一个非常实用的工具,可以帮助用户轻松管理云存储,同时也提供了许多高级的功能,适合那些需要在不同云服务之间频繁传输文件的用户使用。
安装
1.在终端输入命令安装rclone
curl https://rclone.org/install.sh | sudo bash
2.输入以下命令配置rclone
rclone config
3.继续下面操作
PS C:\Windows\system32> rclone config # 第一步在终端输入 rclone config
No remotes found, make a new one?
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n # 第二步输入n创建新的配置
Enter name for new remote.
name> OneDrive_local # 第三步 输入一个英文名称 ,中间也不要有空格
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> 31 # 第四步 输入要配置的网盘类型 因为我们要配置Microsoft OneDrive 因此输入31
Option client_id.
OAuth Client Id.
Leave blank normally.
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> # 第六步 直接回车
Option region.
Choose national cloud region for OneDrive.
Choose a number from below, or type in your own string value.
Press Enter for the default (global).
1 / Microsoft Cloud Global
\ (global)
2 / Microsoft Cloud for US Government
\ (us)
3 / Microsoft Cloud Germany
\ (de)
4 / Azure and Office 365 operated by Vnet Group in China
\ (cn)
region> # 第七步 直接回车,他会默认选择onedrive
Edit advanced config?
y) Yes
n) No (default)
y/n> n # 第八步 输入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> n # 第九步 输入n 使用手动配置
==============================
注:这边会出现需要将token输入的界面见 下图
============================
Option config_type.
Type of connection
Choose a number from below, or type in an existing string value.
Press Enter for the default (onedrive).
1 / OneDrive Personal or Business
\ (onedrive)
2 / Root Sharepoint site
\ (sharepoint)
/ Sharepoint site name or URL
3 | 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)
/ Sharepoint server-relative path (advanced)
7 | E.g. /teams/hr
\ (path)
config_type> 1 # 第十步 输入1 因为现在我配置的是 OneDrive Personal or Business 类型的网盘
Option config_driveid.
Select drive you want to use
Choose a number from below, or type in your own string value.
Press Enter for the default (2dc359999f9c450d).
1 / (personal)
\ (2dc359999f9c450d)
config_driveid> # 第十一步 直接回车
Drive OK?
Found drive "root" of type "personal"
URL: https://onedrive.live.com/?cid=2dc359999f9c450d
y) Yes (default)
n) No
y/n> # 第十二步 直接回车默认选择yes
在[[rclone挂载OneDrive为本地硬盘-windowns]]文章中会出现token的字样如下图:
将token:后面全部数据复制到上面回车
此时就可以用rclone ls remote:path来查看是否安装成功
设置定时任务进行增量备份
crontab -e # 进行编辑
0 24 * * * /usr/bin/rclone sync /mnt/docker OneDrive:/Backups/vps/aliyun/docker > /dev/null 2>&1 # 将此命令粘贴进去保存,这命令意思是每天24点准时运行此命令