Skip to content

Instantly share code, notes, and snippets.

@Nerten
Last active June 2, 2017 03:40
Show Gist options
  • Save Nerten/399257dba4c36393c063 to your computer and use it in GitHub Desktop.
Save Nerten/399257dba4c36393c063 to your computer and use it in GitHub Desktop.
Aria2c + webui-aria2 to Ubuntu on Odroid-C1
sudo apt-get install -y aria2
sudo mkdir /etc/aria2
sudo touch /etc/aria2/aria2.session
sudo bash -c "cat <<EOT > /etc/aria2/aria2.conf
daemon=true
continue=true
enable-rpc=true
rpc-listen-port=6800
rpc-listen-all=true
check-certificate=false
auto-file-renaming=false
allow-overwrite=true
dir=/var/run/usbmount/Media/Downloads/
rpc-user=aria2
rpc-passwd=aria2
file-allocation=none
disable-ipv6=true
max-download-limit=0
max-overall-download-limit=0
max-concurrent-downloads=1
max-connection-per-server=4
log=/var/log/aria2.log
log-level=error
summary-interval=120
timeout=600
retry-wait=30
max-tries=50
save-session=/etc/aria2/aria2.session
input-file=etc/aria2/aria2.session
save-session-interval=10
disk-cache=25M
EOT"
sudo bash -c "cat <<EOT > /etc/init/aria2.conf
# aria2 - service job file
description \"aria2\"
author \"http://aria2.sourceforge.net/\"
# When to start the service
start on runlevel [2345]
# When to stop the service
stop on runlevel [016]
# Automatically restart process if crashed
respawn
# Sets nice and ionice level for job
nice -5
# What to execute
script
aria2c --conf-path=/etc/aria2/aria2.conf
end script
EOT"
sudo service aria2 start
sudo apt-get install -y nginx
mkdir /tmp/webui
wget -P /tmp/webui/ https://github.com/ziahamza/webui-aria2/archive/master.zip
unzip /tmp/webui/master.zip -d /tmp/webui/
sudo mv /tmp/webui/webui-aria2-master /usr/share/nginx/html/aria2
rm -rf /tmp/webui
@Efreak
Copy link

Efreak commented Mar 15, 2015

'service aria2 stop' etc does not work. Probably not a problem, except when I'm trying to figure out why setuid/setgid doesn't want to work in upstart.

I've tried swapping the paths to a local user (/home/aria2/... instead of /etc/aria2/...) and adding setuid aria2, setgid aria2 to aria2.conf, but the logfile shows that it's already been bound, then the process crashes repeatedly. Any ideas here? I haven't been able to make this work at all, but I know it's possible (I did get calibre to run under another user, but that's in /etc/init.d, not upstart, which I'd prefer)

You might also consider (so you don't need to edit the file afterwards...)

read -e -i "aria2" -p "Username? " ariauser
read -e -i "aria2" -p "Password? " ariapass
echo rpc-user=$ariauser >> /etc/aria2/aria2.conf
echo rpc-passwd=$ariapass >> /etc/aria2/aria2.conf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment