PDA

Bekijk de volledige versie : [HowTo] Aria2 Torrent, FTP, HTTP downloader with Webinterface



newbiefan
01-01-2012, 22:22
This howto describes howto install an excellent Linux-downloader with Torrent, FTP and HTTP capabilities and worldwide remote access.
Sometimes I missed a good downloadmanager for my router. Therefore I installed many different tools & apps in order to download different files. All of them worked fine, but they all have too much restrictions.
Then I found ARIA2 in our optware repository and some php-code called aria2web for a remote control of aria2.
There is some other code for a remote control out there, but far too complicated and too slow for a RT-N16.
A big advantage of aria2 is the very low needed cpu-resource and memory used for downloads. And it's ultrafast....
Disadvantages: You need Firefox on your Computer, with IE you have to tweak the php-code.
For IE, there are some suggestions for instance here: http://forum.synology.com/enu/viewtopic.php?f=38&t=26662

Tested with Webbrowser: Firefox, Iceweasel, Epiphany, Opera

Let's start........
Preconditions: RT-N16 or better (will run on a Wl500gP too, but slow)
Installation according Wengi's HowTo (http://wl500g.info/showthread.php?t=10307)
Installed and running lighttpd and PHP according WPTE's HowTo (http://wl500g.info/showthread.php?t=20306)
installed unzip on your router (or do a 'ipkg install unzip')
WinSCP

Aria2 is very easy to install, just adjust the line below with your download-folder as you like:

ipkg update
ipkg install aria2
mkdir -p /opt/var/log/aria2
mkdir -p /opt/etc/aria2
mkdir -p /tmp/mnt/disca_3/Downloads
touch /opt/etc/aria2/aria2.conf

vi /opt/etc/aria2/aria2.conf ###SWITCH TO INSERT MODE WITH 'i' ######
daemon=true
enable-rpc=true
rpc-listen-port=6800
rpc-listen-all=true
####### your download folder, ensure that this folder exist! ##########
dir=/tmp/mnt/disca_3/Downloads
#where is your logfile located
log=/opt/var/log/aria2/aria2.log
log-level=warn
dht-listen-port=6801
auto-save-interval=30
#seed ratio and seed time in minutes
seed-ratio=1.0
seed-time=1460
max-upload-limit=20K
event-poll=select
####end of file aria2.conf####
### Enter 'ESC' and ':wq' to store and leave vi ###


Consider, there are so many options - you can use much more when needed.
Here you can read more: http://linux.die.net/man/1/aria2c
And here you can find a Wiki: http://sourceforge.net/apps/trac/aria2/wiki

Now we start aria2 at every startup

touch /opt/etc/init.d/S85aria2
vi /opt/etc/init.d/S85aria2
###SWITCH TO INSERT MODE WITH 'i' ######
# For Olegs & Ily's FW for Asus Routers
# store this script in /opt/etc/init.d if you've installed optware

# Prgmname=/full_path/Prgmname
prgmname1="/opt/bin/aria2c"
shortname="aria2c"

#one option
options="--conf-path="

# configfile=/full_path/configfile
configfile="/opt/etc/aria2/aria2.conf"

start() {
# Code here to start the program
logger -t ARIA2C "Starting aria2c daemon "
${prgmname1} ${options}${configfile}
sleep 5
return 0
}

stop() {
# Code here to stop the program and check it's dead
if [ -n "`pidof $shortname`" ]; then
logger -t ARIA2C "Shutting down aria2c daemon "
/usr/bin/killall $shortname
sleep 5
fi
return 0
}
##########################start here##########################
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
logger -t ARIA2C "$shortname restart, executed from $(whoami)"
stop
sleep 2
start
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
esac
sleep 1
exit
#### end of file S85aria2 ####
### Enter 'ESC' and ':wq' to store and leave vi ###

chmod 755 /opt/etc/init.d/S85aria2
reboot


Well, if there is no command 'whoami' on your router, just remove the part above 'executed from $(whoami)'
Consider, when you change something of your /opt/etc/aria2/aria2.conf file you must enter a:

/opt/etc/init.d/S85aria2 restart

If you don't want to install a webinterface for some reason, you can install a remote gui for aria on your PC.
For instance: with a Wl500gP you can save resources - no lighttpd, no php aso is necessary to run aria2.
Just move ahead with the next post. Consider, you can install a webinterface and a remote_gui, provided you do not access aria2 at the same time.
Further, you have to configure your firewall as stated below. When an older FW is used with Kernel 2.4, use as Path /tmp/mntdisc0_3 instead of disca_3

Now we install the webinterface-part: (assumed, that your webservers document root is /opt/share/www)

wget http://sourceforge.net/projects/aria2web/files/latest/download
mkdir -p /opt/share/www/aria2web
unzip Aria2Web_0.1.zip -d /opt/share/www/aria2web
rm /opt/share/www/aria2web/config.php
touch /opt/share/www/aria2web/config.php
vi /opt/share/www/aria2web/config.php ###SWITCH TO INSERT MODE WITH 'i' ######
<?php
/**
* @version $Id: config.php 8 2010-01-21 16:05:04Z soeren_nb $
* @package aria2web
* @copyright Copyright (C) 2010 soeren. All rights reserved.
* @license GNU/GPL, see LICENSE.php
* Aria2Web is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* http://sourceforge.net/projects/aria2web/
*/
defined( '_ARIA2WEB' ) or die();
// to run Aria2web in "local" mode means it's installed on the same machine as aria2, so we can start the aria2c executable through PHP
// when Aria2web is run in "web" mode, it's assumed that it's installed on a different machine and won't (be able to) start the aria2c executable
$aria2_mode = 'web';
$aria2_xmlrpc_host = 'localhost';
$aria2_xmlrpc_uripath = '/rpc';

$aria2_executable = '/opt/bin/aria2c'; // Location of the aria2c executable
$aria2_parameters = array();

// If aria2web is in local mode, it will try to start aria2c in XMl-RPC mode using the following additional parameters
$aria2_parameters['xml_rpc_listen_port'] = 6800;
$aria2_parameters['xml_rpc_username'] = '';
$aria2_parameters['xml_rpc_password'] = '';
$aria2_parameters['xml_rpc_listen_all'] = 'true';
$aria2_parameters['dir'] = '/tmp/mnt/disca_3/Downloads'; // The directory to store the downloaded file.
$aria2_parameters['log'] = '/opt/var/log/aria2/aria2.log'; // The location of the log file.
$aria2_parameters['http_user']= ''; //Set HTTP user. This affects all URLs.
$aria2_parameters['http_passwd']= '';//Set HTTP password. This affects all URLs.
$aria2_parameters['load_cookies']= ''; //Load Cookies from FILE using the Firefox3 format (SQLite3) and the Mozilla/Firefox(1.x/2.x)/Netscape format.
$aria2_parameters['user_agent']= ''; //Set user agent for HTTP(S) downloads. Default: aria2/$VERSION, $VERSION is replaced by package version.

?>

Enter 'ESC' and ':wq' to store and leave vi

Well, that's it - start your Firefox-browser and enter: http://ip.of.your.asus/aria2web
When you can see your aria2web-interface, you can configure your firewall
Now the firewall: (open the ports below)
The port numbers that aria2 uses by default are 6881-6999 and 6801 (dht) for TCP and UDP
(and port 6800 for xml_rpc for external Remote Control - when needed you should read/set a rtc-user&passwd)

Now the last step - we have to protect directory 'aria2web' of your webservers document root.

touch /opt/etc/htpassw

vi /opt/etc/htpassw ###SWITCH TO INSERT MODE WITH 'i' ######
myusername:mypassword

Enter 'ESC' and ':wq' to store and leave vi

Now only one thing remains, we have to tell lighhtpd to use a password for your aria2web directory.


vi /opt/etc/lighttpd/lighttpd.conf
and activate the "mod_auth" by removing the comment sign '#'
Further, at the end of the lighttpd.conf you have to insert this:

##################################authentification for directories####################################
auth.debug = 2
auth.backend = "plain"
auth.backend.plain.userfile = "/opt/etc/htpassw"
auth.require = (
"/aria2web/" => ("method" => "basic", "realm" => "Password protected area of aria2", "require" => "user=myusername")
)
################################################## ################################################## #####

# Configuration from other optware packages
include_shell "cat /opt/etc/lighttpd/conf.d/*.conf"
Enter 'ESC' and ':wq' to store and leave vi
Restart your webserver:

/opt/etc/init.d/S80lighttpd restart

References:
http://aria2.sourceforge.net/README.html
http://aria2.sourceforge.net/aria2c.1.html
http://sourceforge.net/apps/trac/aria2/wiki/UsageExample
https://github.com/tomhennigan/arial
http://martin-achern.de/wgetgui/aria2gui.html

Well, thats all so far - enjoy!!
Below you can find a screenshot.....
Any kind of improvements, suggestions aso. are greatly appreciated.
Newbiefan

newbiefan
02-01-2012, 00:59
Download from here: http://sourceforge.net/projects/aria2cremote/files/unstable/0.1.0/Aria2cRemoteControl-0.1.0b1-win32.exe/download

Install it and enter your hostname, port, user and password in menu 'tools' and 'option'

If necessary set a rpc-user and password in your aria2.conf file, just for security reasons.

Below you can find a screenshot.

Newbiefan

!gm
02-01-2012, 03:21
wow

thanks for that!

I'll give it a try

sass
02-01-2012, 19:55
when I enter

/opt/etc/init.d/S85aria2 restart
I get the following error:

-sh: /opt/etc/init.d/S85aria2: Permission denied

what am I doing wrong?

newbiefan
02-01-2012, 20:05
when I enter

/opt/etc/init.d/S85aria2 restart
I get the following error:

-sh: /opt/etc/init.d/S85aria2: Permission denied

what am I doing wrong?

Well, nothing is wrong. I guess you've forgotten to issue a

chmod 755 /opt/etc/init.d/S85aria2

(Look at the end of the part with vi /opt/etc/init.d/S85aria2)
In case you are not root or admin, set S85aria2 to 777

Have fun
Newbiefan

msj33
10-01-2012, 19:53
looks nice

Will it on an older wl500g deluxe?

Any torrent RSS feed support with filtering?

newbiefan
10-01-2012, 23:07
looks nice

Will it on an older wl500g deluxe?

Any torrent RSS feed support with filtering?

1.) Well, I do not own a wl500g deluxe, but I would say yes, it should work as long as you use just aria2c and win32-remote-control software. Do not install any extra webserver. Further use the aria2.conf below. In case you run into troubles, decrease the var max-concurrent-downloads to 3 (default is 5).
When you still run out of memory decrease a bit vars bt-max-peers and bt-max-open-files. I strongly suggest to read the manual of aria2.
Further do a:

mkdir -p /opt/var/run/aria2c
touch /opt/var/run/aria2c/aria2c

Consider, all vars with limits are valid for a approx. 2Mbit line (Inet-Connection). Your aria2.conf file

daemon=true
enable-rpc=true
rpc-listen-port=6800
rpc-listen-all=true
rpc-user=myuser
rpc-passwd=mypassword
dir=/tmp/mnt/disc0_3/Downloads
log=/opt/var/log/aria2/aria2.log
log-level=warn
enable-dht=true
dht-listen-port=6801
dht-file-path=/opt/var/run/aria2c/aria2c
auto-save-interval=30
max-concurrent-downloads=3
lowest-speed-limit=1K
max-overall-upload-limit=10K
max-upload-limit=5K
max-overall-download-limit=150K
max-download-limit=40K
bt-max-peers=25
bt-max-open-files=50
bt-request-peer-speed-limit=1K
seed-ratio=1.0
seed-time=1460
event-poll=select

2.)To my best knowledge aria2c is not able to handle a torrent RSS feed support with filtering. But I've to tell you that I do not know it exactly, because I do not use it. So you have to google for it.....:p - sorry.

FYI: it runs on a wl500gp without any problem, using aria2.conf above without aria2web.

Edit: I forgot to say that disca_3 (kernel 2.6.x) means disc0_3 with kernel 2.4.x

Have fun

aegisrtcw
08-04-2012, 15:24
Aria.conf


daemon=true
enable-rpc=true
rpc-listen-port=6800
rpc-listen-all=true
rpc-user=myuser
rpc-passwd=mypassword
dir=/tmp/mnt/disc0_3/Downloads
log=/opt/var/log/aria2/aria2.log
log-level=warn
enable-dht=true
dht-listen-port=6801
dht-file-path=/opt/var/run/aria2c/aria2c
auto-save-interval=30
max-concurrent-downloads=3
lowest-speed-limit=1K
max-overall-upload-limit=10K
max-upload-limit=5K
max-overall-download-limit=150K
max-download-limit=40K
bt-max-peers=25
bt-max-open-files=50
bt-request-peer-speed-limit=1K
seed-ratio=1.0
seed-time=1460
event-poll=select

And use cmd "/opt/etc/init.d/S85aria2 start or restart"


SD2012-04-08 15:30:12.135285 ERROR - [HttpListenCommand.cc:115]IPv6 RPC: failed to bind port 6800
Exception: [SocketCore.cc:305] errorCode=1 Failed to bind a socket, cause: Protocol not available
2012-04-08 15:30:12.222821 WARN - [MultiUrlRequestInfo.cc:231]Don't change system time while aria2c is running. Doing this may make aria2c hang for long time.

Thank you for your help

newbiefan
08-04-2012, 17:03
SD2012-04-08 15:30:12.135285 ERROR - [HttpListenCommand.cc:115]IPv6 RPC: failed to bind port 6800
Exception: [SocketCore.cc:305] errorCode=1 Failed to bind a socket, cause: Protocol not available
2012-04-08 15:30:12.222821 WARN - [MultiUrlRequestInfo.cc:231]Don't change system time while aria2c is running. Doing this may make aria2c hang for long time.


Well, I do not know exactly which kind of problem you have, so I just guess.

Write to aria2.conf your IPv6 address:

dht-listen-addr6=ADDR
Specify address to bind socket for IPv6 DHT. It should be a global unicast IPv6 address of the host.
( Taken from: http://aria2.sourceforge.net/aria2c.1.html )
The last line is just a warning.

HTH
Newbiefan

LiC
27-10-2012, 21:55
Tracked down the problem, it was the PHP function DL was not enabled. Dl was trying to load the XMLRPC extension.

Solution 1.

In the PHP.INI set enable_dl On
and also check the safe mode, I think it needs to be off.

or Solution 2.

Enable the XMLRPC extension yourself.

Windows: uncomment ;extension=php_xmlrpc.dll

Ubuntu: (install it in /usr/lib/php5/ ... 20101010? )
sudo apt-get install php5-xmlrpc
sudo /etc/init.d/apache2 restart

Hope this helps someone.

patel21
06-07-2013, 09:05
Will it work on Asus rt n13u with DD-wrt installed,

I am using transmission right now, but it only works with torrent, but I want to use aria2 for its http, ftp features.

Is it possible to install aria2 on dd-wrt.

newbiefan
07-07-2013, 00:16
Will it work on Asus rt n13u with DD-wrt installed,

I am using transmission right now, but it only works with torrent, but I want to use aria2 for its http, ftp features.

Is it possible to install aria2 on dd-wrt.

Yes, it is possible due to the fact, that aria2 is available as optware for ddwrt.
Even aria2web should work, provided that lighttpd/PHP aso. is installed.
In any case you can use aria2 with remote control.

have fun
newbiefan

patel21
12-07-2013, 14:05
Yes, it is possible due to the fact, that aria2 is available as optware for ddwrt.
Even aria2web should work, provided that lighttpd/PHP aso. is installed.
In any case you can use aria2 with remote control.

have fun
newbiefan

Thanks, I tried the steps written in his post, and also configured the settings file as mentioned here, after that

I tried that command to start aria2 "service aria2 start", and it shows that it isn't installed, but then I cannot start it from service, nor could I see it listed in service list. Please can you share whats the proper steps to follow for installing it on dd-wrt

newbiefan
12-07-2013, 21:32
Thanks, I tried the steps written in his post, and also configured the settings file as mentioned here, after that

I tried that command to start aria2 "service aria2 start", and it shows that it isn't installed, but then I cannot start it from service, nor could I see it listed in service list. Please can you share whats the proper steps to follow for installing it on dd-wrt

Well, do a "ls -a /opt/etc/init.d" and post the result.

I do not know ddwrt exactly, but it should work the same way, provided you have installed optware.
When you know what you are doing, please do a "cat" of your aria startfile and post it.
In any case I suggest to read before any installation: http://www.dd-wrt.com/wiki/index.php/Optware,_the_Right_Way

have fun

sairy
28-07-2014, 04:47
Hi, I already installed the Aria2 in my Buffalo NAS LS421 using your guide. The webinterface did not work but I use the WebUI from here: https://github.com/ziahamza/webui-aria2 and it works. But I cannot use remote the Aria2 throught Aria2c Remote Control. Can you help me? I try a lot but no lucks.
Here is my aria2.conf configs:

daemon=true
dir=/mnt/array1/share
max-connection-per-server=16
enable-rpc=true
rpc-user=admin
rpc-passwd=admin
rpc-listen-all=true
rpc-port-all=true
log=/opt/var/log/aria2/aria2.log
log-level=warn
auto-save-interval=30
event-poll=poll
# other options to your choise here
enable-xml-rpc=true //I got some helps to tell me just enable xml-rpc to use the remote but it do no work
xml-rpc-listen-port=6818 //I used the different port but it could not be log in to the remote
#xml-rpc-user=admin
#xml-rpc-passwd=password
xml-rpc-listen-all=true
xml-rpc-port-all=true

And here some screenshot:
Note: the port I used is 6818 not 6800, I try 6800 but it does not work.
9853

9854

Thank you so much.

newbiefan
01-08-2014, 21:17
I cannot use remote the Aria2 throught Aria2c Remote Control. Can you help me? I try a lot but no lucks.

Welcome!
I suggest to start with my config file, without rpc password at first.
Later, you can test more - and remove any wrong entry (provided you change not too much at once).

I use aria2web, it is easier to install and works well. Further it is easy to protect any access to this directory via webserver.

HTH
Newbiefan

sairy
05-08-2014, 06:51
Welcome!
I suggest to start with my config file, without rpc password at first.
Later, you can test more - and remove any wrong entry (provided you change not too much at once).

I use aria2web, it is easier to install and works well. Further it is easy to protect any access to this directory via webserver.

HTH
Newbiefan

Thanks for reply. I try with your guide, not modify anything. I remove rpc password but no luck for me. :D
Do you have any advices?

newbiefan
08-08-2014, 08:53
Thanks for reply. I try with your guide, not modify anything. I remove rpc password but no luck for me. :D
Do you have any advices?

Well, in the past, there have been a lot of faults after a new software-release. Maybe you can find an older release of aria for your machine.
So far, this is the only idea which I have right now.

HTH
Newbiefan

sairy
09-08-2014, 19:07
Well, in the past, there have been a lot of faults after a new software-release. Maybe you can find an older release of aria for your machine.
So far, this is the only idea which I have right now.

HTH
Newbiefan

Thanks, do you have an older release of aria? I cannot found any release on the internet. They have only the newest one.

newbiefan
10-08-2014, 11:55
Thanks, do you have an older release of aria? I cannot found any release on the internet. They have only the newest one.

I'm sorry - I have an older entware repo stored on my webserver http://www.myasus.eu/entware, but this doesn't help you, because it's just for Entware.

Newbiefan