树莓派 下载工具Aria2 安装部署

安装Aria2
apt-get install aria2

创建目录/root/.aria2
创建文件session.dat,内容为空
创建配置文件aria2.conf,模板如下

dir=/home
log=/var/log/aria2.log
input-file=/root/.aria2/session.dat
save-session=/root/.aria2/session.dat
dht-file-path=/root/.aria2/dht.dat
dht-file-path6=/root/.aria2/dht6.dat
force-save=true
log-level=error

# see --split option
max-concurrent-downloads=5
continue=true
max-overall-download-limit=0
max-overall-upload-limit=128K
max-upload-limit=20
max-tries=0
retry-wait=5

# Http/FTP options
connect-timeout=120
lowest-speed-limit=0
max-connection-per-server=16
max-file-not-found=0
min-split-size=1M
split=32

# FTP Specific Options

# BT/PT Setting
bt-detach-seed-only=true
bt-enable-lpd=true
bt-max-peers=0
bt-remove-unselected-file=true
bt-request-peer-speed-limit=1M
bt-tracker=udp://tracker.coppersurfer.tk:6969/announce,udp://tracker.internetwarriors.net:1337/announce,http://tracker.internetwarriors.net:1337/announce,udp://tracker.opentrackr.org:1337/announce,udp://9.rarbg.to:2710/announce,udp://exodus.desync.com:6969/announce,udp://tracker1.itzmx.com:8080/announce,udp://tracker.vanitycore.co:6969/announce,udp://explodie.org:6969/announce,http://tracker3.itzmx.com:6961/announce,http://tracker1.itzmx.com:8080/announce,http://tracker.vanitycore.co:6969/announce,http://explodie.org:6969/announce,udp://ipv4.tracker.harry.lu:80/announce,udp://tracker.torrent.eu.org:451/announce,udp://tracker.tiny-vps.com:6969/announce,udp://open.stealth.si:80/announce,udp://open.demonii.si:1337/announce,udp://denis.stalker.upeer.me:6969/announce,udp://zephir.monocul.us:6969/announce,udp://tracker.port443.xyz:6969/announce,udp://tracker.iamhansen.xyz:2000/announce,udp://thetracker.org:80/announce,udp://retracker.lanta-net.ru:2710/announce,http://tracker.port443.xyz:6969/announce,udp://tracker.cypherpunks.ru:6969/announce,udp://tracker.cyberia.is:6969/announce,https://tracker.fastdownload.xyz:443/announce,https://opentracker.xyz:443/announce,http://tracker.cypherpunks.ru:6969/announce,http://tracker.city9x.com:2710/announce,http://opentracker.xyz:80/announce,http://open.trackerlist.xyz:80/announce,http://open.acgnxtracker.com:80/announce,udp://tracker4.itzmx.com:2710/announce,udp://tracker2.itzmx.com:6961/announce,udp://tracker.uw0.xyz:6969/announce,udp://tracker.tvunderground.org.ru:3218/announce,udp://tracker.kamigami.org:2710/announce,udp://tracker.btsync.gq:233/announce,udp://torrentclub.tech:6969/announce,udp://pubt.in:2710/announce,udp://amigacity.xyz:6969/announce,http://tracker4.itzmx.com:2710/announce,http://tracker2.itzmx.com:6961/announce,http://tracker.tvunderground.org.ru:3218/announce,http://tracker.torrentyorg.pl:80/announce,http://tracker.btsync.gq:233/announce,http://torrentclub.tech:6969/announce,http://torrent.nwps.ws:80/announce,http://t.nyaatracker.com:80/announce,http://retracker.mgts.by:80/announce,http://open.acgtracker.com:1096/announce,http://amigacity.xyz:6969/announce,wss://tracker.openwebtorrent.com:443/announce,wss://tracker.fastcast.nz:443/announce,wss://tracker.btorrent.xyz:443/announce,wss://ltrackr.iamhansen.xyz:443/announce,udp://tracker.justseed.it:1337/announce,udp://packages.crunchbangplusplus.org:6969/announce,https://1337.abcvg.info:443/announce,http://tracker.tfile.me:80/announce.php,http://tracker.tfile.me:80/announce,http://tracker.tfile.co:80/announce,http://share.camoe.cn:8080/announce,http://private.minimafia.nl:443/announce,http://prestige.minimafia.nl:443/announce,http://peersteers.org:80/announce,http://fxtt.ru:80/announce
enable-dht6=true
follow-torrent=true
seed-ratio=0.0
seed-time=5
peer-id-prefix=-TR2770-
user-agent=Transmission/2.77

# Metalink Specific Options

# RPC Options
enable-rpc=true
rpc-listen-port=6800
rpc-allow-origin-all=true
rpc-listen-all=true
rpc-save-upload-metadata=true
#rpc-secret=

# Advanced Options
daemon=true
disable-ipv6=false
enable-mmap=true
file-allocation=falloc
max-download-result=120
#no-file-allocation-limit=32M
force-sequential=true
parameterized-uri=true

创建服务脚本/etc/init.d/aria2,权限755,内容如下

#!/bin/sh
### BEGIN INIT INFO
# Provides:          aria2
# Required-Start:    $remote_fs $network
# Required-Stop:     $remote_fs $network
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Aria2 Downloader
### END INIT INFO

case "$1" in
start)

echo "Starting aria2c"
/usr/bin/aria2c --conf-path=/root/.aria2/aria2.conf -D
;;
stop)

echo "Shutting down aria2c"
killall -9 aria2c
;;
restart)

echo "Restarting aria2c"
killall -9 aria2c
/usr/bin/aria2c --conf-path=/root/.aria2/aria2.conf -D
;;
esac
exit

启动、停止、重启

/etc/init.d/aria2 start | stop | restart

Aria2在开启启动时可能会遇到无法开启端口的问题,需要设置延迟启动
错误日志

2019-07-28 21:21:31.360855 [ERROR] [HttpListenCommand.cc:112] IPv4 RPC: failed to bind TCP port 6800
Exception: [SocketCore.cc:312] errorCode=1 Failed to bind a socket, cause: Name or service not known
2019-07-28 21:21:31.368964 [ERROR] [MultiUrlRequestInfo.cc:297] Exception caught
Exception: [DownloadEngineFactory.cc:219] errorCode=1 Failed to setup RPC server.
2019-07-28 21:21:31.361219 [ERROR] [HttpListenCommand.cc:112] IPv4 RPC: failed to bind TCP port 6800
Exception: [SocketCore.cc:312] errorCode=1 Failed to bind a socket, cause: Name or service not known
2019-07-28 21:21:31.369443 [ERROR] [MultiUrlRequestInfo.cc:297] Exception caught
Exception: [DownloadEngineFactory.cc:219] errorCode=1 Failed to setup RPC server.

创建延迟启动脚本,用于开机启动,内容如下

#!/bin/sh
sleep 30s
/etc/init.d/aria2c start
exit 0

将延迟启动脚本加入到Cron,设置为开机启动

使用WebUI
安装Apache
apt-get install apache2

Apache端口配置,修改/etc/apache2/ports.conf
启动、停止、重启

/etc/init.d/apache2 start | stop | restart
systemctl start | stop | restart apache2

安装第三方WebUI
AriaNg
下载地址
https://github.com/mayswind/AriaNg/releases
下载后解压文件到/var/www/html