易语言网盘服务器源码_使用使用rclone挂载OneDrive到服务器
綜述
此文又臭又長,如果不是實在閑的蛋疼/剛需建議還是跳過吧
老王混跡網絡這么多年,因為各種各樣的原因使用過不少服務器(VPS),從國內到國外從早期的服務器合租網到現在的阿里云,當然國外的櫻花、Vultr、狗爹也用過不少。
但是都有各種各樣的不同缺點(主要是錢沒到位),國內的限制帶寬不限制流量,國外的限制流量不限制帶寬(其實也限制,只是不嚴格),除此之外,硬盤空間也是個大問題,早期的VPS還好,偶爾有運營商給出便宜點(5-10$/月)的1T或者500G的HDD,大家基本上都是一哄而上搶光,現在的VPS一言難盡啊,基本上都是20-50G的空間了。
那么怎么解決這個問題,運營商開始賣其他的,比如阿里云的OSS,NSA;騰訊、百度也有類似的產品。
但是我們如果因為一些開飛機等需求購買的國外VPS又沒有單獨的磁盤可購買,怎么辦呢?掛載阿里的OSS去交磁盤和流量費?
老王這種牛(qiong)人才不想呢,于是百度谷歌搜了一通,發現一個好東西,rclone!可以掛載N多的網盤作為本地磁盤使用,現在已經支持了
“
1 / 1Fichier
2 / Alias for an existing remote
3 / Amazon Drive
4 / Amazon S3 Compliant Storage Provider
5 / Backblaze B2
6 / Box
7 / Cache a remote
8 / Citrix Sharefile
9 / Dropbox
10 / Encrypt/Decrypt a remote
11 / FTP Connection
12 / Google Cloud Storage (this is not Google Drive)
13 / Google Drive
14 / Google Photos
15 / Hubic
16 / JottaCloud
17 / Koofr
18 / Local Disk
19 / Mail.ru Cloud
20 / Mega
21 / Microsoft Azure Blob Storage
22 / Microsoft OneDrive
23 / OpenDrive
24 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
25 / Pcloud
26 / Put.io
27 / QingCloud Object Storage
28 / SSH/SFTP Connection
29 / Transparently chunk/split large files
30 / Union merges the contents of several remotes
31 / Webdav
32 / Yandex Disk
33 / http Connection
34 / premiumize.me
”
軟件優缺點
優點
1、 支持眾多網絡磁盤
2、 操作簡單
3、 支持多個平臺Windows、Linux(x86、x64、arm)等等
4、 多種安裝方式:源碼包、安裝包等
缺點
1、 操作稍微復雜,如果是遠程Linux你還需要一臺Windows
2、 Linux系統的虛擬機需要支持fuse才行,也就是說絕大部分openvz不能用了。
判斷系統是否支持
如果你購買vps時候已經明確購買的是KVM架構的,那么這一段你可以跳過去了,因為你肯定是支持的。
我們登錄系統,輸入“ls /dev/fuse”,如果返回的是下圖,顯示已經找到,那么是可以使用的。
如果系統返回的是下圖,那么你需要跟廠商的客戶工單溝通下了。
當然溝通的結果可能是我這樣的,字里行間透漏出幾個大字“窮逼買了openvz不行,你得買KVM架構的去”
當然了,如果你的客服給你開通了fuse的內核,那么太棒了,繼續搞下。
安裝rclone軟件
我們以centos7和onedrive為例講,其他Linux類似
既然我們這里講的是掛載onedrive(我真不是可著微軟的羊毛使勁擼,只是微軟的擼起來順手……),那么首先我們需要注冊一個onedrive,怎么注冊一個5T的onedrive呢?看我前面的文章。
安裝軟件,登錄你的服務器,在命令行一次輸入下面的內容,輸入完后敲回車運行(#開頭的文字不要輸入)
yum -y update#更新系統yum -y install vim fuse#安裝本次需要的軟件wget https://downloads.rclone.org/rclone-current-linux-amd64.rpm#下載rclone安裝包,其他Linux網頁打開找對應的包rpm -ivh rclone-current-linux-amd64.rpm#安裝rclone到系統到這里,我們已經安裝好軟件了。配置rclone軟件
繼續在命令行輸入
rclone config系統會提示現在沒有遠程連接,問你是新建n/設置配置密碼s/退出q;輸入n新建一個遠程,然后輸入一個連接名字(隨意),在接下來會讓你選擇網絡硬盤,這里每個版本不一樣,記得輸入Microsoft OneDrive前面對應的序號就行。
rclone configNo remotes found - make a new onen) New remotes) Set configuration passwordq) Quit confign/s/q> nname> laowangType 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 / JottaCloud "jottacloud"17 / Koofr "koofr"18 / Local Disk "local"19 / Mail.ru Cloud "mailru"20 / Mega "mega"21 / Microsoft Azure Blob Storage "azureblob"22 / Microsoft OneDrive "onedrive"23 / OpenDrive "opendrive"24 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH) "swift"25 / Pcloud "pcloud"26 / Put.io "putio"27 / QingCloud Object Storage "qingstor"28 / SSH/SFTP Connection "sftp"29 / Transparently chunk/split large files "chunker"30 / Union merges the contents of several remotes "union"31 / Webdav "webdav"32 / Yandex Disk "yandex"33 / http Connection "http"34 / premiumize.me "premiumizeme"Storage> 22接下來會提示輸入client_id和client_secret,我們都不需要輸入,直接回車跳過,在Edit advanced config? (y/n)選擇y進行進階設置。后面的設置磁盤塊大小(drive_id)也可以直接跳過,drive_id也直接跳過,drive_type這里可以根據你的onedrive類型選擇輸入personal | business | documentLibrary,當然也可以跳過,下一步跳過OneNote文件(expose_onenote_files),直接回車跳過。
Microsoft App Client IdLeave blank normally.Enter a string value. Press Enter for the default ("").client_id> Microsoft App Client SecretLeave blank normally.Enter a string value. Press Enter for the default ("").client_secret> Edit advanced config? (y/n)y) Yesn) Noy/n> y/n> yChunk size to upload files with - must be multiple of 320k (327,680 bytes).Above this size files will be chunked - must be multiple of 320k (327,680 bytes). Notethat the chunks will be buffered into memory.Enter a size with suffix k,M,G,T. Press Enter for the default ("10M").chunk_size> The ID of the drive to useEnter a string value. Press Enter for the default ("").drive_id> The type of the drive ( personal | business | documentLibrary )Enter a string value. Press Enter for the default ("").drive_type> Set to make OneNote files show up in directory listings.By default rclone will hide OneNote files in directory listings becauseoperations like "Open" and "Update" won't work on them. But thisbehaviour may also prevent you from deleting them. If you want todelete OneNote files or otherwise want them to show up in directorylisting, set this option.Enter a boolean value (true or false). Press Enter for the default ("false").expose_onenote_files> y/n> nFor 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" "x1b[A" "qtyfaBBYA403=unZUP40~_#"Then paste the result below:result>然后我們需要輸入授權,這里我們因為是 遠程shell沒法使用瀏覽器,這里選擇n,我們從Windows操作
Remote configMake 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 machiney) Yesn) Noy/n> nFor 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" "x1b[A" "qtyfaBBYA403=unZUP40~_#"Then paste the result below:result>好像到這里一直是跳過啊,沒關系,下面開始需要你在Windows上操作了。
Windows獲取授權
在windows上下載https://downloads.rclone.org/rclone-current-windows-amd64.zip,然后解壓到任意目錄中,然后打開解壓后的目錄,在目錄空白處按住shift點右鍵,選擇在此次打開cmd命令行。
然后在命令行中輸入
rclone.exe config然后按照前面的配置全部重新輸入一遍 ,一直到前面將的最后一步操作,不要輸入n,輸入y,因為我們有瀏覽器啦(自豪),
系統會自動打開我們的默認瀏覽器,打開onedrive登錄頁面,輸入賬號和密碼。
然后同意授權許可
然后網頁會提示你回rclone去看結果,已經返回授權access了。
我們返回剛剛的命令行繼續操作,首先輸入1,確認我們剛剛授權的是OneDrive,接下來的一步會提示選擇一個用戶,直接輸入0啊,繼續提示問你這個配置是否正確,輸入y繼續。
Log in and authorize rclone for accessWaiting for code...Got codeChoose 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> 1Found 1 drives, please select the one you want to use:0: OneDrive (business) id=b!******************Chose drive to use:> 0Found drive 'root' of type 'business', URL: https://***-my.sharepoint.com/personal/*****_*****_onmicrosoft_com/DocumentsIs that okay?y) Yesn) Noy/n> y然后會出現一大堆內容,這里分為幾個部分,首先是告訴你這個是onedrive,然后是token,這個是最重要的,繼續是id和版本,我們需要復制token =后面一直到drive_id(不包含drive_id)前面的所有內容。
--------------------[laowang]type = onedrivetoken = {"access_token":"*********總結
以上是生活随笔為你收集整理的易语言网盘服务器源码_使用使用rclone挂载OneDrive到服务器的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 以某一用户名和密码 登录请求脚本_lin
- 下一篇: python怎么修改while循环类型_