rclone配置
我做了视频教程,B站连接:给个一键三连可好:https://b23.tv/av87553009
需求:Linux服务器上下载了好多资源。但是Linux没有onedrive和google drive的客户端。
那么如何把vps上的文件传到onedrive呢。
这里我们可以用rclone这个工具。
先安装rclone
第一步:我们先在windows上配置一下
下载windows对应位数的压缩包,网址:https://rclone.org/downloads/
先解压到D:\rclone
管理员命令提示符(cmd)输入下面的命令,回车
cd /d d:\rclone
rclone authorize "onedrive"
会自动打开浏览器让你登录你的onedrive账户
点击授权后浏览器显示如图
回到cmd,发现多了一大串字符。复制花括号里的所有字符,新建一个文档保存,一会要用。
第二步:开始配置Linux端
打开你的SHH工具连接vps,我的是ubuntu系统,输入:
apt-get update
apt-get install -y unzip fuse
然后输入:
wget https://downloads.rclone.org/rclone-current-linux-amd64.zip
unzip rclone-current-linux-amd64.zip
chmod 0777 ./rclone-*/rclone
cp ./rclone-*/rclone /usr/bin/
rm -rf ./rclone-*
然后输入:
rclone config
即可调出配置信息
第三步:新建
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>
输入n
显示如下
name>
这里我们起个名字
第四步:出现一堆网盘序号
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 / In memory object storage system.
\ "memory"
17 / JottaCloud
\ "jottacloud"
18 / Koofr
\ "koofr"
19 / Local Disk
\ "local"
20 / Mail.ru Cloud
\ "mailru"
21 / Mega
\ "mega"
22 / Microsoft Azure Blob Storage
\ "azureblob"
23 / Microsoft OneDrive
\ "onedrive"
24 / OpenDrive
\ "opendrive"
25 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
\ "swift"
26 / Pcloud
\ "pcloud"
27 / Put.io
\ "putio"
28 / QingCloud Object Storage
\ "qingstor"
29 / SSH/SFTP Connection
\ "sftp"
30 / Sugarsync
\ "sugarsync"
31 / Transparently chunk/split large files
\ "chunker"
32 / Union merges the contents of several remotes
\ "union"
33 / Webdav
\ "webdav"
34 / Yandex Disk
\ "yandex"
35 / http Connection
\ "http"
36 / premiumize.me
\ "premiumizeme"
Storage>
找到对应的序号,我这里onedrive是23号。
输入23回车
第五步:接下来
** See help for onedrive backend at: https://rclone.org/onedrive/ **
Microsoft App Client Id
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_id>
默认空着,直接回车
Microsoft App Client Secret
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_secret>
默认空着,直接回车
Microsoft App Client Secret
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_secret>
Edit advanced config? (y/n)
y) Yes
n) No (default)
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 (default)
n) No
y/n>
选择n
For this to work, you will need rclone available on a machine that has a web browser available.
Execute the following on your machine (same rclone version recommended) :
rclone authorize "onedrive"
Then paste the result below:
result>
这里我们输入刚才复制的一大堆字符串
Choose a number from below, or type in an existing value
1 / OneDrive Personal or Business
\ "onedrive"
2 / Root Sharepoint site
\ "sharepoint"
3 / Type in driveID
\ "driveid"
4 / Type in SiteID
\ "siteid"
5 / Search a Sharepoint site
\ "search"
Your choice>
这里输入1
Found 1 drives, please select the one you want to use:
0: OneDrive (business) id=b!5aaxzEKnQ0moUdSJN5FFiz18jOg3bKJDpnlLne7FeEjh0fnzsP3TSIpazFa4zHn9
Chose drive to use:>
这里显示出来了网盘序号,输入0
Found drive 'root' of type 'business', URL: https://ememe-my.sharepoint.com/personal/admin_ememe_onmicrosoft_com/Documents
Is that okay?
y) Yes (default)
n) No
y/n>
配置好了。输入y
drive_id = b!5aaxzEKnQ0moUdSJN5FFiz18jOg3bKJDpnlLne7FeEjh0fnzsP3TSIpazFa4zHn9
drive_type = business
--------------------
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d
到这里我就就已经配置完成,输入y
然后就没事了。输入q退出rclone就行
第六步:别忘了还需要安装个screen
apt-get install -y screen //这是debian系
centos系安装screen需要使用yum install screen
上传命令
rclone move source:path dest:path //别急看完下面的
screen rclone move /root/download onedrive1:/upload --transfers 32 -P //完整的命令
参数详解:
source:path是本地目录,dest:path是云端目录
其中dest是网盘名称,就你刚才随便取的那个path就是目录
你可以指定上传到哪一个文件夹
比如说,
我要把本地的/root/download目录下所有的文件移动到onedrive里面的/upload文件夹里面
命令应该是rclone move /root/download onedrive1:/upload
但是这样上传的话,他一直在前台上传,占用你的ssh。 想让他变成后台,在前面加上screen
命令就是:screen rclone move /root/download onedrive1:/upload
这样你就可以关掉ssh,他就可以在后台上传
如果文件目录比较复杂,而且文件数量庞大 可以提高线程,他默认是4线程,测试后发现100M带宽32线程效果最好。(根据你的vps而定线程。)
可以在后面再加一个参数 -P(大写)显示上传详情
screen rclone move /root/download onedrive1:/upload –transfers 32 -P
screen
等你想看看传完了没有的时候, screen -ls就可以看到后台screen进程。
配置google drive
看这篇https://hechuan.me/rclone-google-drive