安装
以Msys
为例
$ pacman -S mingw64/mingw-w64-x86_64-aria2
配置
配置文件路径$HOME/.aria2/aria2.conf
dir=/Downloads
continue=true
file-allocation=falloc
max-concurrent-downloads=256
max-connection-per-server=16
max-overall-upload-limit=128K
max-concurrent-downloads=256
split=256
follow-torrent=true
bt-seed-unverified=true
bt-max-peers=0
bt-detach-seed-only=true
bt-save-metadata=true
bt-request-peer-speed-limit=1M
seed-time=0
# This parameter will be assigned in command line.
# bt-tracker=http://1337.abcvg.info:80/announce,
注意bt-tracker
参数只是举例,建议根据trackerslist或者其他内容填写。
后台
参考文章
启动
$ aria2c.exe --daemon=true --enable-rpc=true --rpc-listen-all=true
$ trackers=`wget -qO- https://trackerslist.com/best_aria2.txt` && aria2c --daemon=true --enable-rpc=true --rpc-listen-all=true --bt-tracker=$trackers
笔记近期将路由器刷机成openwrt之后,用系统openwrt UI启动服务不成功。提示认证失败。敲命令OK。
trackers=`wget -qO- https://trackerslist.com/best_aria2.txt`
aria2c --dir=/overlay/share --daemon=true --enable-rpc=true --rpc-listen-all=true --rpc-secret=JustDoIt --bt-tracker=$trackers
测试
笔者宽带为100Mbps,以下载ubuntu 20.10为例,下载速度是可以达到满速。
终端侧
$ aria2c.exe --daemon=true --enable-rpc=true --rpc-listen-all=true
04/10 18:43:11 [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.
04/10 18:43:11 [NOTICE] IPv4 RPC: listening on TCP port 6800
04/10 18:43:11 [NOTICE] IPv6 RPC: listening on TCP port 6800
04/10 18:43:36 [WARN] Gaining privilege SeManageVolumePrivilege failed.
04/10 18:43:36 [WARN] --file-allocation=falloc will not work properly.
04/10 18:43:36 [NOTICE] IPv4 DHT: listening on UDP port 6917
04/10 18:43:36 [NOTICE] IPv4 BitTorrent: listening on TCP port 6964
04/10 18:43:36 [NOTICE] IPv6 BitTorrent: listening on TCP port 6964
[#b7e672 328MiB/2.7GiB(11%) CN:153 SD:73 DL:6.0MiB ETA:6m47s]
网页侧
服务
如果使用ubuntu等linux系统。可以创建systemd的服务。方便操作。
# ethan@B85MK:~/.aria2$ cat /etc/systemd/system/aria2.service
[Unit]
Description=Aria2 Service
After=network.target
[Service]
User=ethan
Type=forking
ExecStart=/usr/bin/aria2c --daemon=true --enable-rpc=true --rpc-secret=JustDoIt --rpc-listen-all=true --quiet=true --conf-path=/home/ethan/.aria2/aria2.conf
[Install]
WantedBy=multi-user.target
注意服务启动不能通过命令行方式动态更新bt-tracker参数。考虑到启动时候更新比较耗时,并不合适。
此时aria2.conf文件如下:
dir=/home/ethan/Downloads
continue=true
# file-allocation=falloc
file-allocation=none
max-concurrent-downloads=256
max-connection-per-server=16
max-overall-upload-limit=128K
max-concurrent-downloads=256
split=256
# enable-dht=true
# bt-enable-lpd=true
# enable-peer-exchange=true
follow-torrent=true
bt-seed-unverified=true
bt-max-peers=0
bt-detach-seed-only=true
# bt-save-metadata=true
bt-request-peer-speed-limit=1M
seed-time=0
# 限于篇幅,此处只保留两个,以作参考。
bt-tracker=http://1337.abcvg.info:80/announce,http://milanesitracker.tekcities.com
save-session=/home/ethan/.aria2/aria2.session
input-file=/home/ethan/.aria2/aria2.session
运行之前,先创立空白session.
touch ~/.aria2/aria2.session
如果需要的话,可以设置开机启动。
sudo systemctl daemon-reload
sudo systemctl enable aria2.service
即时启动
sudo systemctl daemon-reload
sudo systemctl restart aria2.service
查看状态和日志
# 此命令不用管理员权限
systemctl status aria2.service
journalctl -xeu aria2.service
WebUI
日常操作过程中发现,在线的WebUI存在连接慢的情况。可以自己建立WebUI来替代。
pkg install nodejs
git clone https://github.com/ziahamza/webui-aria2.git
cd webui-aria2/
node node-server.js &
cd ..