How to setup headless torrent box with RSS and DLNA (CentOS) + Docker container

In this post I'll show you how easy you can setup headless torrent box with RSS and DLNA on your Linux host that's running on CentOS (Debian based distributions should not be very different).

There's actually two ways of going with this:

  • Installing packages separately and do a slight configurations (takes more time)
  • Deploying a docker container (simple, yet still in development)

Packages

We're going to use Deluge WebUI for headless torrents box, flexget for RSS integration and minidlnad for DLNA server.

Install required epel-release and nux-dextop repos:

yum install -y epel-release  
wget http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm && rpm -ivh nux-dextop-release-0-5.el7.nux.noarch.rpm  

Install required packages:

yum install -y minidlna deluge-web  
easy_install flexget  

Configuration

Flexget

To integrate Flexget (RSS for torrents) into Deluge WebUI we'll need to setup authentication with it. First extract username and password:

cat /var/lib/deluge/.config/deluge/auth | awk -F: '{print $1}'  
cat /var/lib/deluge/.config/deluge/auth | awk -F: '{print $2}'  

You'll see something like this:

# cat /var/lib/deluge/.config/deluge/auth | awk -F: '{print $1}'
localclient  
# cat /var/lib/deluge/.config/deluge/auth | awk -F: '{print $2}'
c120ff48a3c6fdad072fc59aa2b67fd1e000e5b7  

If you cannot find auth file, it's alternative location can be /root/.config/deluge/auth.

Download config.yml from GitHub and place it in /root/.flexget/. Change rss: with tracker RSS link that you're using and other options with preference of yours. Change username_goes_here and password_goes_here with the details we've extracted before, in example from this:

username: username_goes_here  
password: password_goes_here  

To this:

username: localclient  
password: c120ff48a3c6fdad072fc59aa2b67fd1e000e5b7  

You can test if flexget communicates with Deluge WebUI and torrent tracker (finds your shows, etc.) with the following command:

flexget execute -v

Finally, add flexget to cron so that it will perdiocially search for entries in RSS. Add the following line in crontab (crontab -e):

@hourly /usr/bin/flexget execute -v >> /var/log/flexget.log 2>&1
MiniDLNA

Edit minidlna.conf that's located in /etc/ and define where downloaded media will be located. My example:

media_dir=A,/home/Music  
media_dir=V,/home/Videos  
media_dir=P,/home/Pictures  

Restart minidlnad to apply changes:

systemctl restart minidlnad

Deluge WebUI

Deluge web client can be accessed via browser on 8112 port, i.e. http://localhost:8112. First-time password is deluge and can be changed instantly. Configuration is pretty straightforward, just make sure to change download path to be the same as provided in minidlnad.conf file.

That's it! You've got a fully working headless torrent box with RSS and DLNA server.

Docker Container

I've made a docker container named edgaras/dlna-torrentbox (more info can be found on docker hub). Please keep in mind that it's still in development and RSS is not working at the moment.

Deployment

If you have docker packages installed, just deploy container with the following command:

docker run --name torrent-box -p 8112:8112 -P -v /home -d edgaras/dlna-torrentbox:latest  

Explanation on command-line options:

  • --name torrent-box - specify name of Docker container. In this case it'll be torrent-box.

  • -v /home - mount /home as data volume. By default this minidlna will take media from /home/Music, /home/Videos, /home/Pictures.

  • -d run as a daemon.
  • edgaras/dlna-torrentbox:latest pull and use this image.

Configuration

After container deployment is complete you should be able to reach Deluge WebUI via http://IP:8112 change IP to your Linux machine one of course.

You'll be prompted for a password. It'll be deluge and you'll be able to change it right away. After that change your torrent download location to /home/Videos so that minidlna would be able to pick it up and stream to other devices.