Results 1 to 15 of 20

Thread: [HowTo] Aria2 Torrent, FTP, HTTP downloader with Webinterface

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2007
    Location
    Austria
    Posts
    1,336

    Lightbulb [HowTo] Aria2 Torrent, FTP, HTTP downloader with Webinterface

    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
    Attached Images Attached Images  
    Last edited by newbiefan; 07-01-2012 at 08:45.
    Alle HowTo's, all howto's

    RT-N16 1.9.2.7-rtn-r3121, Samba, VSFTP, Lightthpd, PHP, Perl, MySQL, Serendipity, Aria2web, HDD 640GB
    RT-N66U, 16GB MicroSD/ 2 Partitions, 2,5" HDD 1TB, running with Merlin's FW and Entware, 16 Mbit A1,
    Netgear DGND 3700V2, QNAP TS119PII 4 TB, QNAP TS209 2 TB Raid1, Backup Synology DS107+ 1 TB, HP CP1515n

Similar Threads

  1. Менеджер закачек с веб-мордой на основе aria2
    By ABATAPA in forum Russian Discussion - РУССКИЙ (RU)
    Replies: 60
    Last Post: 29-12-2014, 10:10
  2. udpxy - udp->http IPTV прокси
    By _oz_ in forum Russian Discussion - РУССКИЙ (RU)
    Replies: 721
    Last Post: 22-10-2014, 18:46
  3. [HowTo]Aria2 Torrent, FTP, HTTP mit Remote Control
    By newbiefan in forum German Discussion - Deutsch (DE)
    Replies: 3
    Last Post: 08-01-2012, 19:15
  4. Вопрос насчет Torrent
    By arik in forum Russian Discussion - РУССКИЙ (RU)
    Replies: 1243
    Last Post: 04-10-2011, 23:29
  5. httptunnel - http тунелирование на роутере
    By Ujeen in forum Russian Discussion - РУССКИЙ (RU)
    Replies: 52
    Last Post: 08-02-2011, 18:03

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •