跳转至

Aria2 编译 添加支持BT下载的功能(X86和armhf的树莓派2)

Aria2 编译 添加支持BT下载的功能(X86和armhf的树莓派2)

Aria2 源码下载地址

http://sourceforge.net/projects/aria2/files/stable/

个人认为 1.16.5 和 1.17.1 比 1.18 1.19 稳定很多,暂时不建议高版本编译

其实另一说是要看你系统 如果是老机器装的旧系统就老老实实用低版本,不过要是低于1.16+ 就不如用软件源自己带的版本 没必要自己费尽编译了

tar zxvf aria2-1.17.tar.gz
cd aria2-1.17.1
sudo ./configure ARIA2_STATIC=yes --enable-bittorrent --enable-metalink

部分机器貌似可以编译 但是不能make 那就考虑删掉 ARIA2_STATIC=yes

sudo ./configure --enable-bittorrent --enable-metalink

需要的lib

sudo apt-get install gcc c++ autoconf automake libcppunit-dev  autopoint openssl libtool sphinx-common sphinxsearch libgcrypt11-dev libxml2-dev pkg-config

--enable-bittorrent --enable-metalink

添加BT和磁力链的支持

ubuntu 10.04.4 512M内存 AMD LX800低功耗主机 主频500MHz上面的编译结果

configure: summary of build options:

    version:        0.1.1 shared 0:0:0
    Host type:      i586-pc-linux-gnu
    Install prefix: /usr/local
    C compiler:     gcc
    CFlags:         -g -O2
    Library types:  Shared=yes, Static=yes
    CUnit:          no


Build:          i586-pc-linux-gnu
Host:           i586-pc-linux-gnu
Target:         i586-pc-linux-gnu
Install prefix: /usr/local
CC:             gcc
CXX:            g++
CPP:            gcc -E
CXXFLAGS:       -g -O2
CFLAGS:         -g -O2
CPPFLAGS:       -I$(top_builddir)/deps/wslay/lib/includes -I$(top_srcdir)/deps/wslay/lib/includes  -I/usr/include/libxml2 
LDFLAGS:         -all-static -static-libgcc -static-libstdc++
LIBS:           -lrt -lgcrypt -lxml2 -lz  -lpthread -ldl -lrt
DEFS:           -DHAVE_CONFIG_H
LibUV:          no
SQLite3:        no
SSL Support:    
AppleTLS:       
GnuTLS:         no
OpenSSL:        no
CA Bundle:      
LibXML2:        yes
LibExpat:       
LibCares:       no
Zlib:           yes
Epoll:          yes
Bittorrent:     yes
Metalink:       yes
XML-RPC:        yes
Message Digest: yes
WebSocket:      yes
Libaria2:       no
bash_completion dir: ${datarootdir}/doc/${PACKAGE_TARNAME}/bash_completion
Static build:   yes

树莓派2 Arm 4核 1G内存 主频 900MHz

Ubuntu mate 15.04 vivid

configure: summary of build options:

    version:        0.1.1 shared 0:0:0
    Host type:      armv7l-unknown-linux-gnueabihf
    Install prefix: /usr/local
    C compiler:     gcc
    CFlags:         -g -O2
    Library types:  Shared=yes, Static=yes
    CUnit:          no


Build:          armv7l-unknown-linux-gnueabihf
Host:           armv7l-unknown-linux-gnueabihf
Target:         armv7l-unknown-linux-gnueabihf
Install prefix: /usr/local
CC:             gcc
CXX:            g++
CPP:            gcc -E
CXXFLAGS:       -g -O2
CFLAGS:         -g -O2
CPPFLAGS:       -I$(top_builddir)/deps/wslay/lib/includes -I$(top_srcdir)/deps/wslay/lib/includes  -I/usr/include/libxml2 
LDFLAGS:        
LIBS:           -lgcrypt -lxml2 
DEFS:           -DHAVE_CONFIG_H
LibUV:          no
SQLite3:        no
SSL Support:    
AppleTLS:       
GnuTLS:         no
OpenSSL:        no
CA Bundle:      
LibXML2:        yes
LibExpat:       
LibCares:       no
Zlib:           no
Epoll:          yes
Bittorrent:     yes
Metalink:       yes
XML-RPC:        yes
Message Digest: yes
WebSocket:      yes
Libaria2:       no
bash_completion dir: ${datarootdir}/doc/${PACKAGE_TARNAME}/bash_completion
Static build:  

同时放上树莓派2 Ubuntu mate 15.04 vivid 的软件源

deb http://mirrors.ustc.edu.cn/ubuntu-ports/ vivid main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ vivid-updates main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ vivid-security main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ vivid-backports main restricted universe multiverse

这个比自带的软件源快很多 400k 和 50k 下载速度的差距

Bittorrent:     yes

Metalink:       yes

Static build:   yes

默认这些都是no,也就是不支持的意思

coufigure之后就是make和安装了,建议先卸了自带的

sudo apt-get remove aria2

然后在使用自己的编译版本

sudo make
sudo make install

非常无语的是本来就3M多的源码编译了以后要几百M

树莓派2 还好 4核编译速度依旧还是很慢,没感觉能比低主频的X86cpu快

附带 aria2 配置文件

enable-rpc=true
rpc-allow-origin-all=true
rpc-listen-all=true
rpc-listen-port=6800
#event-poll=select
disable-ipv6=true

max-concurrent-downloads=2
continue=true
max-connection-per-server=5
min-split-size=10M
split=5
max-overall-download-limit=0
max-download-limit=0
max-overall-upload-limit=15k
max-upload-limit=15k
#lowest-speed-limit=0
#referer=*
input-file=/etc/aria2/session.txt
save-session=/etc/aria2/session.txt
save-session-interval=30
dir=/nas/aria2
disk-cache=16M
enable-mmap=true

file-allocation=none
force-save=true 

follow-torrent=true
bt-hash-check-seed=true
bt-seed-unverified=true
bt-save-metadata=true
#bt-request-peer-speed-limit=2M
bt-save-metadata=true
#seed-time=10
seed-ratio=0.1


log=/etc/aria2/aria2.log
log-level=error
max-download-result=50

启动脚本保存在 /etc/init.d/aria2

#!/bin/sh

### BEGIN INIT INFO
# Provides:          aria2
# Required-Start:
# Required-Stop:
# Default-Start:
# Default-Stop:
# Short-Description: aria2
### END INIT INFO

case $1 in
        start)
                touch /etc/aria2/session.txt
                /usr/bin/aria2c --conf-path=/etc/aria2/aria2.conf -D
                ;;
        stop)
                killall aria2c
                ;;
        *)
                echo "Usage: /etc/init.d/aria2 {start|stop}"
                exit 1
                ;;
esac
exit 0

增加启动项

引用sudo update-rc.d aria2 defaults

这就是为嘛编译的之后的aria2没有BT下载功能的原因,貌似这玩意不加参数不编译成可用

原文链接: https://www.iteye.com/blog/happysoul-2218060