Tutorial
Install Aria2c:
sudo apt install aria2c
and a web-based GUI: AriaNg
Create configuration files:
1
2
3mkdir ~/.aria2
touch ~/.aria2/aria2.session #用于保存日志
touch ~/.aria2/aria2.conf #创建配置文件A template for “aria2.conf” can be downloaded from aria2c.com. You should change the
dir
field to be download path, changeinput-file
andsave-session
to be the path ofaria2.session
.aria2.conf
doesn’t support environment variable, so everything is at best written in absolute path.Run Aria2c with this configuration:
aria2c --conf-path=/home/<username>/.aria2/aria2.conf
. It will remember this as its configuration file and use it to start the service from now on. We can also add argument-D
so Aria2c runs as daemon in the background. (Since the aria2c’s default configure file path is in~/.aria2/
, we don’t really need the--conf-path
argument; but use it to specify a conf path if you put it somewhere else)设置
aria2c
开机自动启动:编写脚本myStartUp.sh
并放入/etc/init.d/
. (Remember to change its privilege to everyone)1
2
3
4
5
#Short-Description: My Startup Services
aria2c -D --conf-path=/home/<username>/.aria2/aria2.confMore on Start Service on WSL startup, refer to this answer
Caution
On WSL, when you start aria2
service the first time, note: (full command means the above command with --conf-path
, but since our conf path is the same as default path, we can take )
- use the full command
aria2c --conf-path=/home/<username>/.aria2/aria2.conf
and don’t start it in the background with-D
. - start it immediately after Windows is booted, before you open anything else or tweak anything
Anything else than this full command or use this full command some time after Windows boot could cause problem. The problem is showing “Exception: [SocketCore.cc:312] errorCode=1 Failed to bind a socket, cause: Permission denied” even though no process is using port 6800. The reason for this problem is not clear.
After staring aria2
once with the full command, we can shut it down and then start it in the background with aria2c -D --conf-path=/home/<username>/.config/aria2/aria2.conf
. Now everything will work fine.