Debian 9 64 bits – Mise en place d’un Seedbox avec Rtorrent et Flood

Auteur : Vince Nadus
Date de publication : 28 août 2018
debian

Installation 1) Install rTorrent

apt install rtorrent screen

2) Confgure rTorrent

First, create a dedicated user, to avoid running rTorrent with root:

adduser --disabled-password rtorrent

You will need to answer few questions (or just skip them with ENTER)

Then, we will create a configuration file to define few settings and the SCGI to let Flood connect to rTorrent.

nano /home/rtorrent/.rtorrent.rc

and copy the following:

Where rTorrent saves the downloaded

files directory = /srv/torrent/downloads

Where rTorrent saves the session

session = /srv/torrent/.session

Which ports rTorrent can use (Make sure to open them in your router)

port_range = 50000-50000 port_random = no

Check the hash after the end of the download

check_hash = yes

Enable DHT (for torrents without trackers)

dht = auto dht_port = 6881 peer_exchange = yes

Authorize UDP trackers

use_udp_trackers = yes

Enable encryption when possible

encryption = allow_incoming,try_outgoing,enable_retry

SCGI port, used to communicate with Flood

scgi_port = 127.0.0.1:5000

It will work out of the box, but feel free to tweak it, especially on the download paths.

Create the mentioned folders (download and session)

mkdir /srv/torrent mkdir /srv/torrent/downloads mkdir /srv/torrent/.session

and set the rights permissions:

chmod 775 -R /srv/torrent chown rtorrent:rtorrent -R /srv/torrent chown rtorrent:rtorrent /home/rtorrent/.rtorrent.rc

Now, we create a SystemD startup script to ensure rtorrent is running at the startup (and it ease the control)

nano /etc/systemd/system/rtorrent.service

and add:

[Unit] Description=rTorrent After=network.target

[Service] User=rtorrent Type=forking KillMode=none ExecStart=/usr/bin/screen -d -m -fa -S rtorrent /usr/bin/rtorrent ExecStop=/usr/bin/killall -w -s 2 /usr/bin/rtorrent WorkingDirectory=%h

[Install] WantedBy=default.target

Enable it at boot:

systemctl enable rtorrent.service

and start it up!

systemctl start rtorrent

If no error, you can move to the next step. 3) Install Flood

You will need NodeJS, the version 8 will work great. (Feel free to use nvm to manage your node versions) To do so, still in root (Or with sudo) run:

apt install curl build-essential git curl -sL https://deb.nodesource.com/setup_8.x | bash - apt install -y nodejs

And then, clone their git repo

cd /srv/torrent git clone https://github.com/jfurrow/flood.git

This should be pretty fast.

Use the template of the config file as standard configuration

cd flood cp config.template.js config.js

Now install flood using npm

npm install

If no error, continue with:

npm install -g node-gyp

npm run build

4) Start Flood

Before launching Flood, we will create a systemd script to launch flood directly at startup (and easier to manage)

First, create a dedicated user that will run flood

adduser --disabled-password flood

and add the right permissions:

chown -R flood:flood /srv/torrent/flood/

Then create the script

nano /etc/systemd/system/flood.service

and add:

[Service] WorkingDirectory=/srv/torrent/flood ExecStart=/usr/bin/npm start Restart=always StandardOutput=syslog StandardError=syslog SyslogIdentifier=notell User=flood Group=flood Environment=NODE_ENV=production

[Install] WantedBy=multi-user.target

add it to the boot:

systemctl enable flood

and start it!

systemctl start flood