Commands.page Logo

Enable Peer Exchange PEX in aria2 on Ubuntu

This article provides a direct answer and configuration guide for enabling Peer Exchange (PEX) within the aria2 download utility on Ubuntu systems. It covers the specific command-line flag required to activate this BitTorrent feature and demonstrates how to apply it permanently via the configuration file for streamlined downloading.

To enable Peer Exchange (PEX) for BitTorrent downloads in aria2, you must use the –enable-peer-exchange=true option. This feature allows your client to exchange peer lists with other connected peers, potentially increasing download speeds by discovering more sources without relying solely on the tracker.

Using the Command Line

When running aria2 directly from the terminal, append the flag to your command. Here is the basic syntax:

aria2c --enable-peer-exchange=true --bt-enable-lpd=true "magnet:?xt=urn:btih:..."

While PEX is often enabled by default in recent versions of aria2, explicitly setting this option ensures the feature remains active regardless of global defaults or specific torrent restrictions.

Configuring aria2 Permanently

For users who want to enable PEX for all BitTorrent downloads without typing the flag every time, modify the aria2 configuration file. On Ubuntu, this file is typically located at ~/.aria2/aria2.conf.

  1. Open the configuration file in a text editor:

    nano ~/.aria2/aria2.conf
  2. Add or uncomment the following line:

    enable-peer-exchange=true
  3. Save the file and exit the editor.

Any subsequent torrent downloads initiated by aria2 will now utilize Peer Exchange automatically. Ensure that your firewall allows incoming connections on the specified port to maximize the effectiveness of peer exchange.