I want to install aria2 and its webui, and expose it to the Internet, so that I can make my Rpi as a remote downloader.
Here is how I install the Docker on raspbian and build the webui-aria2 docker image.
1. Install Docker for on Raspbian Jessie
The installation process refers to these two posts, thanks to the authors:
For me, I just need to run the following commands:
$ curl -sSL http://downloads.hypriot.com/docker-hypriot_1.8.1-1_armhf.deb >/tmp/docker-hypriot_1.8.1-1_armhf.deb $ sudo dpkg -i /tmp/docker-hypriot_1.8.1-1_armhf.deb $ rm -f /tmp/docker-hypriot_1.8.1-1_armhf.deb $ sudo sh -c 'usermod -aG docker $SUDO_USER' $ sudo systemctl enable docker.service
And it's done.
2. Download the webui
$ wget https://github.com/ziahamza/webui-aria2/archive/master.zip $ unzip master.zip
3. Write the configuration file for aria2
There is no need to download
aria2 in the Raspberry, because it will be downloaded in the docker image later.
But I need to write a configuration file for
aria2. In the folder of the webui, create the configuration file and session file for
$ touch aria2.session $ vim aria2.conf
Add the following lines in
# Enable rpc enable-rpc=true # Allow all origin which is needed for cross-origin web UI rpc-allow-origin-all=true # Allow access from the Internet rpc-listen-all=true # default RPC port rpc-listen-port=6800 # It's recommanded to use: 3 max-concurrent-downloads=3 # Enable continue but need to make the session file continue=true # It's recommanded to use: 3 max-connection-per-server=3 # Minimun split size, important to small files min-split-size=10M # For single file. It's recommanded to use: 5 split=10 # No limit when zero max-overall-download-limit=0 max-download-limit=0 max-overall-upload-limit=0 max-upload-limit=0 # It is recommanded to preallocate file-allocation=prealloc #########Change the following######### # Path to put your downloads dir=/data # Path to the input file, useful when need to save the session and continue downloading. input-file=/aria2c/aria2.session save-session=/aria2c/aria2.session # When disconnected, it will read the latest session. Here uses 60s. save-session-interval=60
Notice that the
aria2.session should be in the same folder of the
webui folder, because they will be added to the image in the following
4. Write the Dockerfile
Note that the
Dockerfile in the
master.zip is not suitable to raspbian, because it uses
goreman to run the http service. But it will cause
Exec format error problem when running the container.
So it is necessary to build a new Dockerfile with the
Raspbian image and user common tools to setup the
http service. Possible solutions like
Nginx (actually I just know these two), which will not be provided in a clean
Raspbian docker image.
Here I choose to use
In the folder of webui-aria2, replace the content in the
Dockerfile with the following:
# Use rpi-raspbian as basic image FROM sdhibit/rpi-raspbian MAINTAINER Kent # Update the repository RUN apt-get update \ && apt-get install -y aria2 nginx \ && rm -rf /var/lib/apt/lists/* # Prepare conf file RUN mkdir /data -p \ && mkdir /aria2c -p ADD aria2.session /aria2c/ ADD aria2.conf /aria2c/ ADD . /var/www/html/ # Expose ports EXPOSE 6800 80 # Set the default command to execute when creating a new container CMD service nginx restart && aria2c --conf-path=/aria2c/aria2.conf
Need to change: nothing.
5. Build the docker image
Now it is ready to build the image. In the folder of the
$ sudo docker build -t pi-webui-aria2 .
When it's all done, run the container:
sudo docker run -d -v /Downloads:/data -p 6800:6800 -p 9100:80 --name="webui-aria2" pi-webui-aria2
Need to change:
- Folder to put the downloaded files in Rpi (I would choose to put it in a huge disk):
- Port to visit the webui:
It will be available at
6. Expose the aria2 to the Internet
If I cannot visit the webui-aria2 from the Internet, it will be meaningless to do all the previous things. "I want it to work while I'm not at home."
Here is how to expose the webui-aria2 to the Internet:
Use the method in this post to expose the ports
6800 of Rpi. Just need to change the