Contents
- 1 [VPS][UBUNTU] INSTALL aria2
- 2 Download Directory: specify the directory all files will be downloaded to.
- 3 When this directive is commented out, aria2 will download the files to the
- 4 current directory where you execute the aria2 binary.
- 5 dir=/some/download/
- 6 Bit Torrent: If the speed of the incoming data (download) from other peers is
- 7 greater then the peer-speed-limit, then do not allow any more connections
- 8 then max-peers. The idea is to limit the amount of clients our system will
- 9 connect with to reduce our overall load when we are already saturating our
- 10 incoming bandwidth. Make sure to set the the peer-speed-limit to your
- 11 preferred incoming (download) speed. Speeds are in kilobytes per second or
- 12 megebytes per second and must be whole numbers; 5.5M is illegal but 5500K
- 13 and 5M is valid.
- 14 Bit Torrent: the max upload speed for all torrents combined. Again, only
- 15 whole numbers are valid. We find a global upload limit is more flexible then
- 16 an upload limit per torrent. Zero(0) is unlimited.
- 17 Bit Torrent: When downloading a torrent remove ALL trackers from the listing.
- 18 This is a good method to only use distributed hash table (DHT) and Peer
- 19 eXchange (PeX) on connections. We find start up of the torrent takes 20
- 20 seconds longer with all trackers disabled, but helps reduce the load on
- 21 trackers.
- 22 Bit Torrent: ports and protocols used for bit torrent TCP and UDP
- 23 connections. Peers use TCP. DHT and PEX as well as UDP based trackers use UDP
- 24 and make sure the DHT server is enabled.
- 25 When running aria2 on FreeBSD with ZFS, disable disk-cache due to ZFS using
- 26 Adaptive Replacement Cache (ARC). ZFS can also take advantage of the "sparse
- 27 files" format which is significantly faster then pre allocation of file
- 28 space. For other file systems like EXT4 and XFS you can test with "prealloc"
- 29 and "falloc" to see which file-allocation allows arai2 to start quicker and
- 30 use less disk I/O.
- 31 Bit Torrent: fully encrypt the negotiation as well and the payload of all bit
- 32 torrent traffic. Encryption is required and all older, non-encrypted clients
- 33 are ignored. This may help avoid some ISPs rate limiting P2P clients, but may
- 34 also reduce the amount of clients aria2 will talk to.
- 35 Bit Torrent: timeout values for servers and clients.
- 36 Bit Torrent: Download the torrent file into memory (RAM) if there is no need
- 37 to save the .torrent file itself. This option works with both magnet and
- 38 torrent URL links.
- 39 Bit Torrent: The amount of time and the upload-to-download ratio you wish to
- 40 seed to. If either the time limit ( seconds ) or the seed ratio is reached,
- 41 torrent seeding will stop. You can set seed-time to zero(0) to disable
- 42 seeding completely.
- 43 Bit Torrent: scripts or commands to execute before, during or after a
- 44 download finishes.
- 45 on-bt-download-complete=/path/to/script.sh
- 46 on-download-complete=/path/to/script.pl
- 47 on-download-error=/path/to/script
- 48 on-download-pause=/path/to/script.sh
- 49 on-download-start=/path/to/script.pl
- 50 on-download-stop=/path/to/script
- 51 Event Multiplexing: set polling to the OS type you are using. For FreeBSD,
- 52 OpenBSD and NetBSD set to "kqueue". For Linux set to "epoll".
- 53 Certificate Authority PEM : specify the full path to the OS certificate
- 54 authority pem file to verify the peers. On FreeBSD with OpenSSL the following
- 55 file path is valid. Without a valid pem file aria2 will print out the error,
- 56 "[ERROR] Failed to load trusted CA certificates from no. Cause:
- 57 error:02001002:system library:fopen:No such file or directory"
- 58 ca-certificate=/usr/local/openssl/cert.pem
- 59 Data Integrity: check the MD5 / SHA256 hash of metalink downloads as well as
- 60 the hash of bit torrent chunks as our client receives them. CPU time is
- 61 reasonably low for the high value of verified data.
- 62 File Names: Resume file downloads if we have a partial copy. Do not rename
- 63 the file or make another copy if the same file is downloaded a second time.
- 64 User Agent: Disable the identification string of our client. If you connect
- 65 to a server which requires a certain id string you can always add one here.
- 66 Trackers should never use client id strings as security authentication or
- 67 access control.
- 68 Status Summery messages are disabled since the status of the download is
- 69 updated in real time on the CLI anyways.
- 70 FTP: use passive ftp which is firewall friendly and reuse the ftp data
- 71 connection when asking for multiple resources from the same server for
- 72 efficiency.
- 73 Metalink: Set the country code to make sure mirrors closest to you are used
- 74 first. Prefer more secure https mirrors over http and ftp servers.
- 75 Disconnect from https, http or ftps server who do not upload data to us
- 76 faster then the specified value. Aria2 will then find another mirror in the
- 77 metalink file which might be quicker. If there are no more mirrors left then
- 78 the current slow mirror is still used. This value is NOT used for bit torrent
- 79 connections though. NOTE: we hope to convince the developer to add a
- 80 lower-speed value or even a minimal client U/D ratio to bit torrent some day
- 81 to kick off leachers too.
- 82 Concurrent downloads: Set the number of different servers to download from
- 83 concurrently; i.e. in parallel. If we are downloading a single file then
- 84 split that file into the same amount of streams. Make sure to keep in mind
- 85 that if the amount of parallel downloads times the lowest-speed-limit is
- 86 greater then your total download bandwidth then you will drop servers
- 87 incorrectly. For example, we have ten(10) connections at a minimum of
- 88 50KiB/sec which equals 500KiB/sec. If our total download bandwidth is not at
- 89 least 500KiB/sec then arai2 will think the mirrors are too slow and drop
- 90 connection slowing down the whole download. Do not set the
- 91 max-connection-per-server greater then one(1) as to avoid abusing a single
- 92 server.
- 93 RPC Interface: To access aria2 through XML-RPC API, like using webui-aria2.
- 94 enable-rpc
- 95 rpc-listen-all
- 96 rpc-user=username
- 97 rpc-passwd=passwd
- 98 Daemon Mode: To run aria2 in the background as a daemon. Use daemon mode to
- 99 start aria2 on reboot or when using an RPC interface like webui-aria2.
- 100 daemon
- 101 Reference: the following options are commented out and the developers
- 102 defaults are used. We kept them here for reference.
- 103 bt-max-open-files=100
- 104 bt-save-metadata=false
- 105 bt-stop-timeout=0
- 106 bt-tracker="udp://tracker.openbittorrent.com:80/announce"
- 107 dht-entry-point="dht.transmissionbt.com:6881"
- 108 dht-file-path=$HOME/.aria2/dht.dat
- 109 dht-message-timeout=10
- 110 disable-ipv6=true
- 111 log=$HOME/.aria2/aria2.log
- 112 log-level=debug
- 113 !/bin/sh
- 114 Provides: aria2
- 115 Required-Start: $local_fs $remote_fs $network
- 116 Required-Stop: $local_fs $remote_fs $network
- 117 Should-Start: $network
- 118 Should-Stop: $network
- 119 Default-Start: 2 3 4 5
- 120 Default-Stop: 0 1 6
- 121 Short-Description: aria2c init script.
- 122 Description: Starts and stops aria2 daemon.
[VPS][UBUNTU] INSTALL aria2
Table of Contents
- Install Aria2
- Make and configure aria2 config
- Make the service handler aria2 on init.d
- install Aria2 Webui
Install Aria2
sudo apt install aria2
Make and configure aria2 config
install to your path
sudo nano /path/to/config/aria2/aria2.conf
configure as required,
- uncomment the rpc part if you want to use aria2 webui or the likes
- replace "dir" directory to your download dir path
# ## aria2 config # # man page = http://aria2.sourceforge.net/manual/en/html/aria2c.html # file path = $HOME/.aria2/aria2.conf
Download Directory: specify the directory all files will be downloaded to.
When this directive is commented out, aria2 will download the files to the
current directory where you execute the aria2 binary.
dir=/some/download/
Bit Torrent: If the speed of the incoming data (download) from other peers is
greater then the peer-speed-limit, then do not allow any more connections
then max-peers. The idea is to limit the amount of clients our system will
connect with to reduce our overall load when we are already saturating our
incoming bandwidth. Make sure to set the the peer-speed-limit to your
preferred incoming (download) speed. Speeds are in kilobytes per second or
megebytes per second and must be whole numbers; 5.5M is illegal but 5500K
and 5M is valid.
bt-max-peers=55
bt-request-peer-speed-limit=5M
Bit Torrent: the max upload speed for all torrents combined. Again, only
whole numbers are valid. We find a global upload limit is more flexible then
an upload limit per torrent. Zero(0) is unlimited.
max-overall-upload-limit=5M
Bit Torrent: When downloading a torrent remove ALL trackers from the listing.
This is a good method to only use distributed hash table (DHT) and Peer
eXchange (PeX) on connections. We find start up of the torrent takes 20
seconds longer with all trackers disabled, but helps reduce the load on
trackers.
bt-exclude-tracker="*"
Bit Torrent: ports and protocols used for bit torrent TCP and UDP
connections. Peers use TCP. DHT and PEX as well as UDP based trackers use UDP
and make sure the DHT server is enabled.
dht-listen-port=6881
enable-dht=true
enable-peer-exchange=true
listen-port=6881
When running aria2 on FreeBSD with ZFS, disable disk-cache due to ZFS using
Adaptive Replacement Cache (ARC). ZFS can also take advantage of the "sparse
files" format which is significantly faster then pre allocation of file
space. For other file systems like EXT4 and XFS you can test with "prealloc"
and "falloc" to see which file-allocation allows arai2 to start quicker and
use less disk I/O.
disk-cache=0
file-allocation=none
Bit Torrent: fully encrypt the negotiation as well and the payload of all bit
torrent traffic. Encryption is required and all older, non-encrypted clients
are ignored. This may help avoid some ISPs rate limiting P2P clients, but may
also reduce the amount of clients aria2 will talk to.
bt-min-crypto-level=arc4
bt-require-crypto=true
Bit Torrent: timeout values for servers and clients.
bt-tracker-connect-timeout=10
bt-tracker-interval=900
bt-tracker-timeout=10
Bit Torrent: Download the torrent file into memory (RAM) if there is no need
to save the .torrent file itself. This option works with both magnet and
torrent URL links.
follow-torrent=mem
Bit Torrent: The amount of time and the upload-to-download ratio you wish to
seed to. If either the time limit ( seconds ) or the seed ratio is reached,
torrent seeding will stop. You can set seed-time to zero(0) to disable
seeding completely.
seed-ratio=1.0
seed-time=900
Bit Torrent: scripts or commands to execute before, during or after a
download finishes.
on-bt-download-complete=/path/to/script.sh
on-download-complete=/path/to/script.pl
on-download-error=/path/to/script
on-download-pause=/path/to/script.sh
on-download-start=/path/to/script.pl
on-download-stop=/path/to/script
Event Multiplexing: set polling to the OS type you are using. For FreeBSD,
OpenBSD and NetBSD set to "kqueue". For Linux set to "epoll".
event-poll=poll
Certificate Authority PEM : specify the full path to the OS certificate
file path is valid. Without a valid pem file aria2 will print out the error,
"[ERROR] Failed to load trusted CA certificates from no. Cause:
error:02001002:system library:fopen:No such file or directory"
ca-certificate=/usr/local/openssl/cert.pem
Data Integrity: check the MD5 / SHA256 hash of metalink downloads as well as
the hash of bit torrent chunks as our client receives them. CPU time is
reasonably low for the high value of verified data.
check-integrity=true
realtime-chunk-checksum=true
File Names: Resume file downloads if we have a partial copy. Do not rename
the file or make another copy if the same file is downloaded a second time.
allow-overwrite=false
always-resume=true
auto-file-renaming=false
continue=true
remote-time=true
User Agent: Disable the identification string of our client. If you connect
to a server which requires a certain id string you can always add one here.
Trackers should never use client id strings as security authentication or
access control.
peer-id-prefix=""
user-agent=""
Status Summery messages are disabled since the status of the download is
updated in real time on the CLI anyways.
summary-interval=0
FTP: use passive ftp which is firewall friendly and reuse the ftp data
connection when asking for multiple resources from the same server for
efficiency.
ftp-pasv=true
ftp-reuse-connection=true
Metalink: Set the country code to make sure mirrors closest to you are used
first. Prefer more secure https mirrors over http and ftp servers.
metalink-language=en-US
metalink-location=us
metalink-preferred-protocol=https
Disconnect from https, http or ftps server who do not upload data to us
faster then the specified value. Aria2 will then find another mirror in the
metalink file which might be quicker. If there are no more mirrors left then
the current slow mirror is still used. This value is NOT used for bit torrent
connections though. NOTE: we hope to convince the developer to add a
lower-speed value or even a minimal client U/D ratio to bit torrent some day
to kick off leachers too.
lowest-speed-limit=50K
Concurrent downloads: Set the number of different servers to download from
concurrently; i.e. in parallel. If we are downloading a single file then
split that file into the same amount of streams. Make sure to keep in mind
that if the amount of parallel downloads times the lowest-speed-limit is
greater then your total download bandwidth then you will drop servers
incorrectly. For example, we have ten(10) connections at a minimum of
50KiB/sec which equals 500KiB/sec. If our total download bandwidth is not at
least 500KiB/sec then arai2 will think the mirrors are too slow and drop
connection slowing down the whole download. Do not set the
max-connection-per-server greater then one(1) as to avoid abusing a single
server.
max-concurrent-downloads=10
max-connection-per-server=10
min-split-size=5M
split=10
RPC Interface: To access aria2 through XML-RPC API, like using webui-aria2.
enable-rpc
rpc-listen-all
rpc-user=username
rpc-passwd=passwd
Daemon Mode: To run aria2 in the background as a daemon. Use daemon mode to
start aria2 on reboot or when using an RPC interface like webui-aria2.
daemon
#
#
Reference: the following options are commented out and the developers
defaults are used. We kept them here for reference.
bt-max-open-files=100
bt-save-metadata=false
bt-stop-timeout=0
bt-tracker="udp://tracker.openbittorrent.com:80/announce"
check-certificate=true
conditional-get=true
dht-entry-point="dht.transmissionbt.com:6881"
dht-file-path=$HOME/.aria2/dht.dat
dht-message-timeout=10
disable-ipv6=true
http-accept-gzip=true
log=$HOME/.aria2/aria2.log
log-level=debug
EOF
## Make the service handler aria2 on init.d
make file
sudo nano /etc/init.d/aria2
copy this
!/bin/sh
BEGIN INIT INFO
Provides: aria2
Required-Start: $local_fs $remote_fs $network
Required-Stop: $local_fs $remote_fs $network
Should-Start: $network
Should-Stop: $network
Default-Start: 2 3 4 5
Default-Stop: 0 1 6
Short-Description: aria2c init script.
Description: Starts and stops aria2 daemon.
END INIT INFO
USER="root"
DAEMON=/usr/bin/aria2c
CONF=/etc/aria2/aria2.conf
start() {
if [ -f $CONF ]; then
logger -st ARIA2C "Starting aria2c daemon..."
nohup start-stop-daemon -S -c $USER -x $DAEMON -- -D --enable-rpc --conf-path=$CONF
else
logger -st ARIA2C "Couldn't start aria2 daemon (no $CONF found)"
fi
}
stop() {
logger -st ARIA2C "Stoping aria2c daemon..."
start-stop-daemon -o -c $USER -K -u $USER -x $DAEMON
}
status() {
dbpid=`pgrep -fu $USER $DAEMON`
if [ -z "$dbpid" ]; then
logger -st ARIA2C "aria2c daemon not running."
else
logger -st ARIA2C "aria2c daemon running..."
fi
}
case "$1" in
start)
start
sleep 1
;;
stop)
stop
sleep 1
;;
restart)
stop
sleep 2
start
;;
status)
status
;;
*)
echo "Usage: {start|stop|restart|status}"
exit 1
esac
exit 0
Start the service and make sure aria2 is running
chmod +x /etc/init.d/aria2
chkconfig --level 345 aria2 on
service aria2 start
ps -aux | grep aria
## install Aria2 Webui
download the aria webui from https://github.com/ziahamza/webui-aria2 to ur web server, or follow instruction on the repo
---
thats it