宝塔面板利用rclone挂载onedrive,sharepoint到自己的vps服务器上

昨天说了如何利用rclone挂载世纪互联到自己的本地电脑上,今天说下如何挂载onedrive,sharepoint到linux服务器上。目前rclone的最新版本1.54.0已经正式支持世纪互联和sharepoint。教程基于宝塔安装(宝塔服务器面板,一键全能部署及管理,送你3188元礼包,点我领取https://www.bt.cn/?invite_code=MV9ub2NxdmI=

目前的最新版下载等,请参考前文:windows10:Rclone官方版1.54.0挂载世纪互联(含sharepoint)到本地磁盘

1、部署

1)CentOS系统安装rclone就很简单了,使用官方的安装命令即可,debian等也是一样。

curl https://rclone.org/install.sh | sudo bash

2)CentOS挂载Onedrive

因为接下来操作方法和windows完全一样,唯一的区别是“Use auto config?”这里选择n,并输入之前获取的token

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   #这里选择n
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 "onedrive"

Then paste the result below:
result>  #这里输入之前保存的token

3)如果你忘了自己的token,在windows的cmd中使用如下命令查找路径,找到了rclone.conf文件,打开编辑即可看到token。

rclone config file

4)挂载世纪互联,使用如下命令。

#安装fuse
yum -y install fuse
#创建挂载目录
mkdir -p /home/onedrive
#挂载
rclone mount onedrive:/ /home/onedrive --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000 --vfs-cache-mode writes

注意,mount后面的onedrive,是你在之前设置的名称,后面的/home/onedrive 是挂载的目录,这个也可以挂载到别的目录。

2、挂载SharePoint

上面挂载好了od,我们在顺手把SharePoint,也挂载好。

1)rclone config

配置的话,还是和之前的一样,具体看步骤吧。

[root@hostf68b156fb8 ~]# 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  #新建
name> sharepoint  #起一个名字
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 Providers including AWS, Alibaba, Ceph, Digital Ocean, Dreamhost, IBM COS, Minio, and Tencent COS
   \ "s3"
 5 / Backblaze B2
   \ "b2"
 6 / Box
   \ "box"
 7 / Cache a remote
   \ "cache"
 8 / Citrix Sharefile
   \ "sharefile"
 9 / Compress a remote
   \ "compress"
10 / Dropbox
   \ "dropbox"
11 / Encrypt/Decrypt a remote
   \ "crypt"
12 / Enterprise File Fabric
   \ "filefabric"
13 / FTP Connection
   \ "ftp"
14 / Google Cloud Storage (this is not Google Drive)
   \ "google cloud storage"
15 / Google Drive
   \ "drive"
16 / Google Photos
   \ "google photos"
17 / Hadoop distributed file system
   \ "hdfs"
18 / Hubic
   \ "hubic"
19 / In memory object storage system.
   \ "memory"
20 / Jottacloud
   \ "jottacloud"
21 / Koofr
   \ "koofr"
22 / Local Disk
   \ "local"
23 / Mail.ru Cloud
   \ "mailru"
24 / Mega
   \ "mega"
25 / Microsoft Azure Blob Storage
   \ "azureblob"
26 / Microsoft OneDrive
   \ "onedrive"
27 / OpenDrive
   \ "opendrive"
28 / OpenStack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
   \ "swift"
29 / Pcloud
   \ "pcloud"
30 / Put.io
   \ "putio"
31 / QingCloud Object Storage
   \ "qingstor"
32 / SSH/SFTP Connection
   \ "sftp"
33 / Sugarsync
   \ "sugarsync"
34 / Tardigrade Decentralized Cloud Storage
   \ "tardigrade"
35 / Transparently chunk/split large files
   \ "chunker"
36 / Union merges the contents of several upstream fs
   \ "union"
37 / Webdav
   \ "webdav"
38 / Yandex Disk
   \ "yandex"
39 / Zoho
   \ "zoho"
40 / http Connection
   \ "http"
41 / premiumize.me
   \ "premiumizeme"
42 / seafile
   \ "seafile"
Storage> 26 #选择26
** See help for onedrive backend at: https://rclone.org/onedrive/ **

OAuth Client Id
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_id> #填自己的
OAuth Client Secret
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_secret> #填自己的
Choose national cloud region for OneDrive.
Enter a string value. Press Enter for the default ("global").
Choose a number from below, or type in your own value
 1 / Microsoft Cloud Global
   \ "global"
 2 / Microsoft Cloud for US Government
   \ "us"
 3 / Microsoft Cloud Germany
   \ "de"
 4 / Azure and Office 365 operated by 21Vianet in China
   \ "cn"
region> 4 #选择4
Edit advanced config? (y/n)
y) Yes
n) No (default)
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 (default)
n) No
y/n> n  #之前配置过了,所以这里选择n
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 "onedrive" -- "a_Mp"

Then paste the result below:
result> {#复制自己的token}
Choose a number from below, or type in an existing value
 1 / OneDrive Personal or Business
   \ "onedrive"
 2 / Root Sharepoint site
   \ "sharepoint"
 3 / Sharepoint site name or URL (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"
 7 / Sharepoint server-relative path (advanced, e.g. /teams/hr)
   \ "path"
Your choice> 2  #这里为了演示就选择了2,根据需要自行选择
Found 2 drives, please select the one you want to use:
0: 表单库tst (documentLibrary) id=b!x
1: 文档 (documentLibrary) id=b
Chose drive to use:> 0  
Found drive 'root' of type 'documentLibrary', URL: 
Is that okay?
y) Yes (default)
n) No
y/n> y  #选择y
--------------------
[sharepoint]
type = onedrive
region = cn
token = 
drive_type = documentLibrary
--------------------
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y #选择y
Current remotes:

Name                 Type
====                 ====
onedrive             onedrive
sharepoint           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退出

2)挂载SharePoint

挂载和之前的命令一样,如下:

#创建挂载目录 
mkdir -p /www/onedrive
#挂载
rclone mount sharepoint:/ /www/sharepoint --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000 --vfs-cache-mode writes

额,这样就挂载好了。

3、守护运行

还没结束,宝塔面板的话我们可以安装一个Supervisor管理器 ,具体部署如下:

1)安装Supervisor管理器,这个软件商店自行搜索安装

2)设置Supervisor管理器,守护之前挂载好的OneDrive。

此处为隐藏的内容 发表评论并刷新,方可查看
发表评论

4)运行成功截图

5)效果

我擦,SharePoint挂哪里去了,怎么这么大?

4、卸载

如果要卸载,可以使用rclone config命令来完成。

[root@hostf68b156fb8 ~]# rclone config
Current remotes:

Name                 Type
====                 ====
onedrive             onedrive
sharepoint           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> d
Choose a number from below, or type in an existing value
 1 > onedrive
 2 > sharepoint
remote> 2
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> q

别忘了,Supervisor管理器 中删除你的守护进程。

5、最后

以上教程都基于rclone最新版本1.54.0安装搭建,喜欢折腾的童鞋可以试试,如果你用来备份,可以试试这个教程:宝塔面板修改OneDrive插件 – 支持备份网站数据至世纪互联

广告栏+++++++蜜糖商店|大哥云| 搬瓦工JMS|红莓网络| Mielink|萌喵加速| 飞鸟云

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注