How to Set Up Aria2 RPC Manager for Fast, Automated DownloadsAria2 is a lightweight, high-performance download utility that supports HTTP/HTTPS, FTP, BitTorrent, and Metalink. Aria2 RPC Manager (often called a web UI for aria2) provides a graphical interface and remote control via JSON-RPC, making it easy to manage downloads from any browser or automation scripts. This guide walks you through installing aria2, securing and configuring the RPC interface, installing a popular web UI (AriaNg or webui-aria2), and automating downloads for maximum speed and reliability.
What you’ll need
- A machine to run aria2 (Linux, macOS, Windows, or a server/VPS).
- Basic command-line familiarity.
- Optional: a domain or dynamic DNS and an SSL certificate if you want secure external access.
- Aria2 RPC Manager web UI (AriaNg, webui-aria2, or another frontend).
1. Install aria2
Linux (Debian/Ubuntu):
sudo apt update sudo apt install -y aria2
macOS (Homebrew):
brew install aria2
Windows:
-
Download the latest binary from the aria2 GitHub releases page or use Scoop/chocolatey:
choco install aria2 # or scoop install aria2
Verify installation:
aria2c --version
2. Create a configuration file
Instead of typing long command-line options every time, use a config file. Typical locations:
- Linux/macOS: ~/.aria2/aria2.conf
- Windows: %APPDATA%ria2ria2.conf
Sample aria2.conf (explain key options inline):
# RPC rpc-enable=true rpc-listen-all=false # set true only if you need remote access from other hosts rpc-allow-origin-all=false rpc-secret=your_rpc_token # strong secret for RPC authentication # File management dir=/path/to/downloads file-allocation=trunc # Connection & performance max-concurrent-downloads=5 max-connection-per-server=16 split=32 min-split-size=1M timeout=60 retry-wait=5 max-tries=5 # BitTorrent enable-dht=true bt-enable-lpd=true bt-max-open-files=100 bt-save-metadata=true # Logging log=/path/to/aria2.log log-level=notice
Key performance notes:
- split controls how many connections per download; higher can increase throughput but may stress servers or your network.
- max-connection-per-server limits simultaneous connections to a single host.
- max-concurrent-downloads controls how many active downloads at once.
3. Start aria2 with the config file
Linux/macOS:
aria2c --conf-path=$HOME/.aria2/aria2.conf -D
(-D runs aria2 as a daemon on unix-like systems.)
Windows: Run aria2c with the conf path in a background shell or create a scheduled task/service.
To start manually without daemon:
aria2c --conf-path=/path/to/aria2.conf
Check RPC is listening (default port 6800):
ss -lnt | grep 6800 # or netstat -an | grep 6800
4. Secure the RPC interface
By default aria2 RPC is unauthenticated unless you set rpc-secret. Steps to secure:
- Set rpc-secret in aria2.conf to a long random string (example: a 32+ char token).
- Set rpc-listen-all=false if you only need local access; use an SSH tunnel for remote access.
- If remote access is needed, put aria2 behind an authenticated reverse proxy (Nginx) with TLS and additional auth or restrict access by IP.
- Rotate tokens periodically and avoid exposing RPC port directly to the internet.
Example: simple SSH tunnel from local machine to remote aria2:
ssh -L 6800:localhost:6800 user@remote-server # then access http://localhost:6800/jsonrpc locally
Example: Nginx reverse proxy with TLS and basic auth (conceptual—adjust for your certs and paths):
- Configure Nginx to accept HTTPS, require basic auth, then proxy_pass to http://127.0.0.1:6800/jsonrpc.
5. Install a web UI (AriaNg or webui-aria2)
Two popular choices:
- AriaNg — modern, single-page app; pure frontend that connects to aria2 RPC.
- webui-aria2 — older but featureful; can run as a server-side app.
AriaNg (static, simplest):
- Download latest AriaNg release from its GitHub or use the online demo.
- Host the static files on any web server (Nginx, Apache) or use the official online page.
- In AriaNg settings, set RPC host (IP/domain), port (6800), and token (rpc-secret).
webui-aria2:
- Clone the repo and follow its README to run with Node or as static files.
- Configure the RPC endpoint in its config.
Example: serving AriaNg with Nginx
- Put AriaNg files in /var/www/ariang
- Nginx server block: “` server { listen 443 ssl; server_name downloads.example.com;
ssl_certificate /etc/letsencrypt/live/downloads.example.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/downloads.example.com/privkey.pem;
location / {
root /var/www/ariang; try_files $uri $uri/ /index.html;
} }
3. Open AriaNg in browser and configure RPC settings. --- ## 6. Optimize for automated and fast downloads Automation: - Use AriaNg’s watch folder / “Add torrent/magnet from clipboard” features for automation. - Use scripts to call aria2 JSON-RPC for programmatic adding of downloads (curl or HTTP clients). Example curl to add a download (replace TOKEN and URL): ```bash curl -s -X POST http://localhost:6800/jsonrpc -d '{"jsonrpc":"2.0","method":"aria2.addUri","id":"add","params":["token:YOUR_RPC_TOKEN",["https://example.com/file.zip"]]}'
Batch adding:
- Create a script to read URLs from a file and call aria2.addUri for each.
- Use aria2’s –input-file option to load a list of URIs in one go:
aria2c --conf-path=~/.aria2/aria2.conf -i /path/to/uri-list.txt
Scheduling:
- Use cron, systemd timers, or other schedulers to run periodic fetch scripts.
- For torrents, enable bt-save-metadata so magnet links get saved as .torrent files for later seeding.
Performance tuning tips:
- Increase split and max-connection-per-server for servers that allow many connections (try split=16–32, max-connection-per-server=16).
- Raise max-concurrent-downloads if you have bandwidth to spare.
- Use file-allocation=trunc or none for faster start; prealloc can reduce fragmentation on large disks.
- If using many small files, lower split to reduce overhead.
7. Example automation: download-watcher script (bash)
#!/usr/bin/env bash RPC_URL="http://localhost:6800/jsonrpc" TOKEN="token:YOUR_RPC_TOKEN" WATCH_DIR="/path/to/watch" while inotifywait -e create "$WATCH_DIR"; do for f in "$WATCH_DIR"/*.txt; do [ -e "$f" ] || continue while read -r url; do [ -z "$url" ] && continue curl -s -X POST "$RPC_URL" -d "{"jsonrpc":"2.0","method":"aria2.addUri","id":"watch","params":["$TOKEN",["$url"]]}" done < "$f" mv "$f" "$f.processed" done done
(Requires inotify-tools; adapt for macOS using fswatch or polling.)
8. Monitoring and maintenance
- Check aria2 log file for errors and stalled downloads.
- Use the web UI to view download progress, health, and remove stalled tasks.
- Back up your session and configuration (aria2 saves session file if configured: save-session and input-file).
- Rotate rpc-secret and update any frontends or scripts accordingly.
Recommended aria2.conf additions for persistence:
save-session=/path/to/aria2.session input-file=/path/to/aria2.session save-session-interval=60
9. Troubleshooting common problems
- RPC not reachable: confirm aria2 running, rpc-listen-all and firewall rules, or use SSH tunnel to test local connection.
- Permission denied writing files: check dir path ownership and available disk space.
- Slow downloads: test split/connection settings, check server-side limits, run speed tests to ensure bandwidth is available.
- Magnet links not resolving: ensure DHT and peers are enabled (enable-dht=true, bt-enable-lpd=true).
10. Example full minimal aria2.conf for high-performance use
rpc-enable=true rpc-listen-all=false rpc-secret=REPLACE_WITH_STRONG_TOKEN dir=/downloads file-allocation=trunc max-concurrent-downloads=8 max-connection-per-server=16 split=32 min-split-size=1M timeout=60 retry-wait=5 max-tries=5 enable-dht=true bt-enable-lpd=true save-session=/downloads/aria2.session input-file=/downloads/aria2.session save-session-interval=60 log=/var/log/aria2/aria2.log log-level=notice
Summary
- Install aria2, create a secure rpc-enabled config, run aria2 as a service, and pick a web UI like AriaNg.
- Secure RPC (rpc-secret, SSH tunnel or reverse proxy + TLS).
- Tune split/max-connections and use automation (scripts or web UI features) to batch and schedule downloads.
Following these steps yields a fast, reliable, and remotely manageable download setup.
Leave a Reply