Menu

How to install Deluge (v1.3.x) headless on Ubuntu Server

Deluge is a great BitTorrent client that you can install on Ubuntu to allow you to share your favourite files with the rest of the BitTorrent community.

In the newer versions of Ubuntu, Deluge comes in two parts; the server (also called the daemon) and the user interface. This means you can install the Deluge daemon as a headless service and then control it from a remote machine. You can either control the daemon using the Deluge client itself (for example the Windows version of Deluge) or alternatively you can use your browser to control it. If you've not installed VNC and are running a purely headless setup then running Deluge headless is pretty much your only option! So, here's how you install it:

At the time of writing Deluge version 1.3.12 is the most up to date release for Xenial Xerus 16.04 LTS.

So, first off we need to create a new user called "deluge" and perform a couple more steps:

sudo adduser --disabled-password --system --home /var/lib/deluge --gecos "Deluge service" --group deluge

sudo touch /var/log/deluged.log

sudo touch /var/log/deluge-web.log

sudo chown deluge:deluge /var/log/deluge*

Install the Deluge Daemon

Next we'll install the Deluge daemon itself:

sudo apt-get update

sudo apt-get install deluged

Next we'll install the Web interface by typing:

sudo apt-get install deluge-webui

Run the Deluge Daemon on startup

Now we've got the components installed we need to make everything run on start-up.

A note about the storing of configuration files

If you're following my advice about storing configuration files separately then please note that with systemd scripts there has to be a copy stored directly on the Operating System partition. So, instead of linking to it we have to make a copy of it. That's no big deal really since we'll not need to edit the script once it's created.

So, let's create the first script we need by typing the following command:

sudo vim /media/WD40EFRX/RAIDMain/MyScripts/deluged.service

obviously substituting /media/WD40EFRX/RAIDMain/MyScripts with the location of your script files. This will create a file called deluged.service

Next, assuming you're using Putty, highlight the following commands, right-click on them and select Copy

[Unit]
Description=Deluge Bittorrent Client Daemon
After=network-online.target

[Service]
Type=simple
User=deluge
Group=deluge
UMask=000

ExecStart=/usr/bin/deluged -d

Restart=on-failure

# Configures the time to wait before service is stopped forcefully.
TimeoutStopSec=300

[Install]
WantedBy=multi-user.target

Toggle back to the Putty Session and press the [Insert] key once and add a couple of blank lines by pressing the [Enter] key. Next right click and the lines we've just copied above will be pasted into the file.

Now press the [Esc] key once and type :wq to save and quit out of the script. If you make a mistake editing the file then issue :q! instead of :wq to abort your changes.

Now let's copy it to the location required as part of systemd:

sudo cp  /media/WD40EFRX/RAIDMain/MyScripts/deluged.service /etc/systemd/system/deluged.service

as above substitute /media/WD40EFRX/RAIDMain/MyScripts with the location of your script files.

Starting the deluge daemon:

Now let's start the daemon and ensure it launches on startup (by default it will not):

sudo systemctl start deluged

sudo systemctl enable deluged

If at any time you want to stop the deluge daemon then you can do so by issuing the following command:

sudo systemctl stop deluged

To check the status of the daemon use status instead of stop in the above command.

Create the Web start-up script

Now we need to create the script to launch the web user interface:

sudo vim /media/WD40EFRX/RAIDMain/MyScripts/deluge-web.service

as above, substitute /media/WD40EFRX/RAIDMain/MyScripts with the location of your script files. This will create a file called deluge-web.service

Next highlight the following commands, right-click on them and select Copy

[Unit]
Description=Deluge Bittorrent Client Web Interface
After=network-online.target

[Service]
Type=simple

User=deluge
Group=deluge
UMask=027

ExecStart=/usr/bin/deluge-web

Restart=on-failure

[Install]
WantedBy=multi-user.target

Toggle back to the Putty Session and press the [Insert] key once and add a couple of blank lines by pressing the [Enter] key. Next right click and the lines we've just copied above will be pasted into the file.

Now press the [Esc] key once and type :wq to save and quit out of the script. If you make a mistake editing the file then issue :q! instead of :wq to abort your changes.

Now let's copy it to the location required as part of systemd:

sudo cp /media/WD40EFRX/RAIDMain/MyScripts/deluge-web.service /etc/systemd/system/deluge-web.service

Starting the Web daemon:

Now let's start the daemon and ensure it launches on startup (by default it will not):

sudo systemctl start deluge-web

sudo systemctl enable deluge-web

If at any time you want to stop the web daemon then you can do so by issuing the following command:

sudo systemctl stop deluge-web

To check the status of the daemon use status instead of stop in the above command.

Cross your fingers and restart the server by typing the following command:

sudo reboot -h now

Accessing Deluge via the web interface

You should now be able to access the Web front-end for Deluge by typing http://MyMediaserver:8112 into the address bar of your browser where MyMediaserver is the name you gave to your server when you installed Ubuntu. Alternatively the IP address of the server works just as well.

You should now be presented with the Deluge login-screen. Enter deluge for the password and you should then see a screen similar to this (Note: The version on Trusty looks slightly different to this). You'll be prompted to change the password so feel free to do so if you wish:

Deluge Web UI

Opening the correct ports on your router

In order to start downloading Torrents you need to open up some ports on your router. If you click on the Preferences icon (the screwdriver/spanner) on the Deluge web interface and select Network, the Incoming Ports (the From: and To: ports inclusively) are the ports you need to open on your router. You can obviously change these ports if you so wish, but make sure they match your router settings. Make sure you also uncheck the Use Random Ports option if you're going to be opening a specific port range on your router.

NOTE: The above instructions are a summary of the excellent guide which can be found here:

Still stuck? Not what you were looking for? Then head over to the Discussion Forum