RedHat/Centos

关注公众号 jb51net

关闭
操作系统 > RedHat/Centos >

Centos 7安装Rclone如何用命令同步国外网盘文件?

脚本之家

国内网盘都是不靠谱的,瞎耽误功夫;除了115网盘我觉得其它都是渣渣,可它价格忒贵,而且能存活多久也是个问题;如果要存放重要资料个人觉得还是国外网盘靠谱得多,虽然免费容量有限扩容收费,但图的就是个安全有保障,数据无价!

Rclone这是Github上的一个开源程序,负责在linux服务器中上传下载同步国外主流网盘用的神器;支持以下国外网盘Google Drive、Amazon S3、Openstack Swift / Rackspace cloud files / Memset Memstore、Dropbox、Google Cloud Storage、Amazon Drive、Microsoft One Drive、Hubic、Backblaze B2、Yandex Disk、The local filesystem;

下午我在内地家里使用局域网中的一台安装了Centos 7系统的服务器,运行Rclone命令上传下载了一些谷歌硬盘上的文件测试,效果灰常灰常理想,下面是我安装的记录日记;

网友们放弃国内不靠谱的坑爹网盘吧,用国外的网盘爽得多,不会动不动就卡得跟狗一样限速,不会动不动就和谐文件、也不会动不动就不玩了跑路,重点是速度速度速度快;

一、下载解压Rclone

curl -O http://downloads.rclone.org/rclone-current-linux-amd64.zip

yum install unzip -y

unzip rclone-current-linux-amd64.zip

cd rclone-v1.35-linux-amd64

二、复制二进制文件

cp rclone /usr/sbin/

chown root:root /usr/sbin/rclone

chmod 755 /usr/sbin/rclone

三、安装 manpage

mkdir -p /usr/local/share/man/man1

cp rclone.1 /usr/local/share/man/man1/

mandb

四、新建rclone config文件

rclone config

返回信息:

2017/03/02 14:25:41 Config file "/root/.rclone.conf" not found - using defaults

No remotes found - make a new one

n) New remote

s) Set configuration password

q) Quit config

选择N创建一个新的配置

name> googledrive

给配置取一个名字,这个随意,我选择了googledrive

Type of storage to configure.

Choose a number from below, or type in your own value

1 / Amazon Drive

\ "amazon cloud drive"

2 / Amazon S3 (also Dreamhost, Ceph, Minio)

\ "s3"

3 / Backblaze B2

\ "b2"

4 / Dropbox

\ "dropbox"

5 / Encrypt/Decrypt a remote

\ "crypt"

6 / Google Cloud Storage (this is not Google Drive)

\ "google cloud storage"

7 / Google Drive

\ "drive"

8 / Hubic

\ "hubic"

9 / Local Disk

\ "local"

10 / Microsoft OneDrive

\ "onedrive"

11 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)

\ "swift"

12 / Yandex Disk

\ "yandex"

Rclone支持很多国外主流网盘,我选择谷歌硬盘所以回复7

以下两条返回信息直接回车不用填写信息

Google Application Client Id - leave blank normally.

client_id>

Google Application Client Secret - leave blank normally.

client_secret>

下面提示代码回复n

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

把下面的网址授权链接复制粘贴到浏览器进行认证

If your browser doesn't open automatically go to the following

link: https://accounts.google.com/o/oauth2/auth?client_id=202266665644.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&state=88888c7be7969e4f5dd4cf1619265571

Log in and authorize rclone for access

Enter verification code>

认证成功后会得到一串数字将它粘贴到Enter verification code>后面回车确认

Enter verification code>

4/oCKeWj4v6tnl9jfdkfjdsk3q8emfxRuZ5HEn49pJ740KJk

下面的返回信息继续问你是否确认刚才得到的信息选择y

[googledrive]

client_id =

client_secret =

token = {"access_token":"ya29.GlsCBKS2rJqd_YuroyWklklklklklklSPPISs58WMJCm54DauJ_QeZudvKTTUOZ4fS09mt5wqcAggfdgdfmAqojdaTTJv-ukAoC_q0lgdfgfdtSv4yn_yEtaEtG","token_type":"Bearer","refresh_token":"1/5Tv8KqnjWb_oTtO7QDm2umcRQgfgfdgdfgfKMJIOC7dkU","expiry":"2017-03-02T15:42:10.847395882+08:00"}

--------------------

y) Yes this is OK

e) Edit this remote

d) Delete this remote

y/e/d> y

下面返回信息回复q退出配置

Current remotes:

Name Type

==== ====

googledrive drive

e) Edit existing remote

n) New remote

d) Delete remote

s) Set configuration password

q) Quit config

e/n/d/s/q> q