hw-1

# aria2 install

aria2 install

osx

1
sudo port install aria2

ubuntu

1
sudo apt install aria2

Aria2 basic download

Same as it is with wget aria2 also offers one argument command line download. Lets try download such us:

1
$ aria2c ftp://local1/linux-distro.iso

If disconnected, you may resume download with the same command. Aria2 keeps a log file of the download progress and will reopen it when download resume is required.

Download from more sources

To speed up your download you can supply aria2 with more than one source of the same file:

1
$ aria2c ftp://local1/linux-distro.iso http://local2/linux-distro.iso

In this case aria2 will recognize that the file to be downloaded is same and will split the file into two parts as well as split the download to fetch from two sources and thus utilizing your download bandwidth to the maximum. In case you have provided two different files aria2 will download them both.

Torrent download

Downloading data using torrents is simple as downloading data via http or ftp. If you alredy have a torrent file which you want to use to fetch your data, simply suppy it to aria2 as a command line argument:

1
$ aria2c linux-dist.torrent

With aria2 you do not even have to bother to download torrent file itself, instead simply supply torrent URL:

1
$ aria2c http://local/linux-dist.torrent

In this case aria2 will download the torrent file to your download directory and then start downloading data. If you do not wish aria2 to download a torrent file simplyt use –follow-torrent=mem option :

1
$ aria2c --follow-torrent=mem http://local/linux-dist.torrent

In this case the actual torrent file will be stored into a memory only, and discarded when download is finished.

Metalink is a file which contains all possible sources for data to be downloaded. Which means that instead supplying aria2 with a multiple sources we need to supply just a single metalink URL or metalink file. For example, you can download Ubuntu TLS Linux ISO using metalink:

1
aria2c http://releases.ubuntu.com/releases/10.04/ubuntu-10.04-desktop-i386.metalink

Download via torrent magnet

As you may have already guessed the syntax to download via torrent magnets is the same as it was in previous examples. All what needs to be done is to supply aria2 with a magnet link:

1
aria2c magnet:?xt=urn:btih:1e99d95f1764644a86a8e99bfd80c ...

Configuring aria2

If you find yourself using same aria2 options all over again, to save your time you may create a configuration file and list all aria2 options you wish to supply on the command line. To do that open or create aria2 configuration file ~/.aria2/aria2.conf andadd:

1
2
3
enable-xml-rpc
follow-torrent=mem
seed-ratio=2

Control Daemon with aria2rpc

1
2
3
4
5
6
$ cat /usr/share/doc/aria2/xmlrpc/aria2rpc.gz | gzip -d > aria2rpc
$ chmod +x aria2rpc
$ aria2rpc addUri [URI] [options]
[task-id]
$ aria2rpc remove [task-id]
$ aria2rpc --help

rpc command example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
aria2rpc  --secret password getGlobalStat

aria2rpc --secret password tellActive
aria2rpc --secret password tellStopped 0 10

aria2rpc --secret password addUri [URI] [options]

aria2rpc --secret password addTorrent /path/to/torrent_file URI... [options]

aria2rpc --secret password remove [task-id]

aria2rpc --secret password addUri https://example.com/1.torrent

aria2rpc --secret password forceRemove 454dd0ab6e000ee8

aria2rpc --secret password tellStatus 9729697c4027bc4e