How to install aria2 on Linux

Published on Aug. 22, 2023, 12:15 p.m.

To install aria2 on Linux, you can use your distribution’s package manager. Here are some examples:

  • On Ubuntu or Debian, you can use the following command to install aria2:
sudo apt-get install aria2
  • On Fedora or CentOS, you can use the following command to install aria2:
sudo dnf install aria2
  • On Arch Linux, you can use the following command to install aria2:
sudo pacman -S aria2

After installation, you can start using aria2 by invoking the aria2c command in your terminal. It accepts a wide range of arguments and options to customize your downloads. For more information, you can refer to the aria2 documentation or use the man aria2c command to view the manual page.

To download a file using aria2

To download a file using aria2, you can use the following command:

aria2c <download-link>

Replace <download-link> with the actual link to the file you want to download. You can also use various options and flags with the aria2c command to customize the download process, such as setting the download directory, setting connection limits, and resuming downloads. Here is an example command to download a file with aria2 and resume the download if it gets interrupted:

aria2c -c <download-link>

This command will resume the download if it gets interrupted or stopped, and use multiple connections to speed up the download process. Note that the -c flag enables download resume support.

You can find more examples and information on how to use aria2 in the official documentation.

To download a torrent file using aria2

To download a torrent file using aria2, you can use the following command:

aria2c <torrent-file>

In the above command, <torrent-file> is the path and filename of the torrent file you want to download. If you want to download the torrent file using a magnet link, you can use the following command:

aria2c "<magnet-link>"

In the command above, <magnet-link> is the magnet link. The double quotes "" are necessary to allow spaces within the magnet link.

If you want to limit your download speed, you can use the -limit-rate flag. This will limit your download speed, for example, to 1MB/s:

aria2c -limit-rate=1M <torrent-file>

I hope this helps you understand how to use aria2 to download torrent files.

To add a configuration file for aria2

To add a configuration file for aria2, you can create a new file with the desired configuration parameters using a text editor of your choice, and save it with a “.conf” extension. Then, you can start aria2 with the newly created configuration file using the following command:

aria2c --conf-path=/path/to/your/config/file.conf

In the command above, replace “/path/to/your/config/file.conf” with the actual path to your configuration file. Alternatively, you can set the environment variable ARIA2C_CONF_PATH to the path of your configuration file, and then run aria2c without specifying the --conf-path option:

export ARIA2C_CONF_PATH=/path/to/your/config/file.conf
aria2c

You can find more information and examples of configuring aria2 in the official documentation.

To run aria2 in the background

To run aria2 in the background, you can use the -D or --daemon option to start aria2 in daemon mode. For example:

aria2c -D <torrent-file>

This will run aria2 in the background and download the specified torrent file. You can also set daemon=true in your aria2 configuration file to make it run in the background. The specific usage may vary depending on your operating system and environment, so you can refer to the official aria2 documentation for more information and examples.

In addition, if you want to run aria2 in the background for a long time without being affected by terminal closing or user logout, you can consider using the nohup command or other similar tools to run aria2 in the background. For example:

nohup aria2c -D <torrent-file> &

This way, aria2 will run in the background and continue downloading even if you close the terminal or log out of the user. Note that this may require some additional setup and configuration, depending on your operating system and environment.

I hope this helps you run aria2 in the background.

To set aria2 to start up automatically at boot

To set aria2 to start up automatically at boot, you can create a systemd service file for aria2 and enable it. Here are the steps to do this:

  1. Create a new systemd service file for aria2 using a text editor. For example, you can create a file named “aria2.service” in the “/etc/systemd/system/” directory with the following contents:
[Unit]
Description=Aria2 Download Manager
After=network.target

[Service]
User=<your-username>
ExecStart=/usr/bin/aria2c --conf-path=/path/to/your/config/file.conf
Restart=always

[Install]
WantedBy=multi-user.target

In the above file, replace <your-username> with your username and replace “/path/to/your/config/file.conf” with the actual path to your aria2 configuration file.

  1. Save and close the file.
  2. Run the following command to reload systemd and enable the aria2 service:
sudo systemctl daemon-reload
sudo systemctl enable aria2

Now, whenever you boot up your system, aria2 will automatically start running in the background as a systemd service.

I hope this helps you set up aria2 to start up automatically at boot.

To install aria2 using Docker

To install aria2 using Docker, you can follow these steps:

  1. Install Docker on your system if you haven’t already done so.
  2. Pull the aria2 Docker image by running the following command:
docker pull p3terx/aria2-pro

This will download the latest version of the aria2 image from Docker Hub.

  1. Create a new container using the downloaded image by running the following command:
docker run -d \
--name aria2 \
--restart unless-stopped \
-p 6800:6800 \
-p 6888:6888 \
-v /path/to/downloads:/downloads \
-v /path/to/aria2/conf:/conf \
p3terx/aria2-pro

In the above command, replace “/path/to/downloads” with the path to the downloads directory on your host system and replace “/path/to/aria2/conf” with the path to your aria2 configuration directory.

  1. Optionally, you can also use AriaNg as a web user interface for aria2 by creating a separate container:
docker run -d \
--name ariang \
--link aria2 \
-p 8080:80 \
penglongli/ariang

This will download and run the latest version of AriaNg from Docker Hub.

  1. Now, you can access AriaNg by opening your web browser and navigating to “http://localhost:8080/”. Login using the default username “admin” and password “admin”.

I hope this helps you install aria2 using Docker.

Tags: