如何将Aria2 + Rclone + OneDrive打造自己专属的离线网盘?
一,准备工作
想要完美搭好这套设备你需要以下条件:
聪明的大脑
使用搜索引擎的能力
更好的语文功底
眼睛不瞎
自我解决问题的能力
提问问题前经过大脑思考
非常冗长的时间(顺利的话1小时左右能建成完成)
一台服务器(推荐配置:1CPU + 4G内存+ 20G以上的硬盘+ 1Gbps带宽+无限流量),服务器主机可以在这个网站捡漏 便宜VPS
一台本地计算机(win10系统最好,本教程是基于win10编写的)
本地ssh软件,例如Xshell
会百度一些简单的linux命令的使用方法
必要时需要有个本地连接外网的工具?
二,安装宝塔面板(非必要)
(1)根据自己服务器主机型号复制对应的安装命令,官网教程;本人机子是CentOs7系统,所以输入
yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh
(2)安装完成后,根据提示信息打开宝塔面板,
(3)然后单击首页,在展开的框上方,选择只安装Nginx
(4)点击安全放行6800端口
三,安装Aria2
(1)这里使用Aria2一键安装管理脚本增强版(打不开用这个备用地址)执行下面的代码下载并运行脚本,出现脚本操作菜单输入1开始安装。
wget -N https://raw.githubusercontent.com/P3TERX/aria2.sh/master/aria2.sh && chmod +x aria2.sh && ./aria2.sh
备用的脚本:
wget -N https://raw.githubusercontent.com/ifwlzs/aria2.sh/master/aria2.sh && chmod +x aria2.sh && ./aria2.sh
(2)安装成功后,再次输入上述安装代码,这次输入数字12,自动更新BT-Tracker。
(3)执行成功后,再次输入上述安装代码,这次输入数字8,记录下和后续操作需要用到。ipv4地址RPC密钥
四,安装克隆
(1)服务器端安装:输入下面的命令进行安装
curl https://rclone.org/install.sh | sudo bash
(2)本地(win10)安装rclone,下载链接:https://rclone.org/downloads/
(3)在本地Windows电脑上下载后,然后解压出来,解压后进入文件夹,在资源管理器地址栏输入cmd,回车就会在当前路径打开命令变量。输入以下命令:
rclone authorize “onedrive”
接下来的会议发布浏览器,要求您登录帐户进行授权。
If your browser doesn’t open automatically go to the following link: http://127.0.0.1:53682/authLog in and authorize rclone for accessWaiting for code…Got codePaste the following into your remote machine —>{“access_token”:”xxxxxxxx”} # 注意!复制{xxxxxxxx}整个内容,并保存好,后面需要用到<—End paste
(4)linux上配置Rclone
提示:因为RCLONE会时不时进行更新,当您看到这篇教程时菜单选项可能已经发生了略微的位移,但大致思路不会变,不要无脑照搬操作。
服务器里输入
rclone config
会出现以下信息,参照下面的注释进行操作。
n) New remotes) Set configuration passwordq) Quit confign/s/q> n # 选择n,新建name> OneDrive # 输入名称,类似于标签,用于区分不同的网盘。Type of storage to configure.Enter a string value. Press Enter for the default (“”).Choose a number from below, or type in your own value1 / 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 / In memory object storage system.\ “memory” 17 / Jottacloud\ “jottacloud” 18 / Koofr\ “koofr” 19 / Local Disk\ “local” 20 / Mail.ru Cloud\ “mailru” 21 / Mega\ “mega” 22 / Microsoft Azure Blob Storage\ “azureblob” 23 / Microsoft OneDrive\ “onedrive” 24 / OpenDrive\ “opendrive” 25 / OpenStack Swift (Rackspace Cloud Files, Memset Memstore, OVH)\ “swift” 26 / Pcloud\ “pcloud” 27 / Put.io\ “putio” 28 / QingCloud Object Storage\ “qingstor”29 / SSH/SFTP Connection\ “sftp”30 / Sugarsync\ “sugarsync”31 / Tardigrade Decentralized Cloud Storage\ “tardigrade”32 / Transparently chunk/split large files\ “chunker”33 / Union merges the contents of several upstream fs\ “union”34 / Webdav\ “webdav”35 / Yandex Disk\ “yandex”36 / http Connection\ “http”37 / premiumize.me\ “premiumizeme”38 / seafile\ “seafile”Storage> 23 # 选择23,Microsoft OneDrive** See help for onedrive backend at: https://rclone.org/onedrive/ **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) No (default)y/n> n # 选nRemote configUse auto config?* Say Y if not sure* Say N if you are working on a remote or headless machiney) Yes (default)n) Noy/n> n # 选nFor this to work, you will need rclone available on a machine that hasa 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 rcloneversion recommended): rclone authorize “onedrive”Then paste the result below:result> {“XXXXXXXX”} # 上面保存的token复制到这里Choose a number from below, or type in an existing value1 / 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 # 这里问你要选择的类型,选1Found 1 drives, please select the one you want to use:0: OneDrive (business) id=xxxxxxxxxChose drive to use:> 0 # 程序找到网盘,这里编号是0,就选择0Found drive ‘root’ of type ‘business’, URL: https://sbfc6-xxxxxxx.sharepoint.com/personal/xxxxxxxxxx/DocumentsIs that okay?y) Yes (default)n) Noy/n> y # 选y——————–[OneDrive]type = onedrivetoken = {“xxxxxxxxx”}drive_id = xxxxxdrive_type = business——————–y) Yes this is OK (default)e) Edit this remoted) Delete this remotey/e/d> y # 选yCurrent remotes:Name Type==== ====OneDrive onedrivee) Edit existing remoten) New remoted) Delete remoter) Rename remotec) Copy remotes) Set configuration passwordq) Quit confige/n/d/r/c/s/q> q # 选q,退出
至此,Rclone已成功连接到了OneDrive网盘。
五,配置服务器端Aria2文件
(1)nano的基础知识:
搜索某段文字:Ctrl + w然后输入搜索的文字
保存并退出:Ctrl + x之后输入y然后回车
(2)服务器上输入
nano /root/.aria2c/script.conf
:附加功能脚本配置文件进行修改,有中文注释,按照自己的实际情况进行修改,一般只需要修改网盘名称。
修改效果如下:
# 网盘名称(RCLONE 配置时填写的 name)drive-name=OneDrive
(3)再次输入如下代码:
nano /root/.aria2c/aria2.conf
:Aria2配置文件进行修改。找到“下载完成后执行的命令”,把替换为。clean.shupload.sh# 下载完成后执行的命令on-download-complete=/root/.aria2c/upload.sh
(4)重启Aria2
service aria2 restart
六,本地安装Aria2前端面板AriaNg
网上的教程太多了,这里我们用最实用的方案,你只是在win上准备以下条件:
本地机子能上网
有一个基于Chromium内核的浏览器(例如Chrome,新版edge)
能上外网(或者你可以找附带下载插件网站也行,这里推荐个网址CrxDown)
(针对不能打开谷歌商店的朋友)百度离线安装crx插件的能力
(1)安装* *Aria2forchrome谷歌商店链接:https://chrome.google.com/webstore/detail/aria2-for-chrome/mpkodccbngfoacfalldjimigbofkhgjn
插件特征ID:mpkodccbngfoacfalldjimigbofkhgjn
七,配置AriaNg,开启离线时代
(1)打开插件,点击AriaNg设置,选择添加新的配置
(2)然后注意!!根据之前生成Aria2的配置,填好下插图框住部分
(3)点击重新加载后点激活
(4)测试是否链接成功失败会显示
成功后会显示如下
至此,我们的离线下载系统算是彻底建造完成了,可以自己试试效果〜