Deluge is a very efficient torrent download/seeding client with a moderately good standard web ui. Though torrent is not acceptable to some extent on the moral ground, I can accept it to download software, songs, movies etc. for small personal uses. Actually why not. I live in India. Most of the Hollywood movies does not release in the theaters. The price of a Western music label is more than per capita income in this country. And I’m not going to sell or do some kind of business with the downloaded digital assets. And most of the movies are not that good to view multiple times. So download-watch-delete cycle is destined for them. With these logic I can justify my use of torrents.

There are several clients to use torrent. Why do we need one client with web ui. To remotely administer the download. Why? Personally I don’t like to keep my pc turned on whole night-n-day to download large files. And sometimes it really takes a painfully long time to download. Therefore we need to have a low cost solution for this task. You can setup one Raspberry PI in your home for this. Or you can buy one cheap VPS or if you are damn serious about seeding you can get one dedicated server with a good bandwidth allocation from a p2p allowing provider. In any of this cases you need one sufficiently robust torrent client with an acceptable ui. Deluge is one of the best in this category.

Let’s start. To start this thing, we have to understand that the world of torrent is really full of very troublesome torrents. Before leaving our server to download our favorite entertainment, we must secure our server to some extent with some defensive measures. [I’ll try to add a different post for this purpose]

One thing is that, to execute this whole procedure, one need to have at-least system administrator privilege for the login. First log into the system. If the login is for normal user, execute the command sudo -i and when prompted give your login password.

To run the Deluge server on our box, we will need one different user, than the users, we use to login into our system. For example we are using ‘deluge‘ as the name for both of our user and group.

adduser --disabled-password --system --home /var/lib/deluge --gecos "Deluge Server" --group deluge
  • --disabled-password disables the login with password, however login can be done by other means, for example by SSH RSA keys (though we don’t require this feature)
  • --system specifies that both user and group will be one SYSTEM user and group
  • --home specifies ‘/var/lib/deluge‘ as the home directory of the newly created user (for us it’s ‘deluge‘). One more thing is that, by default Deluge will be installed in this location
  • --gecos Specifies META data, to be inserted into the ‘/etc/passwd‘ about the user. Typically this information may be phone number, name of the user etc. We can put any information after this in double quote
  • --group this option combined with ‘–system‘, creates user and group with same name specified after this (for now, it’s ‘deluge‘)

To run Deluge, we need to run Deluge Server and Deluge Web. The web component is the interface for the user to interact with the Deluge Server. Now we need to create two files to be logged by two components. We can do that by:

touch /var/log/deluged.log
touch /var/log/deluge-web.log
chown deluge:deluge /var/log/deluge*</pre>
  • touch is a *nix utility to change the time-stamp of a file and if the file does not exist, it creates one empty file with the name and location specified
  • chown adds the ownership to the user and group specified. Here we have given permission/ownership of ‘/var/log‘ to user deluge of group deluge to write logs into the said directory

We have to add the Delugeppa‘ repository to get the latest package published for your Ubuntu distribution.

apt-get install software-properties-common
add-apt-repository ppa:deluge-team/ppa
apt-get update
  • software-properties-common gives the ‘add-apt-repository‘ command
  • apt-get update updates our apt cache for installation and update of software packages in the box

Now we are ready to install the Deluge packages.

apt-get install deluged deluge-webui</pre>
  • deluged is the Deluge server and
  • deluge-webui is the web interface of Deluge

To start Deluge server and Deluge WebUI at the start, we need to create two files in the /etc/init directory. Use your favorite editor to create the init script for Deluge daemon (server) /etc/init/deluged.conf

description "Deluge daemon"
author "Deluge Team"

start on filesystem and static-network-up
stop on runlevel [016]

respawn
respawn limit 5 30

env uid=deluge
env gid=deluge
env umask=000

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

and for Deluge WebUI /etc/init/deluge-web.conf .

description "Deluge Web UI"
author "Deluge Team"

start on started deluged
stop on stopping deluged

respawn
respawn limit 5 30

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

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

There are more details about this configurations here.

Now we can reboot our server by init 6 or reboot -h now or start the Deluge services by

service deluged start
service deluge-web start

Access the web interface at port 8112. http://yourserver_IP_OR_domain:8112 . It will prompt for a password. Type ‘deluge‘ and login. This is the default password for the WebUI. And we must change our password upon first login.

 

Also it may be required to connect the daemon by clicking the ‘Connection Manager‘ button at the top task-bar.

This is not complete. Yet we have to do a little configuration for the Deluge Daemon and mask our web port with a good context name on our server. We will use NginX for this. And along with that we will add a new security measure. But this is pending for next post. Until then have a good time. :)