本文使用的是腾讯云的轻量应用服务器

系统

CentOS 7.6

ARIA2

直接使用github大佬的aria2增强脚本,提速超级明显

上面的代码大概率无法下载,因为服务器被墙了,连不上Github

可以使用下面的代码 codeblock:true

wget -N --no-check-certificate https://raw.githubusercontent.com/P3TERX/aria2.sh/master/aria2.sh && chmod +x aria2.sh && bash aria2.sh

或者配置hosts文件 codeblock:false

方法如下

进入该网址查询git.ioip地址

多个地点ping [git.io]服务器-网站测速-站长工具 (chinaz.com)

查询到可用的ip地址后复制进入服务器控制台

cd到根目录,使用vim命令

i进入编辑,格式如下

140.82.114.22 git.io
140.82.112.4 github.com
185.199.108.133 raw.githubusercontent.com

编辑完成后按Esc并键入:wq保存退出

再次尝试

wget -N http://git.io/aria2.sh && chmod +x aria2.sh

完成之后会看到如下代码

Aria2 一键安装管理脚本 增强版 [v2.7.4] by P3TERX.COM

0. 升级脚本
———————————————————————
1. 安装 Aria2
2. 更新 Aria2
3. 卸载 Aria2
———————————————————————
4. 启动 Aria2
5. 停止 Aria2
6. 重启 Aria2
———————————————————————
7. 修改 配置
8. 查看 配置
9. 查看 日志
10. 清空 日志
———————————————————————
11. 手动更新 BT-Tracker
12. 自动更新 BT-Tracker
———————————————————————

1安装Aria2
安装完成后输入./aria2.sh再次进入该界面输入8查看配置如下

Aria2 简单配置信息:

IPv4 地址 : #############
IPv6 地址 : #############
RPC 端口 : ####
RPC 密钥 : ##############
下载目录 : ##########
AriaNg 链接 : http://ariang.js.org/#!/settings/rpc/set/###########

记住RPC端口,在服务器防火墙中将改端口设为允许,复制RPC密钥

复制AriaNg链接并在浏览器中打开,进入侧边栏AriaNg设置,上边全局旁边有个PRC:你的ip:6800,点进去,将你复制的RPC密钥粘贴到Aria RPC 密钥中,重载Aria2完成

以后想要运行脚本只需输入以下代码:

上传

安装Rclone

上传我们使用Rclone

服务器控制台执行

时间有一点长,等就完了,趁服务器安装的时间,我们获取OneDriveToken

获取Token

自己Windows电脑上下载RcloneRclone官网:https://rclone.org/downloads/

下载完之后解压到你熟悉的文件夹,然后打开CMD,用cd命令进入刚刚解压的文件夹

执行以下命令,注意不要关掉CMD窗口

rclone authorize “onedrive”

会自动弹出浏览器让你登录OneDrive,登录授权,回到CMD窗口,会出现如下内容

NOTICE: If your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth?state=viTI1hvSD4t3spt6rsmmpQ
NOTICE: Log in and authorize rclone for access
NOTICE: Waiting for code...
NOTICE: Got code
Paste the following into your remote machine --->
{"access_token":"#############################"}
<---End paste

注意:复制{access_token:###########}整段内容,保存好,后面要用

配置Rclone

服务器控制台输入rclone config命令

[root@VM-16-14-centos lighthouse]# rclone config
2022/08/07 19:36:33 NOTICE: Config file "/root/.config/rclone/rclone.conf" not found - using defaults
No remotes found, make a new one?
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n #选n新建
nter name for new remote.
name> onedrive #取个名字,随意ok
Option Storage.
Type of storage to configure.
Choose a number from below, or type in your own value.
1 / 1Fichier
\ (fichier)
2 / Akamai NetStorage
\ (netstorage)
3 / Alias for an existing remote
\ (alias)
4 / Amazon Drive
\ (amazon cloud drive)
5 / Amazon S3 Compliant Storage Providers including AWS, Alibaba, Ceph, China Mobile, Cloudflare, ArvanCloud, Digital Ocean, Dreamhost, Huawei OBS, IBM COS, IDrive e2, Lyve Cloud, Minio, Netease, RackCorp, Scaleway, SeaweedFS, StackPath, Storj, Tencent COS and Wasabi
\ (s3)
6 / Backblaze B2
\ (b2)
7 / Better checksums for other remotes
\ (hasher)
8 / Box
\ (box)
9 / Cache a remote
\ (cache)
10 / Citrix Sharefile
\ (sharefile)
11 / Combine several remotes into one
\ (combine)
12 / Compress a remote
\ (compress)
13 / Dropbox
\ (dropbox)
14 / Encrypt/Decrypt a remote
\ (crypt)
15 / Enterprise File Fabric
\ (filefabric)
16 / FTP
\ (ftp)
17 / Google Cloud Storage (this is not Google Drive)
\ (google cloud storage)
18 / Google Drive
\ (drive)
19 / Google Photos
\ (google photos)
20 / HTTP
\ (http)
21 / Hadoop distributed file system
\ (hdfs)
22 / HiDrive
\ (hidrive)
23 / Hubic
\ (hubic)
24 / In memory object storage system.
\ (memory)
25 / Internet Archive
\ (internetarchive)
26 / Jottacloud
\ (jottacloud)
27 / Koofr, Digi Storage and other Koofr-compatible storage providers
\ (koofr)
28 / Local Disk
\ (local)
29 / Mail.ru Cloud
\ (mailru)
30 / Mega
\ (mega)
31 / Microsoft Azure Blob Storage
\ (azureblob)
32 / Microsoft OneDrive
\ (onedrive)
33 / OpenDrive
\ (opendrive)
34 / OpenStack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
\ (swift)
35 / Pcloud
\ (pcloud)
36 / Put.io
\ (putio)
37 / QingCloud Object Storage
\ (qingstor)
38 / SSH/SFTP
\ (sftp)
39 / Sia Decentralized Cloud
\ (sia)
40 / Storj Decentralized Cloud Storage
\ (storj)
41 / Sugarsync
\ (sugarsync)
42 / Transparently chunk/split large files
\ (chunker)
43 / Union merges the contents of several upstream fs
\ (union)
44 / Uptobox
\ (uptobox)
45 / WebDAV
\ (webdav)
46 / Yandex Disk
\ (yandex)
47 / Zoho
\ (zoho)
48 / premiumize.me
\ (premiumizeme)
49 / seafile
\ (seafile)
Storage> 32 #选择Microsoft OneDrive(不同版本的Rclone这里的数字可能稍有不同,注意看清)
Option client_id.
OAuth Client Id.
Leave blank normally.
Enter a value. Press Enter to leave empty.
client_id> #留空,直接回车
Option client_secret.
OAuth Client Secret.
Leave blank normally.
Enter a value. Press Enter to leave empty.
client_secret> #同样留空回车
Option region.
Choose national cloud region for OneDrive.
Choose a number from below, or type in your own string value.
Press Enter for the default (global).
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> 1 #这里是选择OneDrive的版本,我的是E5的网盘,选择Global

个人账户与世纪互联区分方法

  • 微软登录入口
    微软个人账户和全球账户可以在 https://www.office.com
    而世纪互联账户则不可以在这个登录入口登录。

  • 世纪互联登录入口
    而世纪互联账户则只能在 世纪互联登录入口 这里登录。
    微软个人账户和全球账户则登录不了这个入口。

Edit advanced config?
y) Yes
n) No (default)
y/n> n #留空回车
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
Option config_token.
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.
Enter a value.
config_token> {"access_token":"##########"} #粘贴之前保存的信息
Option config_type.
Type of connection
Choose a number from below, or type in an existing string value.
Press Enter for the default (onedrive).
1 / OneDrive Personal or Business
\ (onedrive)
2 / Root Sharepoint site
\ (sharepoint)
/ Sharepoint site name or URL
3 | 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)
/ Sharepoint server-relative path (advanced)
7 | E.g. /teams/hr
\ (path)
config_type> 1 #E5账号属于商业版,根据自己情况选择
Option config_driveid.
Select drive you want to use
Choose a number from below, or type in your own string value.
Press Enter for the default (8888888888888888888888888888888888888888888888888).
1 / OneDrive (business)
\ (8888888888888888888888888888888888888888888888888)
config_driveid> 1 #这里是Rclone找到的网盘信息,这里出现什么选什么
Found drive "root" of type "business"
URL: https://888888 #这里是你自己的URL

y) Yes (default)
n) No
y/n> y #选y
Configuration complete.
Options:
- type: onedrive
- token: {"access_token":"#############"}
- drive_id: #########
- drive_type: business
Keep this "onedrive" remote?
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 #出现这个就完成了

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退出

现在Rclone已经连接上OneDrive

配置上传脚本

打开/root/.aria2c/script.conf配置文件进行修改,有中文注释,自行修改,一般只需要修改下面2个部分

# 网盘名称(RCLONE 配置时填写的 name)
drive-name=onedrive

# 网盘目录(上传目标目录,网盘中的文件夹路径)。注释或留空为网盘根目录,末尾不要有斜杠。
#drive-dir=/DRIVEX/Download

打开/root/.aria2c/aria2.conf配置文件进行修改。或使用Aria2 一键安装管理脚本中的手动修改选项打开配置文件进行修改。找到“下载完成后执行的命令”,把clean.sh替换为upload.sh

# 下载完成后执行的命令
# 此项未定义则执行 下载停止后执行的命令 (on-download-stop)
on-download-complete=/root/.aria2c/upload.sh

在配置aria2c时,注意有一个BT/PT下载设置,在腾讯云控制台防火墙中添加BT/PT监听端口的规则(不下BT/PT的可以忽略)

## BT/PT 下载设置 ##

# BT 监听端口(TCP), 默认:6881-6999 //就是这个
# 直通外网的设备,比如 VPS ,务必配置防火墙和安全组策略允许此端口入站
# 内网环境的设备,比如 NAS ,除了防火墙设置,还需在路由器设置外网端口转发到此端口

搞完重启使用Aria2脚本重启Aria2

至此完成!现在可以好好享受离线下载啦!

搜索
空空如也