How to install Flood + Rtorrent on Debian 10

21st Mar 2020 Karibu

Rtorrent is without any doubt the most powerful torrent client a server can have. Yet many webUI exists (Rutorrent being the most popular) but I personally prefer, by far, Flood. It uses Node.js for backend and React for frontend.

Some of the reasons I like Flood:

  • Lightweight, intuitive and modern interface
  • Can add torrents through URLs but also follow RSS feeds with download rules settings directly in the web interface
  • You can download your finished torrents directly in the web interface, instead of setting up a FTP or HTTP accessible folder. Neat. and well, it's based on rTorrent ;)

Let's see how to install rtorrent + flood on your Debian 10 (Buster). I am assuming you have apache2 installed already

Installation

We will install rtorrent first, the flood.

1) Install rTorrent

Simply run:

apt install rtorrent screen


2) Confgure rTorrent

Let's first create a dedicated user, to avoid running rTorrent with root privileges.

adduser --disabled-password rtorrent

You can skip all the questions by just press ENTER

Now, create the 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.default.set = /srv/torrent/downloads

# Where rTorrent saves the session
session.path.set = /srv/torrent/.session

# Which ports rTorrent can use (Make sure to open them in your router)
network.port_range.set = 50000-50000
network.port_random.set = no

# Check the hash after the end of the download
pieces.hash.on_completion.set = yes

# Enable DHT (for torrents without trackers)
dht.mode.set = auto
dht.port.set = 6881
protocol.pex.set = yes

# Authorize UDP trackers
trackers.use_udp.set = yes

# Enable encryption when possible
protocol.encryption.set = allow_incoming,try_outgoing,enable_retry

# SCGI port, used to communicate with Flood
network.scgi.open_port = 127.0.0.1:5000

This will work out of the box, but feel free to change further the settings.

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


3) Add a SystemD startup script

To have rtorrent running at startup (and ease its control), we will create a SystemD startup script.

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=/home/rtorrent

[Install]
WantedBy=default.target

Enable it:

systemctl enable rtorrent.service

and start it up!

systemctl start rtorrent

If no error, you can now install Flood


4) Install Flood

First thing is to install NodeJS, I'm using the version 12 that works well. For this, simply run:

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

Now you can clone their git repo to get the latest version (Around 23mb, so it should be fast)

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

Let's use the default configuration:

cd flood
cp config.template.js config.js

and install it with npm

npm install

This is were issues could happen. If no error messages (Warnings are okay) then proceed with:

npm install -g node-gyp
npm run build


5) Start flood

Before starting flood, we will create a dedicated user and a systemd script.

Dedicated user with the right permissions:

adduser --disabled-password flood
chown -R flood:flood /srv/torrent/flood/

and now the systemd 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

Enable it and start it:

systemctl enable flood
systemctl start flood

You should now be able to access to the flood interface at http://YourIP:3000


Virtualhost

To ensure smooth access, I recommend to create a dedicated virtualhost and to access it through a subdomain. Let's first enable the needed mod proxy

a2enmod proxy_http proxy_html
systemctl restart apache2

Create the dedicated vhost:

nano /etc/apache2/sites-available/flood.conf

and add:

<VirtualHost *:80>

        ServerAdmin webmaster@localhost
        ServerName flood.domain.tld

        ProxyRequests Off
        <proxy>
        Require all granted
        </proxy>
        ProxyPass / http://localhost:3000/
        ProxyPassReverse / http://localhost:3000/

    ErrorLog ${APACHE_LOG_DIR}/flood_error.log
    CustomLog ${APACHE_LOG_DIR}/flood_access.log combined

</VirtualHost>

Enable the configuration and restart Apache:

a2ensite flood
systemctl reload apache2


That's it, you should now be able to access to your super Flood +Rtorrent instance through your subdomain!

It will ask you to create a user/password for the first time and you’re good to go!

Final step will be to enable the HTTPS obviously.

Gravatar

Loves to discover web-based apps to install on his own server@home and write articles about it

0 Comments:

Add a comment