易语言网盘服务器源码_使用使用rclone挂载OneDrive到服务器
綜述
此文又臭又長(zhǎng),如果不是實(shí)在閑的蛋疼/剛需建議還是跳過(guò)吧
老王混跡網(wǎng)絡(luò)這么多年,因?yàn)楦鞣N各樣的原因使用過(guò)不少服務(wù)器(VPS),從國(guó)內(nèi)到國(guó)外從早期的服務(wù)器合租網(wǎng)到現(xiàn)在的阿里云,當(dāng)然國(guó)外的櫻花、Vultr、狗爹也用過(guò)不少。
但是都有各種各樣的不同缺點(diǎn)(主要是錢(qián)沒(méi)到位),國(guó)內(nèi)的限制帶寬不限制流量,國(guó)外的限制流量不限制帶寬(其實(shí)也限制,只是不嚴(yán)格),除此之外,硬盤(pán)空間也是個(gè)大問(wèn)題,早期的VPS還好,偶爾有運(yùn)營(yíng)商給出便宜點(diǎn)(5-10$/月)的1T或者500G的HDD,大家基本上都是一哄而上搶光,現(xiàn)在的VPS一言難盡啊,基本上都是20-50G的空間了。
那么怎么解決這個(gè)問(wèn)題,運(yùn)營(yíng)商開(kāi)始賣(mài)其他的,比如阿里云的OSS,NSA;騰訊、百度也有類似的產(chǎn)品。
但是我們?nèi)绻驗(yàn)橐恍╅_(kāi)飛機(jī)等需求購(gòu)買(mǎi)的國(guó)外VPS又沒(méi)有單獨(dú)的磁盤(pán)可購(gòu)買(mǎi),怎么辦呢?掛載阿里的OSS去交磁盤(pán)和流量費(fèi)?
老王這種牛(qiong)人才不想呢,于是百度谷歌搜了一通,發(fā)現(xiàn)一個(gè)好東西,rclone!可以掛載N多的網(wǎng)盤(pán)作為本地磁盤(pán)使用,現(xiàn)在已經(jīng)支持了
“
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
”
軟件優(yōu)缺點(diǎn)
優(yōu)點(diǎn)
1、 支持眾多網(wǎng)絡(luò)磁盤(pán)
2、 操作簡(jiǎn)單
3、 支持多個(gè)平臺(tái)Windows、Linux(x86、x64、arm)等等
4、 多種安裝方式:源碼包、安裝包等
缺點(diǎn)
1、 操作稍微復(fù)雜,如果是遠(yuǎn)程Linux你還需要一臺(tái)Windows
2、 Linux系統(tǒng)的虛擬機(jī)需要支持fuse才行,也就是說(shuō)絕大部分openvz不能用了。
判斷系統(tǒng)是否支持
如果你購(gòu)買(mǎi)vps時(shí)候已經(jīng)明確購(gòu)買(mǎi)的是KVM架構(gòu)的,那么這一段你可以跳過(guò)去了,因?yàn)槟憧隙ㄊ侵С值摹?/p>
我們登錄系統(tǒng),輸入“l(fā)s /dev/fuse”,如果返回的是下圖,顯示已經(jīng)找到,那么是可以使用的。
如果系統(tǒng)返回的是下圖,那么你需要跟廠商的客戶工單溝通下了。
當(dāng)然溝通的結(jié)果可能是我這樣的,字里行間透漏出幾個(gè)大字“窮逼買(mǎi)了openvz不行,你得買(mǎi)KVM架構(gòu)的去”
當(dāng)然了,如果你的客服給你開(kāi)通了fuse的內(nèi)核,那么太棒了,繼續(xù)搞下。
安裝rclone軟件
我們以centos7和onedrive為例講,其他Linux類似
既然我們這里講的是掛載onedrive(我真不是可著微軟的羊毛使勁擼,只是微軟的擼起來(lái)順手……),那么首先我們需要注冊(cè)一個(gè)onedrive,怎么注冊(cè)一個(gè)5T的onedrive呢?看我前面的文章。
安裝軟件,登錄你的服務(wù)器,在命令行一次輸入下面的內(nèi)容,輸入完后敲回車(chē)運(yùn)行(#開(kāi)頭的文字不要輸入)
yum -y update#更新系統(tǒng)yum -y install vim fuse#安裝本次需要的軟件wget https://downloads.rclone.org/rclone-current-linux-amd64.rpm#下載rclone安裝包,其他Linux網(wǎng)頁(yè)打開(kāi)找對(duì)應(yīng)的包rpm -ivh rclone-current-linux-amd64.rpm#安裝rclone到系統(tǒng)到這里,我們已經(jīng)安裝好軟件了。配置rclone軟件
繼續(xù)在命令行輸入
rclone config系統(tǒng)會(huì)提示現(xiàn)在沒(méi)有遠(yuǎn)程連接,問(wèn)你是新建n/設(shè)置配置密碼s/退出q;輸入n新建一個(gè)遠(yuǎn)程,然后輸入一個(gè)連接名字(隨意),在接下來(lái)會(huì)讓你選擇網(wǎng)絡(luò)硬盤(pán),這里每個(gè)版本不一樣,記得輸入Microsoft OneDrive前面對(duì)應(yīng)的序號(hào)就行。
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接下來(lái)會(huì)提示輸入client_id和client_secret,我們都不需要輸入,直接回車(chē)跳過(guò),在Edit advanced config? (y/n)選擇y進(jìn)行進(jìn)階設(shè)置。后面的設(shè)置磁盤(pán)塊大小(drive_id)也可以直接跳過(guò),drive_id也直接跳過(guò),drive_type這里可以根據(jù)你的onedrive類型選擇輸入personal | business | documentLibrary,當(dāng)然也可以跳過(guò),下一步跳過(guò)OneNote文件(expose_onenote_files),直接回車(chē)跳過(guò)。
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>然后我們需要輸入授權(quán),這里我們因?yàn)槭?遠(yuǎn)程shell沒(méi)法使用瀏覽器,這里選擇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>好像到這里一直是跳過(guò)啊,沒(méi)關(guān)系,下面開(kāi)始需要你在Windows上操作了。
Windows獲取授權(quán)
在windows上下載https://downloads.rclone.org/rclone-current-windows-amd64.zip,然后解壓到任意目錄中,然后打開(kāi)解壓后的目錄,在目錄空白處按住shift點(diǎn)右鍵,選擇在此次打開(kāi)cmd命令行。
然后在命令行中輸入
rclone.exe config然后按照前面的配置全部重新輸入一遍 ,一直到前面將的最后一步操作,不要輸入n,輸入y,因?yàn)槲覀冇袨g覽器啦(自豪),
系統(tǒng)會(huì)自動(dòng)打開(kāi)我們的默認(rèn)瀏覽器,打開(kāi)onedrive登錄頁(yè)面,輸入賬號(hào)和密碼。
然后同意授權(quán)許可
然后網(wǎng)頁(yè)會(huì)提示你回rclone去看結(jié)果,已經(jīng)返回授權(quán)access了。
我們返回剛剛的命令行繼續(xù)操作,首先輸入1,確認(rèn)我們剛剛授權(quán)的是OneDrive,接下來(lái)的一步會(huì)提示選擇一個(gè)用戶,直接輸入0啊,繼續(xù)提示問(wèn)你這個(gè)配置是否正確,輸入y繼續(xù)。
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然后會(huì)出現(xiàn)一大堆內(nèi)容,這里分為幾個(gè)部分,首先是告訴你這個(gè)是onedrive,然后是token,這個(gè)是最重要的,繼續(xù)是id和版本,我們需要復(fù)制token =后面一直到drive_id(不包含drive_id)前面的所有內(nèi)容。
--------------------[laowang]type = onedrivetoken = {"access_token":"*********總結(jié)
以上是生活随笔為你收集整理的易语言网盘服务器源码_使用使用rclone挂载OneDrive到服务器的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 以某一用户名和密码 登录请求脚本_lin
- 下一篇: python怎么修改while循环类型_