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/viewto...p?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
Installed and running lighttpd and PHP according WPTE's HowTo
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:
Code:
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
Code:
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:
Code:
/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)
Code:
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.
Code:
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.
Code:
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:
Code:
##################################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:
Code:
/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/ari...i/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