PS :https://github.com/aria2/aria2 (开源地址)
什么是Aria2
aria2是一个自由、开源、轻量级多协议和多源的命令行下载工具。它支持 HTTP/HTTPS、FTP、SFTP、 BitTorrent 和 Metalink 协议。aria2 可以通过内建的 JSON-RPC 和 XML-RPC 接口来操纵。aria2 下载文件的时候,自动验证数据块。它可以通过多个来源或者多个协议下载一个文件,并且会尝试利用你的最大下载带宽。默认情况下,所有的 Linux 发行版都包括 aria2,所以我们可以从官方库中很容易的安装。一些 GUI 下载管理器例如 uget 使用 aria2 作为插件来提高下载速度。
Aria2 特性
支持 HTTP/HTTPS GET
支持 HTTP 代理
支持 HTTP BASIC 认证
支持 HTTP 代理认证
支持 FTP (主动、被动模式)
通过 HTTP 代理的 FTP(GET 命令行或者隧道)
分段下载
支持 Cookie
可以作为守护进程运行。
支持使用 fast 扩展的 BitTorrent 协议
支持在多文件 torrent 中选择文件
支持 Metalink 3.0 版本(HTTP/FTP/BitTorrent)
限制下载、上传速度
Linux 下安装 aria2
[对于 Debian、 Ubuntu 和 Mint]
$ sudo apt-get install aria2
[对于 CentOS、 RHEL、 Fedora 21 和更早些的操作系统]
# yum install aria2
[Fedora 22 和 之后的系统]
# dnf install aria2
[对于 suse 和 openSUSE]
# zypper install wget
[Mageia]
# urpmi aria2
[对于 Arch Linux]
$ sudo pacman -S aria2
Aria2 的使用
下载单个文件
1、直链下载
下载直链文件,只需在命令后附加地址,如:
aria2c http://xx.com/xx
如果需要重命名为yy的话加上--out或者-o参数,如:
aria2c --out=yy http://xx.com/xx
aria2c -o yy http://xx.com/xx
使用aria2的分段和多线程下载功能可以加快文件的下载速度,对于下载大文件时特别有用。-x 分段下载,-s 多线程下载,如:
aria2c -s 2 -x 2 http://xx.com/xx
这将使用2个连接和2个线程来下载该文件。
BT下载
种子和磁力下载:
aria2c ‘xxx.torrnet‘
aria2c '磁力链接'
列出种子内容:
aria2c -S xxx.torrent
下载种子内编号为1、4、5、6、7的文件,如:
aria2c --select-file=1,4-7 xxx.torrent
设置bt端口:
aria2c --listen-port=3653 ‘xxx.torrent’
限速下载
单个文件最大下载速度:
aria2c --max-download-limit=300K -s10 -x10 'http://xx.com/xx'
整体下载最大速度:
aria2c --max-overall-download-limit=300k -s10 -x10 'http://xx.com/xx'
下载多个文件
下面的命令将会从指定位置下载超过一个的文件并保存到当前目录,在下载文件的过程中,我们可以看到文件的(日期、时间、下载速度和下载进度)
aria2c -Z http://file.drivergenius.com/DGSetup_Home_KZ.exe https://github.com/aria2/aria2/releases/download/release-1.35.0/aria2-1.35.0-aarch64-linux-android-build1.zip
中间用空格隔开
续传未完成的下载
-c 就完事
aria2c -c http://file.drivergenius.com/DGSetup_Home_KZ.exe
从文件获取输入
就像 wget 可以从一个文件获取输入的 URL 列表来下载一样。我们需要创建一个文件,将每一个 URL 存储在单独的行中。ara2 命令行可以添加 -i 选项来执行此操作。
aria2c -i test-aria2.txt
win10使用aria2
下载win10的,和以上linux操作一致,不过有GUI版的
使用方法:
方法一:单文件下载
aria2c.exe -c -s 5 -d F:\安装软件 URL
-c:开启断点续传
-s 5:设置5线程
-d F:\安装软件:设置下载后存储到F:\安装软件
URL:要下载文件的地址,http://xxx.com/xxx.zip 这种。
方法二:多文件同时下载
aria2c.exe -c -s 5 -d F:\安装软件 -j 2 -i url.txt
-j 2:设置同时下载2个任务
-i url.txt:从url.txt读取下载任务。
针对url.txt,只需要把要下载的文件地址以每行一条的方式写进去即可。
下载完全配置aira2 一键脚本
wget -N git.io/aria2.sh && chmod +x aria2.sh && ./aria2.sh
然后到这个网址
http://ariang.mayswind.net/latest/
配置一下

就可以下载了
一键配置脚本
wget -N git.io/aria2.sh && chmod +x aria2.sh && ./aria2.sh
然后到这个网址
http://ariang.mayswind.net/latest/#!/downloading
github:https://github.com/anlen123/aria2.sh
进行配置
下载bt的话,,需要在配置文件后面加服务器连接
我写了一个爬虫来搞它
import os
import time
def openBT(path):
f = open(path)
txt = list(filter(None, f.read().split("\n")))
# print(len(txt))
with open("bt_temp.txt",'a+')as f:
for x in txt:
f.write(x+",")
f.close()
if __name__ == '__main__':
url = "https://github.com/ngosang/trackerslist.git"
if not os.path.exists("trackerslist"):
os.system("git clone https://github.com/ngosang/trackerslist.git")
time.sleep(1)
# os.system("dir")
os.chdir("trackerslist")
# os.system("dir")
txt_list = os.listdir()
for file in txt_list:
if file.endswith(".txt") and file.startswith("trackers"):
# print(file)
openBT(str(file))
f = open("bt_temp.txt")
a =list(filter(None,list(set(f.read().split(",")))))
f.close()
os.chdir("..")
if os.path.exists("bt.txt"):
os.system("del bt.txt")
with open("bt.txt", 'a+')as f:
f.write("bt-tracker=")
with open("bt.txt",'a+')as f:
for x in a:
f.write(x+",")
if os.path.exists("trackerslist"):
os.system("rd /s/q trackerslist")
docker 版本的使用
docker pull p3terx/aria2-pro //拉取镜像
docker run -d -it -p 6800:6800 -v ~/aria2-config:/config -v ~/aria2-downloads:/downloads -e RPC_SECRET=123456 -e RPC_PORT=6800 -e LISTEN_PORT=6888 --name aria2-pro docker.io/p3terx/aria2-pro //运行
教程在这:
https://p3terx.com/archives/docker-aria2-pro.html