Aria2 - 适用于 Linux 的多协议命令行下载工具
Aria2 是一款开源、免费的轻量级多协议和多服务器命令行下载实用程序,适用于 Windows、Linux 和 Mac OSX。
它能够从多个协议和来源下载文件,包括 HTTP/HTTPS、FTP、BitTorrent 和 Metalink。它通过利用最大下载带宽来提高下载速度,并加快您的下载体验。
特征
- 多连接下载 – 它可以从多个来源/协议下载文件,并尝试使用最大下载带宽并改善整体下载体验。
- 轻量级 – 它不需要太多的内存和CPU利用率。 HTTP/FTP 下载仅使用 4MB 内存,BitTorrent 下载则使用 9MB。
- 功能齐全的 BitTorrent 客户端 – 功能齐全的 BitTorrent 客户端,支持 DHT、PEX、加密、Magnet URI、Web-Seeding、选择性下载、本地对等发现和 UDP 跟踪器。
- Metalink启用 – 它支持Metalink版本4和3,提供HTTP/FTP/SFTP/BitTorrent集成的文件验证以及位置、语言、操作系统等的不同配置。
- 远程控制 – RPC接口支持控制aria2进程。支持的接口是 JSON-RPC(通过 HTTP 和 WebSocket)和 XML-RPC。
请注意,我们不应将 aria2 视为 wget、curl 或 torrent 客户端的替代品,而应将其视为具有更多支持和下载选项的替代方案。
在 Linx 中安装 Aria2 命令行下载管理器
本文介绍如何在 RHEL、 中安装 Aria2 命令行下载实用程序CentOS、Fedora 和 Debian、Ubuntu、Linux Mint > 具有一些有用的下载技术和用法的系统。
在 RHEL/CentOS/Fedora 上
首先,您需要在RHEL/CentOS系统下下载并启用EPEL存储库。 (注意: Fedora 用户不需要添加任何存储库,只需使用 dnf 命令安装 aria2,如图所示)。
dnf install aria2
现在,使用 YUM 命令工具从系统下启用的 EPEL 存储库安装 Aria2 软件包。
yum install epel-release -y
yum install aria2 -y
示例输出:
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: centos.mirrors.estointernet.in
* elrepo: mirror-hk.koddos.net
* epel: repos.del.extreme-ix.org
* extras: centos.mirrors.estointernet.in
* updates: centos.mirrors.estointernet.in
Resolving Dependencies
--> Running transaction check
---> Package aria2.x86_64 0:1.18.10-2.el7.1 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==========================================================================================================================
Package Arch Version Repository Size
==========================================================================================================================
Installing:
aria2 x86_64 1.18.10-2.el7.1 epel 1.3 M
Transaction Summary
==========================================================================================================================
Install 1 Package
Total download size: 1.3 M
Installed size: 4.1 M
Downloading packages:
aria2-1.18.10-2.el7.1.x86_64.rpm | 1.3 MB 00:00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : aria2-1.18.10-2.el7.1.x86_64 1/1
Verifying : aria2-1.18.10-2.el7.1.x86_64 1/1
Installed:
aria2.x86_64 0:1.18.10-2.el7.1
Complete!
在 Debian/Ubuntu/Linux Mint 上
sudo apt-get install aria2
样本输出
ravisaive@ravisaive-OptiPlex-380:~$ sudo apt-get install aria2
[sudo] password for ravisaive:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
ksysguardd libruby1.9.1 ruby1.9.1
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
libc-ares2
The following NEW packages will be installed:
aria2 libc-ares2
0 upgraded, 2 newly installed, 0 to remove and 234 not upgraded.
10 not fully installed or removed.
Need to get 1,651 kB of archives.
After this operation, 4,536 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://in.archive.ubuntu.com/ubuntu/ saucy/main libc-ares2 i386 1.10.0-2 [38.3 kB]
Get:2 http://in.archive.ubuntu.com/ubuntu/ saucy/universe aria2 i386 1.17.0-1 [1,613 kB]
Fetched 1,651 kB in 7s (235 kB/s)
注意:有时,默认存储库不提供最新版本。因此,在这种情况下,您可能需要从源代码包编译并安装它,如下所示。
Aria2 下载用法和示例
在这里,我们将通过示例探索一些有用的 aria2 下载用法和选项。
从网页下载
要从网络下载单个文件,请执行以下命令:
aria2c http://releases.ubuntu.com/disco/ubuntu-19.04-desktop-amd64.iso
从两个来源下载
要下载多个文件,例如两个文件,然后运行以下命令。
aria2c http://releases.ubuntu.com/disco/ubuntu-19.04-desktop-amd64.iso http://releases.ubuntu.com/cosmic/ubuntu-18.10-desktop-amd64.iso
使用两个连接下载
要在每个主机上仅使用两个连接下载文件,请使用选项 -x2(连接 2),如下所示。
aria2c -x2 http://releases.ubuntu.com/disco/ubuntu-19.04-desktop-amd64.iso
从 BitTorrent 下载
要下载 torrent 文件,请使用以下命令。
aria2c http://releases.ubuntu.com/disco/ubuntu-19.04-desktop-amd64.iso.torrent
从Metalink下载
要下载 metalink 文件,请使用以下命令。
aria2c http://example.org/mylinux.metalink
在文本文件中找到的下载 URL
要下载写入名为 downloadurls.txt 的文本文件中的 URL 列表,请使用以下命令。 URL 应在 downloadurls.txt 文件中每行包含一次下载。
aria2c -i downloadurls.txt
设置下载速度限制
要设置每次下载的下载速度限制,请使用以下选项。
aria2c –max-download-limit=100K http://releases.ubuntu.com/disco/ubuntu-19.04-desktop-amd64.iso.torrent
要了解更多用法和选项,请打开终端并运行命令“man aria2c”。还有适用于 Aria2 的图形前端,您可以在 aria2 页面找到它们。