Installing Aria2 and AriaNg on Linux for Browser-Based Download Management

LightNode
By LightNode ·

Aria2 is one of the most efficient download engines you can run on a Linux server. It supports parallel connections, multiple protocols, and extremely low resource consumption.
When combined with AriaNg — a modern single-page web UI — you can manage every download task directly from your browser without touching the command line again.

This guide walks through installing Aria2, enabling RPC, setting up a persistent service, and hosting AriaNg with Nginx.

1. Preparing the System

Start by refreshing your package list and applying updates:

sudo apt update -y && sudo apt upgrade -y

(For CentOS/Rocky/AlmaLinux, replace with dnf update -y.)

2. Installing Aria2

Ubuntu/Debian:

sudo apt install aria2 -y

RHEL-based systems:

sudo dnf install epel-release -y
sudo dnf install aria2 -y

Confirm that the binary is available:

aria2c -v

3. Creating Aria2 Configuration

Make a directory for configuration:

mkdir -p ~/.aria2

Then create your config file:

nano ~/.aria2/aria2.conf

Example configuration:

enable-rpc=true
rpc-listen-port=6800
rpc-secret=mysecret
dir=/data/downloads
continue=true
split=12
max-connection-per-server=8
min-split-size=5M
input-file=/home/USER/.aria2/aria2.session
save-session=/home/USER/.aria2/aria2.session
save-session-interval=120

Create the session file:

touch ~/.aria2/aria2.session

4. Preparing the Download Directory

sudo mkdir -p /data/downloads
sudo chmod -R 755 /data/downloads

You may adjust permissions depending on security needs.

5. Running Aria2 as a System Service

Create a systemd service file:

sudo nano /etc/systemd/system/aria2.service

Insert:

[Unit]
Description=Aria2 Download Service
After=network.target

[Service]
User=USER
ExecStart=/usr/bin/aria2c --conf-path=/home/USER/.aria2/aria2.conf
Restart=always

[Install]
WantedBy=multi-user.target

Reload and activate:

sudo systemctl daemon-reload
sudo systemctl enable aria2
sudo systemctl start aria2

Check status:

sudo systemctl status aria2

6. Installing Nginx for AriaNg

Install Nginx:

sudo apt install nginx -y

Download AriaNg:

cd /var/www
sudo wget https://github.com/mayswind/AriaNg/releases/latest/download/AriaNg.zip
sudo unzip AriaNg.zip -d ariang

7. Creating an Nginx Site

Create a new server block:

sudo nano /etc/nginx/sites-available/ariang

Add:

server {
    listen 80;
    server_name _;

    root /var/www/ariang;
    index index.html;
}

Enable the site:

sudo ln -s /etc/nginx/sites-available/ariang /etc/nginx/sites-enabled/
sudo systemctl restart nginx

Visit AriaNg:

http://YOUR_SERVER_IP/

8. Connecting AriaNg to Aria2

In AriaNg:

  1. Open Settings

  2. Go to RPC

  3. Use RPC URL → http://YOUR_SERVER_IP:6800/jsonrpc RPC Token → the value of rpc-secret

Once saved, AriaNg will communicate directly with your Aria2 instance.

9. Optional: Adding HTTPS

If you want secure access:

sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx

FAQ

  1. Why does AriaNg show “RPC connection failed”?

This typically happens when port 6800 is blocked. Open the port:

sudo ufw allow 6800

Also ensure the rpc-secret matches exactly.

  1. Aria2 keeps stopping after I reboot. How do I make it persistent?

Verify the service is enabled:

sudo systemctl enable aria2
  1. Can Aria2 download torrents and magnet links?

Yes. Upload a .torrent file or paste a magnet link directly in AriaNg.

  1. How do I limit global download speed?

Add these options in aria2.conf:

max-overall-download-limit=3M
max-download-limit=1M

Then restart the service.

  1. Can I password-protect AriaNg?

Yes. Add basic authentication in your Nginx block:

auth_basic "Restricted";
auth_basic_user_file /etc/nginx/.htpasswd;

Create credentials:

sudo apt install apache2-utils
sudo htpasswd -c /etc/nginx/.htpasswd admin

Restart Nginx afterward.