It is nice to have a torrent client to download data from the web, but the issue is often that you do not want your workstation on 24/7 whenever you want to download something.

I have a  little server here that is doing the heavy lifting, so why not use a Virtual Machine in a server as a torrent client?

My server is running Windows Server 2008 R2, with Hyper-V installed on it. If you do not want to spend the money for a license for Windows, you might as well download Hyper-V server (which is free) or use Xen on Ubuntu Server as your virtualization platform. Whatever you end up using is for you to decide, that’s beyond the scope of this article.

The VM we’re doing to configure has the following characteristics:

  • Plenty of disk space (I’m using about 500Gb)
  • 256MB of memory (you really won’t need more)
  • One CD-Rom drive, one NiC, 1 Proc and the rest basically defaults

Step 1: Download and install Ubuntu server

You can download ubuntu server from Do yourself a favor and get the x64 edition. Mount the ISO, run the installation and accept most of the defaults.

During the installation it will ask you for a few things that are important:

  • Make a note of your username and password (both are case sensitive), you will need them.
  • Install OpenSSH

Step 2: Install PuTTY and FileZilla

PuTTY you will need to use whenever you want to connect to your server remotely. FileZilla is a real handy FTP tool, to download your files from your server to your PC. You can find both of these online.

Performing multiple steps as administrator

The following steps are mostly prefixed with the ‘sudo’ command, which elevates you to root. (which is the administrator if a unix system.) If you’re tired of typing your password over and over, or simply don’t want to type ’sudo’ all the time, use: ’sudo su’ This will elevate your session to root and will last untill you type ‘exit’. You won’t need to type ‘sudo’ in front of each command if you do this, but beware, you are now going on your system as a loose cannon.

Step 3: Change your network settings

Your server will need internet access. Depending on your environment you will need to change the IP address of your server to a fixed IP with a fixed DNS server or you might want to leave everything dynamic. If you want to change your settings to a static IP address, here’s how:

sudo nano /etc/network/interfaces  (nano is a text editor, there are also others like ‘vim’. )

A simple file can contain the following text:

auto lo
iface lo inet loopback

auth eth0
iface eth0 inet static
address <your IP address>
netmask <your network mask>
gateway <your router's address>
dns-nameservers <your DNS nameserver>

After you saved your changes to this file, you can use ifdown eth0 && ifup eth0 to reset your network card and accept the new settings. (Use sudo to elevate if needed.) Type ifconfig to see if your network addresses are correct.

Step 4: Update your Ubuntu server

Ubuntu, like any other OS, needs to be updates once in a while. Here are the commands to do so:

  • sudo apt-get update –> Updates the package repository
  • sudo apt-get upgrade –> Performs the actual update

Step 5: Time to get the interesting bits

We’re going to install the following components on your server:

  • A FTP server
  • Deluge Web UI
  • Deluge Deamon (the part that actually does the downloading for you)

For the deluge bits, we need to change the sources in the repository. Perform the following steps to do so:

  • sudo apt-get install pyton-software-properties
  • sudo apt-get install software-properties-common
  • sudo add-apt-repository ppa:deluge-team/ppa
  • sudo apt-get update

Step 5.1: Installing Deluge Deamon and Web UI

Now you have setup the sources list to obtain the deluge bits straight from the developers, making sure you get the latest and greatest work that they provide… Next step, install the deamon and the web UI

  • sudo apt-get install deluged
  • sudo apt-get install deluge-webui

Step 5.2: Installing The FTP server

The FTP server we’re using is called ‘vsftpd’ which is a simple ftp server. To install it:

  • sudo apt-get install vsftpd

Step 6: Configuring the beast

Configuring all this isn’t that hard, the problem with all of this is that if you got this far, you know that things might work, or might not, but in essence, you probably have no idea what every component is doing nor if it has been configured and so on. This part of the guide should clarify all this.

Step 6.1: Configuring Deluge

Deluge needs to be configured a bit. First of all, the server needs to start deluge once the server starts up, and stop it once it shuts down. Once deluge is started, the web ui may start up, and it should shut down once deluge shuts down. Ubuntu has upstart jobs for these kind of things. These are tiny configuration files wich contains the criteria when something starts and when something stops.

The deluge service needs to run under the identity of a user. This user we will call (appropiately) ‘deluge. Create a user with this command:

  • sudo adduser –system –group –home /var/lib/deluge deluge

This will create a user ‘deluge’ and a group ‘deluge’, a home directory for the user in /var/lib/deluge and add the user ‘deluge’ to the group ‘deluge’. You can add yourself to the deluge group by using the following:

  • sudo adduser <yourUserName> deluge

The next step is to create a file /etc/init/deluge.conf with the following content:

start on (filesystem and networking) or runlevel [2345]
stop on runlevel [016]

env uid=deluge
env gid=deluge
env umask=007

exec start-stop-daemon -S -c $uid:$gid -k $umask -x /usr/bin/deluged -- -d

You can create this file using the following command:

  • sudo nano /etc/init/deluge.conf

The same we need to do for the web UI:

  • sudo nano /etc/init/deluge-web.conf

This file should have the following content:

start on started deluge
stop on stopping deluge

env uid=deluge
env gid=deluge
env umask=027

exec start-stop-daemon -S -c $uid:$gid -k $umask -x /usr/bin/deluge-web

Once you have created these files, you should be able to start the whole thing with:

  • sudo start deluge

From this point on you can reach your deluge server with http://<your-server-address>:8112 and see the deluge web UI. The default password for the web ui is… ‘deluge’.

The next step is to allow your deluge client on your own PC connect to the deluge server you’ve just setup. To do so, go in the web UI to ‘Preferences’ and select ‘Deamon’ on the left side. On the right, check ‘Allow remote connections.’, click on ‘Apply’ and ‘Ok’.

Next, we need to setup a username and password for the remote deluge client, do this by editing the ‘auth’ file in the /var/lib/deluge/.config directory:

  • sudo nano /var/lib/deluge/.config/deluge/auth

When you open this file, you will see a line like ‘localclient:someHexNumber:10’, add a line to this file with:

  • yourUserName:yourPassword:10

The ’10’ indicates you may do everything on the server, see for the details.

Restart Deluge after this with:

  • sudo stop deluge
  • sudo start deluge

From this point, deluge is up & running.

Step 6.2: Configuring the FTP server

The FTP server is easy to configure, much easier than deluge itself. The configuration settings are in /etc/vsftpd.conf. To stop & start the service, use:

  • sudo /etc/init.d/vsftpd restart

There is a bit more detail about this service here:

Step 7: Configuring the Deluge client

To configure your workstation to connect to Deluge is quite easy. First of all, start deluge and it will connect to your local deamon. Since we don’t want this, disable ‘classic mode’ in Preferences -> Interface. Once disabled, restart the client and it should show you with a connection dialog. Enter your server’s address, username and password you configured in the auth file in step 6.1 and you should be good to go.

Finally, there’s some port forwarding to set up, you can see that in the ‘Network’ section of the preferences dialog, I have only one port forwarded to the deluge server (6881) and this works fine for my setup. Your milage may vary.

I hope you enjoyed this guide!


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.