在Ubuntu上安装Aria2和Aria2-NG做下载机
2022年03月25日更新内容:
- 完善aria2配置文件内容;
- 添加从
systemd的启动方法。
配置
OS: Ubuntu 18.04 LTS
安装Aria2
Ubuntu里面所有命令前添加sudo是好习惯,尤其是把Desktop当Server用的时候。
1 2 3
| sudo apt-get update sudo apt-get install vim sudo apt-get install aria2
|
Vim是可选的,你可以使用任何你习惯的文本编辑器。
配置Aria2
创建配置文件:
1 2 3 4
| sudo mkdir /etc/aria2 sudo touch /etc/aria2/aria2.session sudo chmod 777 /etc/aria2/aria2.session sudo vim /etc/aria2/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
| dir=/root/Downloads
disable-ipv6=true
enable-rpc=true rpc-allow-origin-all=true rpc-listen-all=true
continue=true
input-file=/etc/aria2/aria2.session save-session=/etc/aria2/aria2.session
max-concurrent-downloads=20 save-session-interval=120
connect-timeout=120
max-connection-per-server=10
min-split-size=10M
split=10 check-certificate=false
|
启动Aria2
1 2 3 4
| sudo aria2c --conf-path=/etc/aria2/aria2.conf
sudo aria2c --conf-path=/etc/aria2/aria2.conf -D
|
Aria2 Systemd启动
在/etc/systemd/system下创建新服务文件,文件名可自定义但后缀名要为.service。
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| [Unit]
Description=Aria2-RPC After=network.target
[Service]
ExecStart=aria2c --conf-path=/etc/aria2/aria2.conf Restart=always RestartSec=5 StartLimitInterval=0
[Install] WantedBy=multi-user.target
|
编辑完成后保存,执行systemctl start aria2启动Aria2,参数中aria2为新创建的服务文件名,可以不包括后缀名。执行systemctl enable aria2启用开机启动。
Aria2-NG安装与设置
首先下载Aria2-NG整合包点我下载 。
下载后解压双击index.html即可。
配置文件详解
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 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352
|
dir=/root/downloads
disk-cache=64M
file-allocation=falloc
no-file-allocation-limit=64M
continue=true
always-resume=false
max-resume-failure-tries=0
remote-time=true
input-file=/root/downloads/sessions/aria2.session
save-session=/root/downloads/sessions/aria2.session
save-session-interval=1
auto-save-interval=20
force-save=false
max-file-not-found=10
max-tries=0
retry-wait=10
connect-timeout=10
timeout=10
max-concurrent-downloads=10
max-connection-per-server=16
split=64
min-split-size=4M
piece-length=1M
allow-piece-length-change=true
lowest-speed-limit=0
max-overall-download-limit=0
max-download-limit=0
disable-ipv6=false
http-accept-gzip=true
reuse-uri=false
no-netrc=true
allow-overwrite=false
auto-file-renaming=true
content-disposition-default-utf8=true
min-tls-version=TLSv1.1
listen-port=51413
dht-listen-port=51413
enable-dht=true
enable-dht6=true
dht-file-path=/root/downloads/dht/dht.dat
dht-file-path6=/root/downloads/dht/dht6.dat
dht-entry-point=dht.transmissionbt.com:6881
dht-entry-point6=dht.transmissionbt.com:6881
bt-enable-lpd=true
enable-peer-exchange=true
bt-max-peers=128
bt-request-peer-speed-limit=20M
max-overall-upload-limit=2M
max-upload-limit=0
seed-ratio=1.5
seed-time=1440
bt-hash-check-seed=true
bt-seed-unverified=true
bt-tracker-connect-timeout=60
bt-tracker-timeout=60
bt-prioritize-piece=head=32M,tail=32M
rpc-save-upload-metadata=true
follow-torrent=true
pause-metadata=false
bt-save-metadata=true
bt-load-saved-metadata=true
bt-remove-unselected-file=true
bt-force-encryption=true
bt-detach-seed-only=true
user-agent=Mozilla/5.0 (Windows NT 10.0
peer-agent=Transmission 2.94 peer-id-prefix=-TR2940-
enable-rpc=true
rpc-allow-origin-all=true
rpc-listen-all=true
rpc-listen-port=6800
rpc-secret=12345
rpc-max-request-size=10M
async-dns=true
async-dns-server=119.29.29.29,223.5.5.5,8.8.8.8,1.1.1.1
log=/root/downloads/main.log
log-level=info
console-log-level=notice
quiet=false
summary-interval=120
bt-tracker=udp://tracker.opentrackr.org:1337/announce,udp://open.tracker.cl:1337/announce
|
参考资料
特别鸣谢
无