Today I need to download a lot of large files. It is estimated to be finished for a couple of hours. I can do that directly with my MacBook Air, but that means I need to keep it on for a long time. That is unacceptable since I need to bring my MacBook away.
Luckily, I have a Raspberry Pi that always running 24/7 at home. I can just ssh it and run wget in background, but it’s not efficient enough. I mean, I’m friendly with command line, but I want something fast. What I want is a download manager that I can access with web browser, just like transmission. But, transmission can only accept torrent files. I need it to accept more protocols, like HTTP and FTP.
So then I found aria2.
aria2 is a lightweight multi-protocol and multi-source command-line download manager. It supports HTTP/HTTPS, FTP, SFTP, BitTorrent and Metalink! But it doesn’t have official web interface.
When I read more on their website, they recommend webui-aria2 as a frontend. This web UI can manipulate aria2 via built-in JSON-RPC interface!
All right, enough with the story, let’s go straight to the solution.
First, you need to login to your Raspberry pi via ssh. Then change your working directory to home.
Install some dependencies. We need to use git, tmux, python3, and aria2.
Download webui-aria2 to the current working directory. We can simply clone it with git.
This will run
aria2 in background and listen to RPC protocol.
By default the RPC will listen 6800 port.
Let’s leave it to that.
tmux session, too.
We simply use
python3 built-in HTTP server.
This also will run the http server in background.
We use port 8600 for HTTP server.
That’s it, now open your Raspberry pi IP address with port 8600 from your browser.
You can find out your Raspberry Pi ip address with
Run at startup
The solution above is enough assuming you never turn off your Raspberry pi. But it’s mostly not the case. You’re going to need to restart it once in a while. Or maybe there will be a sudden power failure. You never know.
To run the services in background, we need to create a shell script.
Let’s call the script
You can edit it with
vim, or any text editor.
The content is similar with previous section. Here is the command I write on it.
Next thing is to make it executable with
In Raspbian OS, you can start a script immediately after finished booting by writing it in
So we need to execute previous shell script there.
Open the file with your favorite text editor.
Make sure put the following line before
If you’re worry that you write it wrong, here is my
rc.local content looks like.
Now restart your Raspberry pi to check if it works.
After your Raspberry pi done restarting, it should be running in background. That’s it, enjoy your download manager!
Thanks for reading, I’ll write more articles like this in the future.