QNAPWare to get Aria2 on a QNAP
As usual, we need to go get us some files to install Aria2 and after that the WebUI-Aria2 “applications”.
For installing Aria2, we will use and install “QNAPWare” as well.
QNAPWare looks like a promising successor of the, already for years, dormant OptWare.
Let’s start with that, QNAPWare, as we will need it to install Aria2.
Keep in mind that QNAPWare can be seen as a OptWare replacement, but in the end is not quite that [yet]. So don’t just randomly thtow OptWare of your QNAP! You can leave, and probably should, OptWare installed, they can both live on the same system.
If you’re interested, there is this huge list (1700+) of packages available through QNAPWare.
The recommended way to get QNAPWare:
QNAPWare (at the moment) can be found only be found QNAP Forum post or the QNAP Community webpage. In the (near?) future, you might find it in the “App Center” of your QNAP as well, but this is not the case yet at the time of this writing.
You could of course download the version from Tweaking4All, but keep in mind that it might be a horribly outdated version, and … Make sure you pick the right one. Since my QNAP is an x86 based model, I have not been able to test the ARM version.
Download - Qnapware (Intel)
Download - Qnapware (Arm)
For now we need to manually install QNAPWare through the “App Center“.
Go to the web interface of your QNAP and open “App Center“.
Click the “Install Manually” button.
![QNAP App Center - Install Manually](//www.tweaking4all.com/wp-content/uploads/2015/09/qnap-appcenter-install-manually-800x202.jpg)
QNAP App Center – Install Manually
A file dialog will open, where you click the “Browse…” button, and select the download QNAPWare QPKG (in case this is a ZIP file, unzip it first, you need the “.qpkg” file). Click “Open“, click “Install“, click “OK“, wait a few seconds for the QNAP to install the file, click “OK” and finally click “Close“.
That’s all there is to it to install QNAPWare, it should appear under “My Apps” now … and you’ll notice that it’s “ON” but that it’s lacking a web interface (there is no “Open” button). Hopefully they will add that in the future, because for now we will have to go into the QNAP through SSH.
![QNAP - OptWare and QNAPWare side by side](//www.tweaking4all.com/wp-content/uploads/2015/10/qnap-optware-and-qnapware.jpg)
QNAP – OptWare and QNAPWare side by side
To be able to access your QNAP through SSH, you will need to make sure SSH is enabled on your QNAP (see the SSH article for more details).
Installing Aria2, the command line download tool, on your QNAP
The next step is to install Aria2. For this, like I just said, we need to use SSH to get into our QNAP.
Before we install Aria2 though, we should give QNAPWare an update, by using the “opkg” statement. This is pretty common practice with similar other Linux Package Managers – update the manager before installing anything.
The application “opkg” works similar to “ipkg”, which you might, or might not, be familiar with from OptWare. So be aware,… it’s “opkg” … with an “o”.
Which should return something like this:
Downloading http://qnapware.zyxmon.org/binaries-x86/Packages.gz.
Updated list of available packages in /Apps/opt/var/opkg-lists/packages.
If you had SSH open while installing QNAPWare …
I ran into this myself, I had SSH open while I was installing QNAPWare and guess what … “opkg update” did not work … my QNAP could not find “opkg”.
To remedy this: close your SSH connect and reconnect SSH to your QNAP, now it will work.
The next step is to install Aria2 (you can find it in this list (x86/Intel) or this list (ARM)):
which will install Aria2 and additionally needed packages (the so called “dependencies”) and will result in something like this:
Installing aria2 (1.18.7-1a) to root...
Downloading http://qnapware.zyxmon.org/binaries-x86/aria2_1.18.7-1a_qnapx86.ipk.
Installing zlib (1.2.8-1) to root...
Downloading http://qnapware.zyxmon.org/binaries-x86/zlib_1.2.8-1_qnapx86.ipk.
Installing libxml2 (2.9.2-3) to root...
Downloading http://qnapware.zyxmon.org/binaries-x86/libxml2_2.9.2-3_qnapx86.ipk.
Installing libopenssl (1.0.2d-1) to root...
Downloading http://qnapware.zyxmon.org/binaries-x86/libopenssl_1.0.2d-1_qnapx86.ipk.
Configuring zlib.
Configuring libxml2.
Configuring libopenssl.
Configuring aria2.
Aria2 is now installed, you can test it by typing “ aria2c -v
” in your SSH shell:
aria2c -v
aria2 version 1.18.7
Copyright (C) 2006, 2014 Tatsuhiro Tsujikawa
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
** Configuration **
Enabled Features: BitTorrent, GZip, HTTPS, Message Digest, Metalink, XML-RPC
Hash Algorithms: sha-1, sha-224, sha-256, sha-384, sha-512, md5
Libraries: zlib/1.2.8 libxml2/2.9.2 OpenSSL/1.0.2d
Compiler: gcc 4.8.3
built by i486-pc-linux-gnu
targetting i686-openwrt-linux-gnu
on Aug 1 2015 14:27:55
System: Linux 3.4.6 #1 SMP Thu Sep 10 05:35:09 CST 2015 x86_64
Report bugs to https://github.com/tatsuhiro-t/aria2/issues
Visit http://aria2.sourceforge.net/
Aria2 workss, so let’s make a destination where Aria2 can dump it’s downloads, for example a directory in the “Download” share of your QNAP.
1 2
| cd /share/Download/
mkdir Aria2 |
The actual location will be something like “/share/MD0_DATA/Download“, but the “MDO_DATA” can be different on your QNAP, so that’s why I used the linked version.
Now if we want to start Aria2, manually, and keep it in the background we would need to do something like this:
aria2c --enable-rpc=true --rpc-listen-all=true --rpc-allow-origin-all --dir=/share/Download/Aria2 --file-allocation=none -s 5 -j 3 -x 5 -c -D
That is one single line!
Some explanation on what this does (see also the Aria2 Manual, or type “ aria2c -h
” in your SSH shell):
Aria2 Starting Parameters
Parameter |
Purpose |
–enable-rpc=true |
Enable JSON-RPC/XML-RPC server |
–rpc-listen-all=true |
Listen incoming JSON-RPC/XML-RPC requests on all network interfaces. |
–rpc-allow-origin-all |
Add Access-Control-Allow-Origin header field with value * to the RPC response. |
–dir=/share/Download/Aria2 |
Here we set the destination directory for our downloads (the dir we just made). |
–file-allocation=none |
Specifies if file space is allocated or not.
It seems the best choice to set this to “none” on a QNAP. |
-s 5 |
This means that we want Aria2 to split a download in 5 segments.
Meaning: 5 download “streams” in parallel. |
-j 3 |
Here we say that we can have only 3 concurrent downloads at a time.
So that means 15 “streams” in parallel if we spilt files in 5 segments. |
-x 5 |
Aria2 should not have more than 5 connections to the same server. |
-c |
We allow resuming a download incase it got stopped in between. |
-D |
Make Aria2 run as a Daemon. |
Note that I’m no expert on the RPC part, I copied what was suggested elsewhere.
Any better recommendation are most welcome, please post them in the Comments below.
Note : Most of these settings can be modified/done in the web-interface as well.
To (brutally) stop the Aria2 daemon, you can use – I could not find a “cleaner” method:
Make Aria2 Automatically Startup at QNAP boot
QNAP offers several methods to make something start automatically at boot.
I prefer the .QPKG method described in the QNAP Wiki. Feel free to use any method you like, or maybe even just start it manually when needed.
These are the steps I took, in SSH:
nano /etc/config/qpkg.conf
At the end of this file add something like the code below. The paths used will be created once we have edited this.
1 2 3 4 5 6 7 8
| [Aria2]
Name = Aria2
Version = 0.9
Author = zyxmon
Date = 2015-01-02
Shell = /share/MD0_DATA/.qpkg/Aria2/autorun.sh
Install_Path = /share/MD0_DATA/.qpkg/Aria2
Enable = TRUE |
When done adding this text, press CTRL+X, type “Y” and finally press ENTER, so the changes will be saved.
Next step is to create the directory we just entered in the qpkg.conf file:
mkdir /share/MD0_DATA/.qpkg/Aria2
And create the “autorun.sh” file:
nano /share/MD0_DATA/.qpkg/Aria2/autorun.sh
We should enter something like this (please keep in mind that I’m not a shell or qpkg expert, improvements are most welcome), which will start Aria2 as a Daemon:
1 2 3
| #!/bin/sh
aria2c --enable-rpc=true --rpc-listen-all=true --rpc-allow-origin-all --dir=/share/Download/Aria2 --file-allocation=none -s 5 -j 3 -x 5 -c -D |
Make sure that second line (aria2c) is ONE LINE. Pasting this in Nano might break the line, so pay attention to that.
Press CTRL+X, type “Y” and press ENTER to save the file and close Nano.
Autorun tip …
I have found that in some configurations the autorun fails because it cannot find “aria2c”.
In that case change “aria2
” to “<span class="s1">/Apps/opt/bin/aria2c
” in to autorun.sh.
Another issue you might run into, is that the “/Apps” directory does not seem to exists at startup – wait a few minutes until it re-appears.
I unfortunately do not have a proper workaround for that one … yet.
This scrip will be used to start Aria2, so it needs to be made executable:
chmod +x /share/MD0_DATA/.qpkg/Aria2/autorun.sh
You can test the script now. First kill Aria2 in case it was running as a daemon (killall aria2c
), and then run this script from the command line:
/share/MD0_DATA/.qpkg/Aria2/autorun.sh
If no errors occurred, then you can us “ps” and “grep” to check if it’s running. If you see only one line (grep aria – like the last line in the example below) then Aria2 is NOT running. Please check the script!
1 2 3 4
| # ps -ax | grep aria
831 admin 2296 S aria2c --enable-rpc --rpc-listen-all=true --rpc-allow
837 admin 280 S grep aria |
As of now, Aria2 will automatically start when you boot up your QNAP.
Installing WebUI-Aria2 for your QNAP
Having Aria2 is all nice and dandy, but we all like to have a slick looking web-interface for it. In daily use you’d probably not want to go through SSH and manually type all that is needed.
Tip : Technically we would not need the web-interface. The Google Chrome AddOn discussed below would do some of the basic functions just fine. The web-interface however can be practical to do some of the more advanced settings.
Recommended: So we need to go get the WebUI-Aria2 from GitHub: Go to this GitHub link and click the “Download” button on the right.
You can do all this directly in your SSH shell:
1 2 3 4 5
| cd /share/Web
wget https://github.com/ziahamza/webui-aria2/archive/master.tar.gz --no-check-certificate
tar xpvf master.tar.gz
rm master.tar.gz
mv webui-aria2-master aria2 |
You now have a directory called “aria2” in your “/share/Web” directory.
Not recommended, but alternatively, you can get the potentially outdated file from Tweaking4All:
Opening Aria2 WebUI for the first time
Now that Aria2 is installed and a suitable web-interface for it, time to open it for the first time.
Web Server MUST be running on your QNAP
Just to make sure, check if the “Web Server” on your QNAP is enabled.
Go o “Control Panel” on your QNAP, select “Applications” “Web Server” and make sure “Enable Web Server” is check, preferably with port “80”, and click “Apply“.
Open a browser and type http://<ip of your QNAP>/aria2/
.
For my setup this would be: http://192.168.1.100/aria2/
Note : If you did use a different port number, other than the default port 80, for example “81”, then you will need to add this to the link (port 80 does not need this): http://<ip of your QNAP>:81/aria2/
You can now do some optional settings, under the “settings” menu option, but I’d try downloading a random file first, just to see if it works.
![Aria2 WebUI on a QNAP!](//www.tweaking4all.com/wp-content/uploads/2015/10/qnap-aria2-webui-800x272.jpg)
Aria2 WebUI on a QNAP!
Let’s add a test download, if you’re looking for test files, just grab a Linux distro somewhere, or something else that is relatively big, or get one of the files at ThinkBroadBand (specifically for test purposes).
Click the “Add” button, and click “By URIs“, so we can paste one or more links:
![Aria2 - Let's add a file](//www.tweaking4all.com/wp-content/uploads/2015/10/qnap-aria2-add.jpg)
Aria2 – Let’s add a file
A new window opens, where we can dump one or more URL of a file we would like to download. Simply paste them in the red box.
If you decide to add multiple links,…
- If you want to keep multiple files “grouped”, add a space between the URLs.
- If you want them to appear as individual files, then use a separate line for each link.
Click “Start” when you’re good to go.
![Aria2 - Add one or more links for download](//www.tweaking4all.com/wp-content/uploads/2015/10/qnap-aria2-add-links.jpg)
Aria2 – Add one or more links for download
In my example I used http://ipv4.download.thinkbroadband.com/512MB.zip.
![Aria2 on my QNAP, downloading the test file](//www.tweaking4all.com/wp-content/uploads/2015/10/qnap-aria2-downloading-http-800x136.jpg)
Aria2 on my QNAP, downloading the test file
There is plenty more to explore when it comes to Aria2 and it’s web-interface.
So far I can say that I’m very happy with the performance (on par with NZBGet speeds!)
I have yet to test Torrents (which I don’t really like to use anyway).
Please feel free to post your findings below in the comment section.
Browser Extension to make things easier …
No, personally I’m not fond of manually figuring out an URL and copy and pasting them in yet another web-interface, so I went looking for a tool that could help me, … and I found such a tool … Aria2c Integration, a Google Chrome addon.
First step is to install the addon the usual “Chrome” way, through this link.
Next step is to right click the icon in your Google Chrome toolbar and choose the option “options“.
![Aria2c Integration - Options page](//www.tweaking4all.com/wp-content/uploads/2015/10/google-chrome-aria2c-options-800x263.jpg)
Aria2c Integration – Options page
In the field “JSON-RPC Path” you will have to match the IP address with the IP address of your QNAP. In my case that would be 192.168.1.100, as you can see in the image above. So replace 192.168.1.100 with the IP of your QNAP and that’s all you have to do …
The link will look something like this: http://<QNAP IP address>:6800/jsonrpc
Now when we see a file in our browser that we would like to download, simply right click the link and choose “Download with aria2” to add the file to the Queue of Aria2, and download will start automatically.
![Select "Download with Aria2"](//www.tweaking4all.com/wp-content/uploads/2015/10/google-chrome-download-with-aria2.jpg)
Select “Download with Aria2”
Which we can see below where I’ve opened the popup of the “Aria2c Integration” while having the WebUI-Aria2 open, so we can see what’s happening:
![Chrome Add on and WebUI at the same time](//www.tweaking4all.com/wp-content/uploads/2015/10/google-chrome-aria2c-downloading-800x186.jpg)
Chrome Add on and WebUI at the same time
I’m sure there are more extensions that support Aria2,… again, feel free to post suggest and ideas, tweaking idea, better settings, etc.
Tip: Auto Download …
If you look at the “Capture” settings in the “Aria2c Integration” settings, the you’ll see that you can set the file size for when it should auto capture a link you click. I’ve set the “File Size >=” field to 10M on mine, and it works SLICK!
Removing Aria2 from your QNAP
If there is anything that annoys the heck out of me, then it is that when I want to try something, and it didn’t work out, but proves to be a b*tch to remove it.
If you installed Aria2 as described in this article, then removal shouldn’t be too hard:
- Remove the download folder (
rm -f /share/Download/Aria2
),
- Stop Aria2 runnings as a Daemon (
killall aria2c
),
- Remove the web-interface (
rm -rf /share/Web/aria2
),
- Uninstall Aria2 (
opkg remove aria2
),
- Remove the Aria2 lines from /etc/config/qpkg.conf (
nano /etc/config/qpkg.conf
),
- Remove the dummy QPKG folder (
rm -f /share/MD0_DATA/.qpkg/Aria2
)
If you’d like, you can remove QNAPWare throught the “App Center” as well, although it will very likely be useful in the future …
Comments
There are 13 comments. You can read them below.
You can post your own comments by using the form below, or reply to existing comments by using the "Reply" button.
Nice! Works as advertised!
John
Firefox users seem to be out of luck when it comes to an extension to submit things to aria2. Have you considered adding some lines to have aria2 monitor a folder for torrents? This could possibly be accomplished via a crontab entry of some sort that ran a shell script which would check the folder, feed the torrent to aria2 if present and then move it to a “processed” folder afterward so it would not trigger again.
Doing that would allow any of the many apps that support “black hole” folders to use aria for the downloading of torrents such as couch potato, sickrage etc.
Rudi Pittman
Hi Rudi,
thanks for the heads up!
I’m not a FireFox user … so I didn’t test that – are there no plugins for FireFox that support Aria2?
I did see that Flashgot mentions that it supports Aria, but I have not tested this. An old forum post (2008) talks about this as well – so I’d assume this might work (link).
Adding a blackhole isn’t a bad idea! I’m not a Torrent user, but I can see it being practical.
One could make a script that checks a folder, and if a torrent is found, add it. (see Aria2 documentation)
Unfortunately, I’m not a Torrent expert, but there are a boat load of options for Aria2 (link).
Maybe one or the other script writer, or the developer of Aria2 would like to help out with that.
Note: it seems that a request has been made with the developer of Aria2 way back in 2009 (link), I’m curious if that has been picked up or not …
hans
You may also find this of interest since it would save downloads that error’d out or were interrupted by the system running aria rebooting or shutting down then restarts them when aria2 comes back up.
Rudi Pittman
Oh! That sounds interesting! Thanks for the tip!
I’m currently traveling, so I won’t be able to test this until I get home (mid Januari).
But I most certainly will …!
hans
Modified autorun.sh [2nd line is all 1 really long line]:
Rudi Pittman
Awesome! Thanks Rudi!
hans
The following location can be saved in a bookmarklet which will open the aria2 webui in a new browser tab/window. In firefox right click the bookmark bar and pick “New Bookmark” then give it a name such as “Aria2 WebUI” and paste the following into the location line. Make sure you alter the ip address to the one YOUR nas is on.
javascript:void(window.open(‘http://192.168.3.119/aria2/’));
Rudi Pittman
Oh that’s actually a good one … I always right click the bookmark in the “bookmarks bar” of Chrome.
.
I should try your trick! Saves me juggling the mouse buttons on my laptop
hans
I finally decided just to make it a normal bookmark but check the “Open in sidebar” option in bookmark properties. In firefox this makes it open in a resizable panel on the left of whatever page I’m on. The aria2 webui actually resizes itself just fine based on the panel size and the add, manage, etc options are all readily available which makes a quick cut and paste pretty painless. Turns out I don’t need an extension after all! Examples: https://imgur.com/a/okrMY
Ok I’ll quit “mail bombing” your comment box now. ;)
Rudi Pittman
Hi Rudi!
Don’t consider it mail bombing haha – this is excellent info for those using FireFox!
Thank you so much for taking the time to post this info!
hans
Hi
thanks for the tutorial. Cannot find help for the flag
Vittorio
Hi Vittorio!
Thank you for the tank you
I haven’t used Aria in a long time, and I’m not sure where you were looking for the flag?
It is in the Aria2 documentation: https://aria2.github.io/manual/en/html/aria2c.html#rpc-options and the Github for the WebUI https://github.com/ziahamza/webui-aria2, but I’m not sure what you’re looking for
hans