Aria2

aria2相关项目

aria2

aria2 官网
aria2 源码
aria2 package for OpenWrt
Aria2 Manual
aria2c manual

webui-aria2

webui-aria2 官网
webui-aria2 源码
webui-aria2 package for OpenWrt
webui-aria2 package for OpenWrt by nanpuyue

yaaw

binux/yaaw
yaaw 官网
yaaw package for OpenWrt
yaaw package for OpenWrt by nanpuyue

luci-app-aria2

luci-app-aria2
luci-app-aria2 by 981213

OpenWrt集成aria2

主要参考
路由器OpenWrt如何脱机(离线)下载BT文件

编译aria2

执行menuconfig勾选所有和aria2相关的配置

1
2
3
4
5
6
7
8
9
10
11
huzhifeng@Ubuntu1404:~/git/openwrt_trunk$ make menuconfig
Network --->
File Transfer --->
<*> aria2....................................... lightweight download utility
Aria2 configuration --->
SSL library (OpenSSL) --->
(X) OpenSSL
( ) GNUTLS
( ) No SSL support
[*] Enable bittorrent support
[*] Enable metalink support



配置文件变化如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
huzhifeng@Ubuntu1404:~/git/openwrt_trunk$ git diff .config
diff --git a/.config b/.config
index 26c0f5f..d97e6d4 100644
--- a/.config
+++ b/.config
@@ -3203,7 +3203,7 @@ CONFIG_PACKAGE_libuuid=y
# CONFIG_PACKAGE_libwrap is not set
# CONFIG_PACKAGE_libxerces-c is not set
# CONFIG_PACKAGE_libxerces-c-samples is not set
-# CONFIG_PACKAGE_libxml2 is not set
+CONFIG_PACKAGE_libxml2=y
# CONFIG_PACKAGE_libxslt is not set
# CONFIG_PACKAGE_libzdb is not set
# CONFIG_PACKAGE_linux-atm is not set
@@ -3584,7 +3584,16 @@ CONFIG_POSTFIX_CDB=y
#
# File Transfer
#
-# CONFIG_PACKAGE_aria2 is not set
+CONFIG_PACKAGE_aria2=y
+
+#
+# Aria2 configuration
+#
+CONFIG_ARIA2_OPENSSL=y
+# CONFIG_ARIA2_GNUTLS is not set
+# CONFIG_ARIA2_NOSSL is not set
+CONFIG_ARIA2_BITTORRENT=y
+CONFIG_ARIA2_METALINK=y
CONFIG_PACKAGE_curl=y
# CONFIG_PACKAGE_lftp is not set
CONFIG_PACKAGE_rsync=y
huzhifeng@Ubuntu1404:~/git/openwrt_trunk$

挂载U盘到/mnt/sda1

插入U盘,然后通过网页进行挂载到/mnt/sda1

创建U盘软链接/root/aria2

步骤如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
root@OpenWrt:~# ls /mnt/
sda1
root@OpenWrt:~# df -h
Filesystem Size Used Available Use% Mounted on
rootfs 16.9M 1.7M 15.3M 10% /
/dev/root 12.8M 12.8M 0 100% /rom
tmpfs 125.0M 988.0K 124.1M 1% /tmp
tmpfs 125.0M 2.4M 122.6M 2% /tmp/root
tmpfs 512.0K 0 512.0K 0% /dev
/dev/mtdblock6 16.9M 1.7M 15.3M 10% /overlay
overlayfs:/overlay 16.9M 1.7M 15.3M 10% /
/dev/sda1 14.1G 3.7G 10.5G 26% /mnt/sda1
root@OpenWrt:~#
root@OpenWrt:~# ln -s /mnt/sda1 /root/aria2
root@OpenWrt:~# ls -l /root/aria2
lrwxrwxrwx 1 root root 15 Feb 24 03:19 /root/aria2 -> /mnt/sda1/aria2
root@OpenWrt:~#

安装aria2

升级新编译的固件,已经集成了aria2,版本是1.18.7

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
root@OpenWrt:~# aria2c -v
aria2 version 1.18.7
Copyright (C) 2006, 2014 Tatsuhiro Tsujikawa

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

** Configuration **
Enabled Features: BitTorrent, GZip, HTTPS, Message Digest, Metalink, XML-RPC
Hash Algorithms: sha-1, sha-224, sha-256, sha-384, sha-512, md5
Libraries: zlib/1.2.8 libxml2/2.9.2 OpenSSL/1.0.2d
Compiler: gcc 4.8.3
built by x86_64-pc-linux-gnu
targetting mips-openwrt-linux-gnu
on Feb 23 2016 18:03:29
System: Linux 3.18.8 #2 Tue Feb 23 18:06:17 CST 2016 mips

Report bugs to https://github.com/tatsuhiro-t/aria2/issues
Visit http://aria2.sourceforge.net/
root@OpenWrt:~#

新建aria2.session文件

创建aria2工作目录

1
root@OpenWrt:~# mkdir -p /root/aria2

然后在其下新建aria2.session文件

1
root@OpenWrt:~# touch /root/aria2/aria2.session

启动aria2

输入“aria2c –enable-rpc=true –rpc-listen-all=true –rpc-allow-origin-all -c”启动aria2

1
2
3
4
5
6
7
root@OpenWrt:~# aria2c --enable-rpc=true --rpc-listen-all=true --rpc-allow-origin-all -c

02/24 06:29:05 [WARN] Neither --rpc-secret nor a combination of --rpc-user and --rpc-passwd is set. This is insecure. It is extremely recommended to specify --rpc-secret with the adequate secrecy or now deprecated --rpc-user and --rpc-passwd.

02/24 06:29:05 [NOTICE] IPv4 RPC: listening on TCP port 6800

02/24 06:29:05 [NOTICE] IPv6 RPC: listening on TCP port 6800

配置aria2

为开机自动启动aria2需新建一个配置文件,首先按“ctrl+c”中止aria2,然后输入“vi /etc/aria2.conf”在/etc目录下新建名为aria2.conf的配置文件。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
root@OpenWrt:~# cat /etc/aria2.conf 
#Aria2 configuration
# RPC Setting
enable-rpc=true
rpc-listen-all=true
rpc-allow-origin-all=true
rpc-listen-port=6800
# General Setting
dir=/root/aria2
input-file=/root/aria2/aria2.session
save-session=/root/aria2/aria2.session
save-session-interval=60
log=/root/aria2/aria2.log
log-level=warn
#event-poll=select
disk-cache=8M
#enable-mmap=true
file-allocation=trunc
user-agent=uTorrent/2210(25130)
# Connection Setting
continue=true
max-connection-per-server=5
max-concurrent-downloads=3
min-split-size=5M
split=5
max-overall-download-limit=0
max-overall-upload-limit=0
max-upload-limit=0
lowest-speed-limit=0
auto-save-interval=300
# BT Setting
bt-require-crypto=true
bt-max-peers=100
enable-peer-exchange=true
follow-torrent=true
listen-port=6881-6999
root@OpenWrt:~#

关于aria2的配置选项,参考官网文档
aria2c语法
aria2c语法

1
aria2c [<OPTIONS>] [<URI>|<MAGNET>|<TORRENT_FILE>|<METALINK_FILE>] ...

基本选项

以下配置说明来自
Openwrt上配置Aria2迅雷离线下载步骤

启动aria2

现在可以使用命令“aria2c –conf-path=/etc/aria2.conf” 从配置文件启动aria2

1
2
3
4
5
6
7
8
9
10
11
12
13
root@OpenWrt:~# aria2c --conf-path=/etc/aria2.conf

02/24 06:36:51 [WARN] Neither --rpc-secret nor a combination of --rpc-user and --rpc-passwd is set. This is insecure. It is extremely recommended to specify --rpc-secret with the adequate secrecy or now deprecated --rpc-user and --rpc-passwd.

02/24 06:36:51 [NOTICE] IPv4 RPC: listening on TCP port 6800

02/24 06:36:51 [NOTICE] IPv6 RPC: listening on TCP port 6800

02/24 06:36:51 [NOTICE] IPv4 DHT: listening on UDP port 6883

02/24 06:36:51 [NOTICE] IPv4 BitTorrent: listening on TCP port 6948

02/24 06:36:51 [NOTICE] IPv6 BitTorrent: listening on TCP port 6948

后台运行aria2

如果想让aria2运行在后台,可以使用“-D”选项

1
2
3
4
5
root@OpenWrt:~# aria2c --conf-path=/etc/aria2.conf -D
root@OpenWrt:~# ps www | grep aria2
14675 root 7740 S aria2c --conf-path=/etc/aria2.conf -D
14735 root 1360 S grep aria2
root@OpenWrt:~#

集成yaaw

binux/yaaw
只需要把这个仓库下载到“/www”目录下即可,由于路由器不支持git和unzip命令,所以先下载到台式机

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
huzhifeng@Ubuntu1404:~$ mkdir -p aria2
huzhifeng@Ubuntu1404:~$ cd aria2/
huzhifeng@Ubuntu1404:~/aria2$ git clone https://github.com/binux/yaaw.git
Cloning into 'yaaw'...
remote: Counting objects: 775, done.
remote: Total 775 (delta 0), reused 0 (delta 0), pack-reused 775
Receiving objects: 100% (775/775), 276.35 KiB | 121 KiB/s, done.
Resolving deltas: 100% (497/497), done.
huzhifeng@Ubuntu1404:~/aria2$
huzhifeng@Ubuntu1404:~/aria2$ tree yaaw/
yaaw/
├── css
│ ├── bootstrap.min.css
│ ├── bootstrap-responsive.min.css
│ └── main.css
├── img
│ ├── favicon.ico
│ ├── glyphicons-halflings.png
│ └── glyphicons-halflings-white.png
├── index.html
├── js
│ ├── aria2.js
│ ├── bootstrap.min.js
│ ├── jquery-1.7.2.min.js
│ ├── jquery.base64.min.js
│ ├── jquery.jsonrpc.js
│ ├── jquery.Storage.js
│ ├── mustache.js
│ ├── peerid.js
│ └── yaaw.js
├── offline.appcache
├── README.md
└── TODO.md

3 directories, 19 files
huzhifeng@Ubuntu1404:~/aria2$
huzhifeng@Ubuntu1404:~/aria2$ tar -czf yaaw.tar.bz yaaw

再通过scp命令下载到路由器

1
2
3
4
root@OpenWrt:~# cd /www/
root@OpenWrt:/www# scp huzhifeng@192.168.2.245:~/aria2/yaaw.tar.bz ./
root@OpenWrt:/www# tar -xzf yaaw.tar.bz
root@OpenWrt:/www# rm -f yaaw.tar.bz

现在访问http://192.168.8.1/yaaw/ ,如下图

HTTP下载测试

找一个HTTP下载链接,例如
07. 卡萨布兰卡关燕仪
点击yaaw页面的“Add”图标,如下图:

下载中截图如下:

下载完会在浏览器右下角弹出提示,如下图:

FTP下载测试

[freeradius-server-3.0.11.tar.gz]
(ftp://ftp.freeradius.org/pub/freeradius/freeradius-server-3.0.11.tar.gz)

BT下载测试

海盗湾 找了一个BT种子
Adele-Hello.mp3
磁力链接地址是
(magnet:?xt=urn:btih:4be217e25f5b2e8a4eec3aefddfbc46c065091d4&dn=Adele-Hello.mp3&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969)
下载一直没有速度,如下图:

但是我直接使用BitTorrent下载是可以的,说明磁力链接和种子是有效的,如下图:

停止aria2进程

1
root@OpenWrt:/www# killall aria2c

直接使用aria2下载磁力链接还是失败

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
root@OpenWrt:/www# aria2c 'magnet:?xt=urn:btih:4be217e25f5b2e8a4eec3aefddfbc46c0
65091d4&dn=Adele-Hello.mp3&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp
%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&t
r=udp%3A%2F%2Fexodus.desync.com%3A6969'

02/24 07:34:50 [NOTICE] IPv4 DHT: listening on UDP port 6998

02/24 07:34:50 [NOTICE] IPv4 BitTorrent: listening on TCP port 6973

02/24 07:34:50 [NOTICE] IPv6 BitTorrent: listening on TCP port 6973
*** Download Progress Summary as of Wed Feb 24 07:35:50 2016 ***
=
[#241e9b 0B/0B CN:0 SD:0 DL:0B]
FILE: [MEMORY][METADATA]Adele-Hello.mp3
-

*** Download Progress Summary as of Wed Feb 24 07:36:51 2016 ***
=
[#241e9b 0B/0B CN:0 SD:0 DL:0B]
FILE: [MEMORY][METADATA]Adele-Hello.mp3
-

*** Download Progress Summary as of Wed Feb 24 07:37:51 2016 ***
=
[#241e9b 0B/0B CN:0 SD:0 DL:0B]
FILE: [MEMORY][METADATA]Adele-Hello.mp3
-

*** Download Progress Summary as of Wed Feb 24 07:40:51 2016 ***
=
[#241e9b 0B/0B CN:0 SD:0 DL:0B]
FILE: [MEMORY][METADATA]Adele-Hello.mp3
-

^C^C
02/24 07:40:59 [NOTICE] Shutdown sequence commencing... Press Ctrl-C again for emergency shutdown.

02/24 07:41:00 [NOTICE] Download GID#241e9b0755f53b40 not complete: [METADATA]Adele-Hello.mp3

Download Results:
gid |stat|avg speed |path/URI
======+====+===========+=======================================================
241e9b|INPR| 0B/s|[MEMORY][METADATA]Adele-Hello.mp3

Status Legend:
(INPR):download in-progress.

aria2 will resume download if the transfer is restarted.
If there are any errors, then see the log file. See '-l' option in help/man page for details.
root@OpenWrt:/www#

然后我又在另一台笔记本上用迅雷测试了一下,也无法下载,如下图:

注意:后来查明原因无法下载是由于GFW导致,需要翻墙

集成webui-aria2

ziahamza/webui-aria2
只需要把这个仓库下载到“/www”目录下即可,由于路由器不支持git和unzip命令,所以先下载到台式机

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
huzhifeng@Ubuntu1404:~/aria2$ git clone https://github.com/ziahamza/webui-aria2.git
Cloning into 'webui-aria2'...
remote: Counting objects: 8525, done.
remote: Total 8525 (delta 0), reused 0 (delta 0), pack-reused 8525
Receiving objects: 100% (8525/8525), 11.89 MiB | 47 KiB/s, done.
Resolving deltas: 100% (1710/1710), done.
huzhifeng@Ubuntu1404:~/aria2$
huzhifeng@Ubuntu1404:~/aria2$ tree -L 2 webui-aria2
webui-aria2
├── configuration.js
├── css
│ ├── bootstrap.css
│ ├── download.css
│ ├── flag-icon.min.css
│ ├── font-awesome.css
│ ├── font-awesome.min.css
│ ├── modals.css
│ └── style.css
├── directurl.md
├── Dockerfile
├── favicon.ico
├── flags
│ ├── 1x1
│ └── 4x3
├── fonts
│ ├── FontAwesome.otf
│ ├── fontawesome-webfont.eot
│ ├── fontawesome-webfont.svg
│ ├── fontawesome-webfont.ttf
│ ├── fontawesome-webfont.woff
│ └── fontawesome-webfont.woff2
├── img
│ ├── glyphicons-halflings.png
│ └── glyphicons-halflings-white.png
├── index.html
├── js
│ ├── ctrls
│ ├── directives
│ ├── filters
│ ├── init.js
│ ├── libs
│ ├── services
│ └── translate
├── LICENSE
├── README.md
├── screenshots
│ └── overview.png
└── webui-aria2.spec

14 directories, 25 files
huzhifeng@Ubuntu1404:~/aria2$
huzhifeng@Ubuntu1404:~/aria2$ du -h webui-aria2
32K webui-aria2/img
8.0K webui-aria2/.git/logs/refs/heads
12K webui-aria2/.git/logs/refs
20K webui-aria2/.git/logs
4.0K webui-aria2/.git/refs/tags
8.0K webui-aria2/.git/refs/heads
8.0K webui-aria2/.git/refs/remotes/origin
12K webui-aria2/.git/refs/remotes
28K webui-aria2/.git/refs
8.0K webui-aria2/.git/info
4.0K webui-aria2/.git/branches
40K webui-aria2/.git/hooks
4.0K webui-aria2/.git/objects/info
13M webui-aria2/.git/objects/pack
13M webui-aria2/.git/objects
13M webui-aria2/.git
244K webui-aria2/css
4.5M webui-aria2/flags/1x1
4.6M webui-aria2/flags/4x3
9.1M webui-aria2/flags
712K webui-aria2/fonts
28K webui-aria2/js/services/rpc
40K webui-aria2/js/services/settings
100K webui-aria2/js/services
20K webui-aria2/js/directives
40K webui-aria2/js/ctrls
60K webui-aria2/js/translate
2.0M webui-aria2/js/libs
12K webui-aria2/js/filters
2.2M webui-aria2/js
180K webui-aria2/screenshots
25M webui-aria2
huzhifeng@Ubuntu1404:~/aria2$
huzhifeng@Ubuntu1404:~/aria2$ tar -czf webui-aria2.tar.bz webui-aria2

再通过scp命令下载到路由器

1
2
3
4
5
6
7
8
root@OpenWrt:/www# cd /tmp/
root@OpenWrt:/tmp# scp huzhifeng@192.168.2.245:~/aria2/webui-aria2.tar.bz ./
huzhifeng@192.168.2.245's password:
webui-aria2.tar.bz 100% 15MB 5.1MB/s 00:03
root@OpenWrt:/tmp# tar -xzf webui-aria2.tar.bz
root@OpenWrt:/tmp# rm -rf webui-aria2.tar.bz
root@OpenWrt:/tmp# rm -rf webui-aria2/.git
root@OpenWrt:/tmp# mv webui-aria2 /www/

访问http://192.168.8.1/webui-aria2/ ,如下图:

HTTP下载测试

找一个HTTP下载链接,例如
06. 在等待 李慧珍

FTP下载测试

freeradius-server-3.0.11.tar.bz2

代码提交记录

如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
commit 728a3f337490df0288532ef642f3a58505ac9d5d
Author: huzhifeng <zhifeng.hu@hotmail.com>
Date: Fri Sep 30 05:44:18 2016 +0800

Add support for Aria2 downloader

1. Upgrade aria2 to 1.27.1@eb17bec0cd3ecd56003ff89457b53951
https://github.com/openwrt/packages/tree/master/net/aria2 [2fe6c4a29ec861823b1a33b1ead1400af129a7b9]
2. Add new package luci-app-aria2
https://github.com/openwrt/luci/tree/master/applications/luci-app-aria2 [185e4c1332ae65ffdcaf96597f729d57e890cead]
3. Add new package webui-aria2
https://github.com/openwrt/packages/tree/master/net/webui-aria2 [1213c6ef5a904f7d724933792ea3661efc067545]
4. Add new package yaaw
https://github.com/openwrt/packages/tree/master/net/yaaw [83ee268d4c531516bfa0a74690e2de68b6f4a0d5]

modified: .config
new file: feeds/luci/applications/luci-app-aria2/Makefile
new file: feeds/luci/applications/luci-app-aria2/luasrc/controller/aria2.lua
new file: feeds/luci/applications/luci-app-aria2/luasrc/model/cbi/aria2.lua
new file: feeds/luci/applications/luci-app-aria2/luasrc/view/aria2/overview_status.htm
new file: feeds/luci/applications/luci-app-aria2/po/templates/aria2.pot
new file: feeds/luci/applications/luci-app-aria2/po/zh-cn/aria2.po
new file: feeds/luci/applications/luci-app-aria2/root/etc/uci-defaults/40_luci-aria2
modified: feeds/packages/net/aria2/Config.in
modified: feeds/packages/net/aria2/Makefile
new file: feeds/packages/net/aria2/files/aria2.conf
new file: feeds/packages/net/aria2/files/aria2.init
new file: package/feeds/luci/luci-app-aria2
new file: package/network/webui-aria2/Makefile
new file: package/network/yaaw/Makefile

独立web服务端口

参考
multiple instances of uhttpd

Web Server Configuration (uHTTPd)

webui-aria2使用8080,yaaw使用8081

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
root@OpenWrt:~# cat /etc/config/uhttpd 

config uhttpd 'main'
list listen_http '0.0.0.0:80'
list listen_http '[::]:80'
list listen_https '0.0.0.0:443'
list listen_https '[::]:443'
option home '/www'
option rfc1918_filter '1'
option max_requests '3'
option max_connections '100'
option cert '/etc/uhttpd.crt'
option key '/etc/uhttpd.key'
option cgi_prefix '/cgi-bin'
option script_timeout '60'
option network_timeout '30'
option http_keepalive '20'
option tcp_keepalive '1'
option ubus_prefix '/ubus'

config uhttpd 'aria2'
list listen_http '0.0.0.0:8080'
option home '/www/webui-aria2'

config uhttpd 'yaaw'
list listen_http '0.0.0.0:8081'
option home '/www/yaaw'

config cert 'px5g'
option days '730'
option bits '1024'
option country 'DE'
option state 'Berlin'
option location 'Berlin'
option commonname 'OpenWrt'

root@OpenWrt:~#
root@OpenWrt:~# ps www | grep http
5051 root 1512 S /usr/sbin/uhttpd -f -h /www -r OpenWrt -x /cgi-bin -u /ubus -t 60 -T 30 -k 20 -A 1 -n 3 -N 100 -R -p 0.0.0.0:80 -p [::]:80
5052 root 1132 S /usr/sbin/uhttpd -f -h /www/webui-aria2 -r OpenWrt -n 3 -p 0.0.0.0:8080
5053 root 1132 S /usr/sbin/uhttpd -f -h /www/yaaw -r OpenWrt -n 3 -p 0.0.0.0:8081
5061 root 1360 S grep http
root@OpenWrt:~#
root@OpenWrt:~# netstat -lnpt | grep http
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 5052/uhttpd
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 5051/uhttpd
tcp 0 0 0.0.0.0:8081 0.0.0.0:* LISTEN 5053/uhttpd
tcp 0 0 :::80 :::* LISTEN 5051/uhttpd
root@OpenWrt:~#

代码提交记录如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
huzhifeng@ubuntu1404srv:~/git/openwrt_trunk$ git show -1
commit 930ebc2e6cffb750ec09595f2c7da805b49997a8
Author: huzhifeng <zhifeng.hu@hotmail.com>
Date: Sat Oct 15 02:15:05 2016 +0800

Launch two dedicated uhttpd instances for yaaw and webui-aria2

References:
1. [multiple instances of uhttpd](https://forum.openwrt.org/viewtopic.php?id=40273)
2. [Web Server Configuration (uHTTPd)](https://wiki.openwrt.org/doc/uci/uhttpd)

modified: package/network/services/uhttpd/files/uhttpd.config

diff --git a/package/network/services/uhttpd/files/uhttpd.config b/package/network/services/uhttpd/files/uhttpd.config
index 83734af..01b2f60 100644
--- a/package/network/services/uhttpd/files/uhttpd.config
+++ b/package/network/services/uhttpd/files/uhttpd.config
@@ -100,6 +100,13 @@ config uhttpd main
# except for development and debug purposes!
# option no_ubusauth 0

+config uhttpd aria2
+ list listen_http 0.0.0.0:8080
+ option home /www/webui-aria2
+
+config uhttpd yaaw
+ list listen_http 0.0.0.0:8081
+ option home /www/yaaw

# Certificate defaults for px5g key generator
config cert px5g
huzhifeng@ubuntu1404srv:~/git/openwrt_trunk$

OpenWrt集成transmission

参考
路由器(DD-WRT)如何脱机下载BT文件
执行menuconfig勾选所有和aria2相关的配置

1
2
3
4
5
6
7
8
9
10
11
huzhifeng@Ubuntu1404:~/git/openwrt_trunk$ make menuconfig
Network --->
BitTorrent --->
<*> transmission-daemon................ A free, lightweight BitTorrent client --->
--- transmission-daemon................ A free, lightweight BitTorrent client
<*> transmission-cli................... A free, lightweight BitTorrent client
<*> transmission-remote................ A free, lightweight BitTorrent client
<*> transmission-web................... A free, lightweight BitTorrent client
LuCI --->
3. Applications --->
<*> luci-app-transmission...................... LuCI Support for Transmission

Ubuntu 14.04 LTS安装aria2

参考
How to install aria2 package in Ubuntu Trusty

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
huzhifeng@Ubuntu1404:~$ ssh huzhifeng@192.168.2.180
The authenticity of host '192.168.2.180 (192.168.2.180)' can't be established.
ECDSA key fingerprint is 62:2e:d2:76:6a:4b:80:96:07:cc:a8:79:7a:2c:51:f0.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.2.180' (ECDSA) to the list of known hosts.
huzhifeng@192.168.2.180's password:
Welcome to Ubuntu 14.04 LTS (GNU/Linux 3.13.0-24-generic x86_64)

* Documentation: https://help.ubuntu.com/

Last login: Thu Jan 28 16:14:39 2016 from 192.168.2.245
huzhifeng@Ubuntu1404:~$
huzhifeng@Ubuntu1404:~$
huzhifeng@Ubuntu1404:~$ sudo apt-get install -y aria2
[sudo] password for huzhifeng:
Reading package lists... Done
Building dependency tree
Reading state information... Done
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 623 not upgraded.
Need to get 1,134 kB of archives.
After this operation, 4,583 kB of additional disk space will be used.
Get:1 http://cn.archive.ubuntu.com/ubuntu/ trusty/main libc-ares2 amd64 1.10.0-2 [38.5 kB]
Get:2 http://cn.archive.ubuntu.com/ubuntu/ trusty/universe aria2 amd64 1.18.1-1 [1,095 kB]
Fetched 1,134 kB in 8s (141 kB/s)
Selecting previously unselected package libc-ares2:amd64.
(Reading database ... 172181 files and directories currently installed.)
Preparing to unpack .../libc-ares2_1.10.0-2_amd64.deb ...
Unpacking libc-ares2:amd64 (1.10.0-2) ...
Selecting previously unselected package aria2.
Preparing to unpack .../aria2_1.18.1-1_amd64.deb ...
Unpacking aria2 (1.18.1-1) ...
Processing triggers for man-db (2.6.7.1-1) ...
Setting up libc-ares2:amd64 (1.10.0-2) ...
Setting up aria2 (1.18.1-1) ...
Processing triggers for libc-bin (2.19-0ubuntu6) ...
huzhifeng@Ubuntu1404:~$
huzhifeng@Ubuntu1404:~$ aria2c -v
aria2 version 1.18.1
Copyright (C) 2006, 2013 Tatsuhiro Tsujikawa

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

** Configuration **
Enabled Features: Async DNS, BitTorrent, Firefox3 Cookie, GZip, HTTPS, Message Digest, Metalink, XML-RPC
Hash Algorithms: sha-1, sha-224, sha-256, sha-384, sha-512, md5
Libraries: zlib/1.2.8 libxml2/2.9.1 sqlite3/3.8.1 GnuTLS/2.12.23 libgcrypt/1.5.3 c-ares/1.10.0

Report bugs to t-tujikawa@users.sourceforge.net
Visit http://aria2.sourceforge.net/
huzhifeng@Ubuntu1404:~$

下载测试

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
huzhifeng@Ubuntu1404:~$ cd ~/Downloads/
huzhifeng@Ubuntu1404:~/Downloads$ aria2c "http://luoo-mp3.kssws.ks-cdn.com/low/luoo/radio716/06.mp3"
[#1ce3ab 5.1MiB/5.4MiB(93%) CN:1 DL:493KiB]
02/24 17:11:41 [NOTICE] Download complete: /home/huzhifeng/Downloads/06.mp3

Download Results:
gid |stat|avg speed |path/URI
======+====+===========+=======================================================
1ce3ab|OK | 492KiB/s|/home/huzhifeng/Downloads/06.mp3

Status Legend:
(OK):download completed.
huzhifeng@Ubuntu1404:~/Downloads$
huzhifeng@Ubuntu1404:~/Downloads$ aria2c "ftp://ftp.freeradius.org/pub/freeradius/freeradius-server-3.0.11.tar.bz2.sig"
[#dc8b53 0B/152B(0%) CN:1 DL:0B]
02/24 17:12:10 [NOTICE] Download complete: /home/huzhifeng/Downloads/freeradius-server-3.0.11.tar.bz2.sig

Download Results:
gid |stat|avg speed |path/URI
======+====+===========+=======================================================
dc8b53|OK | 88B/s|/home/huzhifeng/Downloads/freeradius-server-3.0.11.tar.bz2.sig

Status Legend:
(OK):download completed.
huzhifeng@Ubuntu1404:~/Downloads$ ls -l
total 5616
-rw-rw-r-- 1 huzhifeng huzhifeng 5742635 2月 24 17:11 06.mp3
-rw-rw-r-- 1 huzhifeng huzhifeng 152 2月 24 17:12 freeradius-server-3.0.11.tar.bz2.sig
huzhifeng@Ubuntu1404:~/Downloads$

集成yaaw

binux/yaaw
只需要把这个仓库下载到“/usr/share/nginx/html/”目录下即可

1
2
3
4
5
6
7
8
9
10
11
huzhifeng@Ubuntu1404:~/Downloads$ cd /usr/share/nginx/html/
huzhifeng@Ubuntu1404:/usr/share/nginx/html$ ls
50x.html index.html
huzhifeng@Ubuntu1404:/usr/share/nginx/html$ sudo git clone https://github.com/binux/yaaw.git
Cloning into 'yaaw'...
remote: Counting objects: 775, done.
remote: Total 775 (delta 0), reused 0 (delta 0), pack-reused 775
Receiving objects: 100% (775/775), 276.35 KiB | 100.00 KiB/s, done.
Resolving deltas: 100% (497/497), done.
Checking connectivity... done.
huzhifeng@Ubuntu1404:/usr/share/nginx/html$

手动启动aria2c

1
2
3
4
5
huzhifeng@Ubuntu1404:/usr/share/nginx/html$ sudo aria2c --enable-rpc=true --rpc-listen-all=true --rpc-allow-origin-all -c

02/24 17:22:56 [NOTICE] IPv4 RPC: listening on TCP port 6800

02/24 17:22:56 [NOTICE] IPv6 RPC: listening on TCP port 6800

集成webui-aria2

同上,故略

参考

路由器OpenWrt如何脱机(离线)下载BT文件
Openwrt上配置Aria2迅雷离线下载步骤
路由器离线BT新宠Aria2:实际测试比Transmission快很多哦
OpenWrt固件 + Aria2 + 迅雷VIP 真是神器
OpenWrt - Menadżer pobierania

EOF