3.3.2 linux上搭建Aria2
Next generation download utility. aria2 is a lightweight multi-protocol & multi-source command-line download utility. It supports HTTP/HTTPS, FTP, SFTP, BitTorrent and Metalink. aria2 can be manipulated via built-in JSON-RPC and XML-RPC interfaces.
官方文档 https://aria2.github.io/manual/en/html/aria2c.html
install on ubuntu
apt update
sudo apt-get install aria2
y
clear
useage
# download one
aria2c [URL]
# download multiple files
aria2c [URL1] [URL2]
# check the detail manual
man aria2c
you can download files from their source using 2 connections to speed up the process using -x option as below:
aria2c -x 2 [url]
you can download torrent files with following command
aria2c [url]
set download speed
aria2c -max-download-limit=100K [url]
配置文件
cd ~
mkdir .aria2
touch aria2.session
vim aria2.conf
###############################
# Motrix Linux Aria2 config file
#
# @see https://aria2.github.io/manual/en/html/aria2c.html
#
###############################
################ RPC ################
# Enable JSON-RPC/XML-RPC server.
enable-rpc=true
# Add Access-Control-Allow-Origin header field with value * to the RPC response.
rpc-allow-origin-all=true
# Listen incoming JSON-RPC/XML-RPC requests on all network interfaces.
rpc-listen-all=true
rpc-secret=xxxxxx
################ File system ################
# Save a control file(*.aria2) every SEC seconds.
auto-save-interval=10
# Enable disk cache.
disk-cache=32M
# Specify file allocation method.
file-allocation=trunc
# Save error/unfinished downloads to a file specified by --save-session option every SEC seconds.
save-session-interval=10
################ Task ################
# Exclude seed only downloads when counting concurrent active downloads
bt-detach-seed-only=true
# Verify the peer using certificates specified in --ca-certificate option.
check-certificate=false
# If aria2 receives "file not found" status from the remote HTTP/FTP servers NUM times
# without getting a single byte, then force the download to fail.
max-file-not-found=5
# Set number of tries.
max-tries=5
# aria2 does not split less than 2*SIZE byte range.
min-split-size=1M
# Set user agent for HTTP(S) downloads.
user-agent=Transmission/2.94
################ BT Task ################
# Enable Local Peer Discovery.
bt-enable-lpd=true
# Requires BitTorrent message payload encryption with arc4.
# bt-force-encryption=true
# If true is given, after hash check using --check-integrity option and file is complete, continue to seed file.
bt-hash-check-seed=true
# Specify the maximum number of peers per torrent.
bt-max-peers=255
# Try to download first and last pieces of each file first. This is useful for previewing files.
bt-prioritize-piece=head
# Removes the unselected files when download is completed in BitTorrent.
bt-remove-unselected-file=true
# Seed previously downloaded files without verifying piece hashes.
bt-seed-unverified=true
# Set host and port as an entry point to IPv4 DHT network.
dht-entry-point=dht.transmissionbt.com:6881
# Set host and port as an entry point to IPv6 DHT network.
dht-entry-point6=dht.transmissionbt.com:6881
# Enable IPv4 DHT functionality. It also enables UDP tracker support.
enable-dht=true
# Enable IPv6 DHT functionality.
enable-dht6=true
# Enable Peer Exchange extension.
enable-peer-exchange=true
# Specify the string used during the bitorrent extended handshake for the peer's client version.
peer-agent=Transmission/2.94
# Specify the prefix of peer ID.
peer-id-prefix=-TR2940-
# 从会话文件中读取下载任务
input-file=/home/kali/.aria2/aria2.session
# 在Aria2退出时保存`错误/未完成`的下载任务到会话文件
save-session=/home/kali/.aria2/aria2.session
# 定时保存会话, 0为退出时才保存, 需1.16.1以上版本, 默认:0
save-session-interval=60
# 最大同时下载任务数, 运行时可修改, 默认:5
max-concurrent-downloads=5
# 同一服务器连接数, 添加时可指定, 默认:1
max-connection-per-server=16
# 最小文件分片大小, 添加时可指定, 取值范围1M -1024M, 默认:20M
# 假定size=10M, 文件为20MiB 则使用两个来源下载; 文件为15MiB 则使用一个来源下载
min-split-size=1M
# 单个任务最大线程数, 添加时可指定, 默认:5
split=16
# 断点续传
continue=true
# 文件的保存路径(可使用绝对路径或相对路径), 默认: 当前启动位置
dir=/home/kali/Desktop/downloads
注意: 配置不支持~
的解析,所以要写全路径
图像化界面AriaNg
下载完,解压,放在nginx根目录/var/www/html
即可
wget -c https://github.com/mayswind/AriaNg/releases/download/1.1.7/AriaNg-1.1.7.zip
终端开启aria2c
aria2c --conf-path="/home/kali/.aria2/aria2.conf" -D
开机自启
cd
mkdir bash
cd bash
vim aria2c_start.sh
#!/bin/bash
aria2c --conf-path="/home/store/.aria2/aria2.conf" -D
设置执行权限
sudo chmod +x aria2c_start.sh
crontab 设置开机自动启动
crontab -e
# 选择2
# 末尾添加一行
@reboot /home/kali/bash/aria2c_start.sh