Commands.page Logo

How to Configure aria2 RPC Port on Ubuntu Linux

This guide explains how to configure the aria2 download utility to listen on a specific port for RPC connections within an Ubuntu environment. You will learn how to modify the configuration file to set a custom RPC port, enable secure access if needed, and ensure the changes take effect by restarting the service. Following these steps allows for better network management and integration with remote control interfaces.

Install aria2

Open your terminal and update your package list. Install aria2 using the apt package manager.

sudo apt update
sudo apt install aria2

Create the Configuration File

Create the directory for aria2 configuration if it does not exist. Then create or open the configuration file.

mkdir -p ~/.aria2
nano ~/.aria2/aria2.conf

Set the RPC Port

Add the following lines to the configuration file to define the listening port and secure the connection with a token. Replace 6800 with your desired port number and YOUR_SECRET_TOKEN with a strong password.

enable-rpc=true
rpc-listen-port=6800
rpc-secret=YOUR_SECRET_TOKEN

Save the file and exit the editor.

Start aria2 Daemon

Run aria2 in daemon mode using the configuration file you just edited.

aria2c --conf-path=~/.aria2/aria2.conf --daemon=true

Verify the Configuration

Check if aria2 is listening on the specified port using netstat or ss.

ss -tulpn | grep 6800

You should see aria2 listed on the port you configured. You can now connect using an RPC client using the secret token and port number.