莫言 发表于 2021-4-12 21:43:13

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

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

配置的话,还是和之前的一样,具体看步骤吧。
# 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
--------------------

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。



**** Hidden Message *****

4.运行成功截图



5.效果




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

# 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管理器 中删除你的守护进程。






董燕 发表于 2021-4-12 21:43:14

感恩无私的分享与奉献 :)       

但愿人人幸福 发表于 2021-4-12 22:53:44

淡定,淡定,淡定……

万事随缘 发表于 2021-4-12 22:55:06

楼主加油,我们都看好你哦。

黎婷 发表于 2021-4-12 23:22:06

真是被感动的痛哭流涕……

朝霞老师 发表于 2021-4-12 23:32:45

无回帖,不论坛,这才是人道。

经济 发表于 2021-4-13 06:34:05

真是被感动的痛哭流涕……

方舟水手 发表于 2021-4-13 07:40:03

我只是路过打酱油的。

雨夜追风 发表于 2021-4-13 09:31:18

无回帖,不论坛,这才是人道。

骤雨初歇 发表于 2021-4-13 13:37:17

激动人心,无法言表!
页: [1] 2 3 4
查看完整版本: 宝塔面板利用rclone挂载onedrive,sharepoint到自己的vps服务器上