rclone安装

命令行安装

脚本安装

curl https://rclone.org/install.sh | sudo bash
# 或者
curl https://rclone.org/install.sh | sudo bash -s beta # 测试版

源文件安装

从预编译二进制文件安装:curl命令可换为wget、axel,当然也可以直接(浏览器)手动下载

# 1. 获取源文件并解压缩,然后切换到解压目录
curl -O https://downloads.rclone.org/rclone-current-linux-amd64.zip
unzip rclone-current-linux-amd64.zip
cd rclone-*-linux-amd64 # 2. 复制二进制文件并修改用户(组)权限
sudo cp rclone /usr/bin/
sudo chown root:root /usr/bin/rclone
sudo chmod 755 /usr/bin/rclone

deb包安装

下载对应deb包:https://rclone.org/downloads/

dpkg命令

sudo dpkg -i xxx.deb
sudo apt-get install -f

gdeb命令

sudo apt install gdebi-core   # 安装第三方工具
sudo gdebi xxx.deb

rclone配置

获取客户端ID和密钥

在默认情况下执行请求时,rclone使用所有rclone用户共享的一对客户端ID和密钥。

可以按照以下步骤获取自己的客户ID和密钥

  1. 打开https://apps.dev.microsoft.com/#/appList ,然后单击添加应用(Add an app) 。
  2. 输入应用的名称,然后点击“继续”。 应记下应用程序 ID(Application Id)以便配置中使用
  3. 在“应用程序机密(Application Secrets)”下,单击“ 生成新密码(Generate New Password)“ ,系统会随即机生成一段密码。注意:此密码只出现一次,应立即复制并保存该密码以便配置中使用。
  4. 在”平台(Platforms)“下,单击“添加平台(Add platform)” ,然后单击Web 。 在”重定向URL(Redirect URLs)“输入http://localhost:53682/
  5. 在”Microsoft Graph 权限(Microsoft Graph Permissions)“下 ,添加委派的权限(delegated permissions):Files.ReadFiles.ReadWriteFiles.Read.AllFiles.ReadWrite.Alloffline_accessUser.Read
  6. 滚动到底部,然后单击“ 保存(Save)“ 。

下图是完成后的截图示例:

配置向导

配置示例:

客户端id: 399f84a2-32f5-47fa-a866-d415078a91d9

密钥:heq****************************

bl@bl:~$ rclone config
Current remotes: Name Type
==== ====
onedrive onedrive 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 # 新建选择 n (我已经配置过了1个,所以多了几个选项)
name> myod # 自定义配置名称
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 / A stackable unification remote, which can appear to merge the contents of several remotes
\ "union"
2 / Alias for a 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 / Dropbox
\ "dropbox"
9 / Encrypt/Decrypt a remote
\ "crypt"
10 / FTP Connection
\ "ftp"
11 / Google Cloud Storage (this is not Google Drive)
\ "google cloud storage"
12 / Google Drive
\ "drive"
13 / Hubic
\ "hubic"
14 / JottaCloud
\ "jottacloud"
15 / Koofr
\ "koofr"
16 / Local Disk
\ "local"
17 / Mega
\ "mega"
18 / Microsoft Azure Blob Storage
\ "azureblob"
19 / Microsoft OneDrive
\ "onedrive"
20 / OpenDrive
\ "opendrive"
21 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
\ "swift"
22 / Pcloud
\ "pcloud"
23 / QingCloud Object Storage
\ "qingstor"
24 / SSH/SFTP Connection
\ "sftp"
25 / Webdav
\ "webdav"
26 / Yandex Disk
\ "yandex"
27 / http Connection
\ "http"
Storage> 19 # 输入OneDrive对应的编号
** 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> 399f84a2-32f5-47fa-a866-d415078a91d9 # 应用/客户端id
Microsoft App Client Secret
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_secret> heq************************ # 密码/密钥
Edit advanced config? (y/n)
y) Yes
n) No
y/n> n # n,不进行高级配置
Remote config
Make sure your Redirect URL is set to "http://localhost:53682/" in your custom 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> y # y, 同意自动配置,(浏览器会自动重定向本地请求授权,成功返回“Success! All done. Please go back to rclone.”)
If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth
Log in and authorize rclone for access
Waiting for code...
Got code
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 # 1,Onedrive个人或者商业版
Found 1 drives, please select the one you want to use:
0: (personal) id=7bbf0a5dc86d77be
Chose drive to use:> 0 # 0
Found drive 'root' of type 'personal', URL: https://onedrive.live.com/?cid=7bbf0a5dc86d77be
Is that okay?
y) Yes
n) No
y/n> y # y, 确认版本
--------------------
[myod]
type = onedrive
client_id = 399f84a2-32f5-47fa-a866-d415078a91d9
client_secret = heq****************************
token = {"access_token":"token,通过~/.config/rclone/rclone.conf文件也可以查看","expiry":"2019-04-27T03:12:32.874487926+08:00"}
drive_id = 7bbf0a5dc86d77be
drive_type = personal
--------------------
y) Yes this is OK
e) Edit this remote
d) Delete this remote
y/e/d> y # y, 确认配置
Current remotes: Name Type
==== ====
myod onedrive
onedrive onedrive 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 # q, 退出

测试连接

bl@bl:~$ rclone lsd onedrive:
-1 2017-06-12 19:00:15 1 Office Online 扩展
-1 2019-04-26 23:51:59 5 oucbl
-1 2019-04-26 01:02:53 2 图片
-1 2019-02-26 04:03:36 9 文档
-1 2017-01-11 22:17:39 0 电子邮件附件

$ rclone lsd onedrive: # 查看当前网盘的目录。(有时候网络不稳定,需要多试几次)

onedrive是rclone配置名,需要修改为自己的配置名称

挂载Onedrive

普通用户权限也可以挂载成功,只是使用过程中可能出现一些问题,具体没深入研究;这里就直接使用管理权限。

有教程推荐使用 screen 在后台运行挂载命令,较稳定一点;这里就不说明了。

挂载远程目录到本地

示例:远程网盘目录oucbl挂载到本地/home/bl/One-Drive下:

bl@bl:~$ sudo rclone mount onedrive:/oucbl /home/bl/One-Drive --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000

相关参数解释如下:

  • --copy-links - 显示软链接内容
  • --no-gzip-encoding - 不使用 gzip-encoding
  • --no-check-certificate - 不验证ssl证书
  • --allow-other - 允许其它用户访问
  • --allow-non-empty - 允许挂载目录非空
  • --umask 000 - 覆写文件掩码为 000

更多参数选项请参考官方文档:https://rclone.org/commands/rclone_mount/

停止挂载

一般情况下使用Ctrl+C便可停止挂载,如果停止失败,使用如下命令停止挂载(本地/home/bl/One-Drive):

bl@bl:~$ sudo fusermount -qzu /home/bl/One-Drive  #停止挂载

备注

1T Onedrive教育申请:https://products.office.com/en-us/student?tab=students


鉴于网络问题,暂不打算常用,这里不做开机自启配置了,具体可在参考里面2个博客中查看。


另一个免费OneDrive客户端:onedrive

github: https://github.com/skilion/onedrive

教程示例:https://www.maketecheasier.com/sync-onedrive-linux/

参考

rclone-rsunc for cloud storage--Configure

https://rclone.org/docs/

rclone-rsunc for cloud storage--Microsoft OneDrive

https://rclone.org/onedrive/

Ubuntu 18.04 手动安装 rclone 并自动挂载 Google Drive

https://timelate.com/archives/install-rclone-on-ubuntu.html#cl-11

Linux下rclone简单教程(支持VPS数据同步,多种网盘,支持挂载)

https://ymgblog.com/2018/03/09/296/

Ubuntu安装配置rclone(Onedrive应用)的更多相关文章

  1. Ubuntu安装配置protobuf 2.5

    Ubuntu安装配置protobuf 2.5 一.安装配置环境 Linux 1.安装protobuf 下载文件 https://github.com/protocolbuffers/protobuf/ ...

  2. [转载]Ubuntu安装配置 git 服务器和客户端

    原文地址:Ubuntu安装配置 git 服务器和客户端作者:ding404 1.配置前准备 服务器:安装ssh server另外还装了gitosis做git的权限管理 sudo apt-get ins ...

  3. ubuntu 安装配置 JDK7和Android Studio(apt-get方式)

    Ubuntu 安装配置JKD 7 $ sudo add-apt-repository ppa:webupd8team/java $ sudo apt-get update $ sudo apt-get ...

  4. Ubuntu 安装配置MySQL,并使用VS的Server Explorer UI界面远程管理MySQL

    为安装配置方便,使用root账号登入Ubuntu. step1: 键入下面命令安装MySQL. 过程十分简单.安装过程中只需根据提示输入root账号的密码即可. step2:安装完成后检查MySQL是 ...

  5. 英文版Ubuntu安装配置搜狗拼音输入法

    下载搜狗输入法 1 进入搜狗输入法官网,进入上面导航兰的 "输入法Linux版"   2 根据你安装的ubuntu是32位还是64位下载 END ubuntu安装搜狗输入法 1 进 ...

  6. UBuntu安装配置记录

    记得是06年左右第一次安装的 Linux,当时是下载的 Fedora镜像,版本已经记不清了,在商业街的电脑维修店刻的盘,回来后兴冲冲地和XP一起安装的双系统.其实就是直接的体验了一把,只是看了看X-W ...

  7. Ubuntu安装配置Qt 4.86环境

    安装 QT4.8.6库+QT Creator 2.4.1 下载地址公布 QT4.8.6库  http://mirrors.hustunique.com/qt/official_releases/qt/ ...

  8. Ubuntu安装配置Tensorflow-GPU

    Ubuntu 16.04 + GTX 1080 Ti + CUDA 9.0 + Cudnn 7.1 安装配置 1. 安装显卡驱动 首先查看一下自己的电脑需要怎样的驱动,我们可以先到 http://ww ...

  9. ubuntu安装配置jdk tomcat mysql ...

    安装之前大家一定要检查好各个版本问题 以免造成不兼容. (一)下载所需安装包: jdk-7u76-linux-x64.tar.gz apache-tomcat-7.0.63.tar.gz MySQL- ...

随机推荐

  1. 计算时间:一个C++运算符重载示例

    Time类是一个用于计算时间的类,其原型如下:程序清单11.1 mytime0.h // mytime0.h -- Time class before operator overloading #if ...

  2. eclipse导入maven项目时报Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources

    在用Eclipse IDE for Java EE Developers进行maven项目的开发时,报错Could not calculate build plan: Plugin org.apach ...

  3. c#图片生成png格式和原图不同

    下面这种,会生成和原图类似的图片,png格式的图片该是空的地方仍旧是空的

  4. MQTT的学习研究(三)moquette-mqtt 的使用之mqtt服务发布主题信息

    接着上一篇的moquette-mqtt 的使用之broker启动之后,我们需要启动moquette-mqtt 的服务端发布消息. 在moquette-mqtt 的mqtt-client中三种方式实现发 ...

  5. 【linux系列】vi模式下查找和替换

    一.查找 1.查找命令 /pattern<Enter> :向下查找pattern匹配字符串 ?pattern<Enter> :向上查找匹配字符串 在使用了查找命令之后,使用如下 ...

  6. Android 测量调用方法耗时的方法

    private long mDrawnRealTime; 起点:mDrawnRealTime = SystemClock.elapsedRealtime(); 终点: long delay = Sys ...

  7. ExtJS学习

    ExtJS是一门比较纠结的框架,自己不太熟,因为现在在做一些老项目,所以没办法要学点.记录下.其实Ext也不是很难,主要是多查查API,了解其基本的用法,然后慢慢去学习,学成之后做管理系统还是很有优势 ...

  8. kubernetes实战(四):k8s持久化安装rabbitmq集群

    1.下载文件 https://github.com/dotbalo/k8s/ 2.创建namespace kubectl create namespace public-service 如果不使用pu ...

  9. 【Python】读取各种文档(txt、csv、excel、pdf)方法

    1.读取txt文件 注意事项: 1..txt文件同下方脚本所在的.py文件需要在同一个文件夹下 # coding=utf-8 txt读取 with open("1233.txt") ...

  10. SELINUX导致数据修改权限不成功

    SELINUX导致数据修改权限不成功基本概念参考:https://blog.csdn.net/yanjun821126/article/details/80828908 查看SELinux状态: ./ ...