Difference between revisions of "Deluge"

From ArchWiki
Jump to: navigation, search
(More consistancy (Previously: 50 different ways to type web ui).)
m (Added "allow_remote" setting change. The console connect yield "connection refused" otherwise.)
(48 intermediate revisions by 12 users not shown)
Line 3: Line 3:
 
[[ko:Deluge]]
 
[[ko:Deluge]]
 
[[Category:Internet Applications]]
 
[[Category:Internet Applications]]
 +
{{Article summary start}}
 +
{{Article summary text|A lightweight, full-featured BitTorrent application with a client/server model}}
 +
{{Article summary heading|Related}}
 +
{{Article summary wiki|rTorrent}}
 +
{{Article summary wiki|systemd}}
 +
{{Article summary wiki|systemd/User}}
 +
{{Article summary wiki|iptables}}
 +
{{Article summary wiki|OpenSSL}}
 +
{{Article summary heading|External Links}}
 +
{{Article summary text|[http://deluge-torrent.org/ Deluge Homepage]}}
 +
{{Article summary text|[http://dev.deluge-torrent.org/wiki Deluge Wiki]}}
 +
{{Article summary end}}
  
 +
[http://deluge-torrent.org/ Deluge] is a lightweight but full-featured BitTorrent application written in python2. It has a variety of features, including but not limited to: a client/server model, DHT support, magnet links, a plugin system, UPnP support, full-stream encryption, proxy support, and three different client applications. When the server daemon is running, users can connect to it via a console client, a gtk-based GUI, or a Web-based UI. A full list of features can be viewed [http://dev.deluge-torrent.org/wiki/About here].
  
 
+
==Installation==
This article will show you how to set up Deluge also for daemon-based torrenting.
+
{{Pkg|deluge}} is available from the [[official repositories]].
 
+
==Base Install==
+
Deluge is available in the official repositories:
+
 
  # pacman -S deluge
 
  # pacman -S deluge
  
==Graphical Clients==
+
The gtk UI requires additional dependencies as does the Web UI.  Inspect the pacman output to determine which are right for the intended application.
===Web UI===
+
python2-notify: libnotify notifications
The web UI runs on the server and the clients only need a web browser.
+
pygtk: needed for gtk ui
You need to install '''python2-mako''' on the server:
+
librsvg: needed for gtk ui
  # pacman -S python2-mako
+
  python2-mako: needed for web ui
  
===GTK UI===
+
==Daemon Setup==
The GTK UI needs to have '''pygtk''' and '''librsvg''' installed on the clients:
+
{{Warning|If multiple users are running a daemon, the default port (58846) will need to be changed for each user.}}
# pacman -S pygtk librsvg
+
Deluge comes with a daemon called {{ic|deluged}}. If it is not running when one of the clients is run, it will be started. It is useful, however, to have it started with systemd to allow torrents to run without starting a client and/or Xorg. This can be accomplished in one of two ways: a system service or a user service.
  
==Configuration==
+
===System Service===
If you want to run Deluge as user just run:
+
A system service will allow {{ic|deluged}} to run at boot without the need to start Xorg or a client. Deluge comes with a system service called {{ic|deluged.service}}, which can be started and enabled without change:
  # deluge -u [gtk|web|console]
+
  # systemctl start deluged
 +
# systemctl enable deluged
 +
This will run the deluge daemon as the '''deluge''' user, which is created by the deluge package. If you wish to run the daemon as another user, copy {{ic|/usr/lib/systemd/system/deluged.service}} to {{ic|/etc/systemd/system/deluged.service}} and change the User parameter within the file, such as the '''torrent''' user:
 +
User='''torrent'''
 +
In that case, you will have to create a user called '''torrent'''.
  
===daemon===
+
===User Service===
Please note, deluge works perfectly fine without its daemon running.
+
A user service will allow {{ic|deluged}} to run when {{ic|systemd --user}} is started. This is accomplished by creating a user service file:
The default user for deluged, the Deluge daemon, is "deluge". You can change this in {{ic|/etc/conf.d/deluged}}. Of course, the user needs to exist. In the case of the default "deluge" user, no manual user creation is necessary as the package script has done that for you.
+
{{hc|/etc/systemd/user/deluged.service|<nowiki>
 +
[Unit]
 +
Description=Deluge Daemon
 +
After=network.target
  
The rest of this guide will assume you use the default "deluge" user. This is that user's default home directory and therefore its configuration location is in ''/srv/deluge''. This should be fine under most circumstances. Note that this is NOT the default download location, it only holds its configuration and ssl certificates. You will be able to change all other options later on once you get a client working.
+
[Service]
 +
Exec=/usr/bin/deluged -d -P %h/.config/deluge/deluge.pid
  
Next, start the daemon to generate its default configuration in its home directory:
+
[Install]
  # rc.d start deluged
+
WantedBy=default.target
 +
</nowiki>}}
 +
The deluge user service can now be started and enabled by the user:
 +
  $ systemctl --user start deluged
 +
$ systemctl --user enable deluged
  
And add it to your {{ic|/etc/rc.conf}}, so it gets convieniently autostarted:
+
The {{ic|deluged}} user service can also be placed in {{ic|$HOME/.config/systemd/user/}}. See [[systemd/User]] for more information on user services.
DAEMONS=( ... network '''deluged''' ... )
+
  
===GTK UI===
+
==Configuration==
Stop the Deluge daemon:
+
Deluge can be configured through any of the clients as well as by simply editting the JSON-formatted configuration files located in {{ic|$HOME/.config/deluge/}}. '''$HOME''' refers to the home directory of the user that {{ic|deluged}} is running as. This means that if the daemon is running as the '''deluge''' user, the default home directory is {{ic|/srv/deluge/}}.
# rc.d stop deluged
+
  
If You want to connect remotely via the GTK UI, there should be something like this in {{ic|/srv/deluge/.config/deluge/core.conf}}:
+
===Firewall===
"allow_remote": true,
+
Deluge requires at least one port open for TCP and UDP to allow incoming connections for seeding. If deluge is informing you that it cannot open a port for incoming connections, you must open ports you wish to use. In this example, ports 56881 through 56889 are opened for TCP and UDP:
 +
# iptables -A INPUT -p tcp --dport 56881:56889 -j ACCEPT
 +
# iptables -A INPUT -p udp --dport 56881:56889 -j ACCEPT
 +
If you are behind a NAT router/firewall, port forwards are also required there. UPnP may also be used, but that will not work with the local firewall on the system that the daemon is running on because it requires predefined ports.
 +
{{Note|You can limit this to just one port, but you must open any ports for both TCP and UDP.}}
  
Now add yourself to the authentification file:
+
==Clients==
  # echo "yourusername:yourpassword:10" >> /srv/deluge/.config/deluge/auth
+
===Console===
 +
The console client can be run with:
 +
  $ deluge-console
 +
Enter the {{ic|help}} command for a list of available commands.
  
'''10''', the authentification level is not used at this time. Read [http://dev.deluge-torrent.org/wiki/UserGuide/Authentication more] about that.
+
===Gtk===
 +
{{Note|If you plan on using the daemon (server) functionality, it is wise to disable Classic Mode in '''Edit -> Preferences -> Interface'''. '''''This requires a restart of the client.'''''}}
 +
The gtk client can be run with:
 +
$ deluge-gtk
 +
or:
 +
$ deluge
  
Start the Deluge daemon again.
+
The gtk client has a number of useful plugins:
 +
* AutoAdd - Monitors directories for .torrent files
 +
* Blocklist - Downloads and imports an IP blocklist
 +
* Execute - Event-based command execution
 +
* Extractor - Extracts archived files upon completion '''''(beware of random high disk I/O usage)'''''
 +
* Label - Allows labels to be assigned to torrents, as well as state, tracker, and keyword filters
 +
* Notifications - Provides notifications (email, pop-up, blink, sound) for events as well as other plugins
 +
* Scheduler - Limits active torrents and their speed on a per-hour, per-day basis
 +
* WebUi - Allows the Web UI to be started via the gtk client
  
Now start the GTK UI. If You prefer, You can edit the preferences in {{ic|~/.config/deluge/gtkui.conf}}, but there's also a nice configuration tool in the UI.
+
===Web===
 +
{{Warning|If multiple users are running a daemon, the default port (8112) will need to be changed for each user.}}
 +
{{Note|It is recommended that you use '''https''' for the Web client.}}
 +
{{Warning|The deluge Web client comes with a default password. See the Setup section.}}
 +
The Web UI can be started by running {{ic|deluge-web}}, through a plugin in the gtk UI, or via systemd. It has many of the same features of the gtk UI, including the plugin system.
  
Look for '''classic mode''' and disable it. Then go to Edit -> Connection Manager and add your daemon.
+
====System Service====
 +
Deluge comes with a system service file called {{ic|deluge-web.service}}. The process for this is the same as starting {{ic|deluged.service}}, except with {{ic|deluge-web}} instead of {{ic|deluged}}. This service will also run as the '''deluge''' user unless the service file is modified in the same way as {{ic|deluged.service}}.
  
===Web UI===
+
====User Service====
First, start the web UI daemon:
+
A user service will allow {{ic|deluge-web}} to run when {{ic|systemd --user}} is started. This is accomplished by creating a user service file:
  # rc.d start deluge-web
+
  {{hc|/etc/systemd/user/deluge-web.service|<nowiki>
 +
[Unit]
 +
Description=Deluge Web UI
 +
After=deluged.service
  
and login in on ''http://deluge-machine:8112''. Where 'deluge-machine' is name of your Deluge server or its private or public IP address. When asked for a password, enter "deluge" as it's the default password.
+
[Service]
 +
Exec=/usr/bin/deluge-web --ssl
  
The preferences in the web UI should be rather self explanatory and the first obvious thing to do is to change your password.
+
[Install]
 +
WantedBy=default.target
 +
</nowiki>}}
 +
The deluge user service can now be started and enabled by the user:
 +
$ systemctl --user start deluge-web
 +
$ systemctl --user enable deluge-web
  
As usual, you should add the daemons to your {{ic|/etc/rc.conf}}:
+
The {{ic|deluge-web}} user service can also be placed in {{ic|$HOME/.config/systemd/user/}}. See [[systemd/User]] for more information on user services.
DAEMONS=( ... network deluged '''deluge-web''' ... )
+
  
Just make sure your network connection is up at the time you start either of those Deluge daemons.
+
====Setup====
 +
When {{ic|deluge-web}} is initially started, it will create {{ic|$HOME/.config/deluge/web.conf}}. The password in this file is hashed with SHA1 and salted. The default password is '''deluge'''. On the first visit, you will be advised to change the password.  
  
{{Note|In the current version of Deluge (1.3.1) the web UI will not work in Google Chrome unless system time is configured properly. The web UI will load, but upon entry of your password on the password prompt, it will return as if nothing had been entered. This is Chrome thinking the session has expired. The quick and easy way of solving this issue is to install the [[Network Time Protocol daemon|ntp]] package and add ''ntpd'' to your DAEMONS in {{ic|/etc/rc.conf}}.}}
+
You will also be greeted by a warning from your browser that the SSL certificate is untrusted. You must add an exception to this in your browser to continue on. See the [[OpenSSL]] page for information on creating your own certificate.
  
As of this writing, it is possible to use ProxyPass and ProxyPassReverse with Apache to run your Deluge web UI with a web server. To do so, install mod_proxy_html from the AUR. Then add the following lines to your httpd.conf.
+
==Headless Setup==
 +
Deluge is quite useful on a headless system, often referred to as a seed box, because of its client/server model. To set up deluge on a headless system, set up the daemon as shown above.
  
In the modules section add:
+
===Create a User===
 +
To allow interaction with the server remotely, create a user in {{ic|$HOME/.config/deluge/auth}}. For example:
 +
$ echo "delugeuser:p422WoRd:10" >> $HOME/.config/deluge/auth
 +
{{Note|The user/password created does not have to match any system users, and to maintain good security practices it should NOT!}}
 +
{{Note|The user/password in this file are not hashed or salted like in the web client config.}}
  
{{Ic|LoadModule proxy_html_module modules/mod_proxy_html.so}}
+
The number '''10''' corresponds to a level of '''Admin'''. Refer to the following table for additional values:
  
At the end of the file, in the Supplemental Configuration section, add the following two lines.
+
{| class="wikitable" align="center"
 +
|-
 +
! Level Name !! Level Value
 +
|-
 +
| None || 0
 +
|-
 +
|Read Only || 1
 +
|-
 +
| Normal || 5
 +
|-
 +
| Admin || 10
 +
|}
  
{{Ic|# Custom proxy html configuration <br> Include conf/extra/httpd-proxy-html.conf}}
+
{{Note|In Deluge 1.35, these values have no effect, but multiuser options are under development.}}
  
Also uncomment the Virtual Hosts line.
+
===Allow Remote===
  
{{Ic|Include conf/extra/httpd-vhosts.conf}}
+
The default settings disallow remote connections. Change the "allow_remote" setting in $HOME/.config/deluge/core.conf:
 
+
  "allow_remote": true,
That is all the editing that needs to be done for the httpd.conf. Next, navigate to the extra/ folder and edit the httpd-vhosts.conf file. Append to the file, the following.
+
 
+
{{Bc|<VirtualHost *:80> <br>
+
<br>
+
Servername dmz <br>
+
<br>
+
ProxyRequests off <br>
+
ProxyHTMLExtended on <br>
+
ProxyPass /deluge http://127.0.0.1:8112/ <br>
+
ProxyHTMLURLMap http://127.0.0.1:8112 /deluge <br>
+
<br>
+
Header unset Server <br>
+
<br>
+
<location /deluge>
+
        ProxyPassReverse / <br>
+
        ProxyPassReverseCookiePath / /deluge/ <br>
+
        SetOutputFilter INFLATE;proxy-html;DEFLATE <br>
+
        ProxyHTMLURLMap / /deluge/ ec <br>
+
        ProxyHTMLURLMap /deluge /deluge ec <br>
+
        ProxyHTMLURLMap ([^*])(\/[^*].*) $1/deluge$2 hRxL <br>
+
        #ProxyHTMLLogVerbose On <br>
+
        Order allow,deny <br>
+
        Allow from all <br>
+
</Location> <br>
+
<br>
+
</VirtualHost> <br>
+
}}
+
 
+
See http://blog.stoked-security.com/2011/03/deluge-bittorrent-webui-behind-reverse.html for the source and more information.
+
 
+
==Automatically Connect To Daemon==
+
If you want to avoid clicking "connect" everytime you start the Deluge web UI, edit the web.conf file in your configuration directory (usually /srv/deluge/.config/deluge).
+
It should have a line like this towards the bottom:
+
'''
+
  "default_daemon": ""
+
 
+
Change it to:
+
'''
+
"default_daemon": "127.0.0.1:58846"
+
 
+
This assumes that your Deluge port is the default 58846.
+
 
+
====SSL====
+
In case you want SSL for the web UI, you need to generate a new cert/key set. To do this, first stop the web UI:
+
 
+
# rc.d stop deluge-web
+
 
+
then go to ''/srv/deluge/.config/deluge/ssl/'' and issue:
+
 
+
# openssl req -new -x509 -nodes -out deluge.cert.pem -keyout deluge.key.pem
+
  
Next you need to edit {{ic|/srv/deluge/.config/deluge/web.conf}} and change the '''pkey''' and '''cert''' configuration directives to use your new self-signed certificates and also enable SSL:
+
===Firewall===
  ...
+
You will need to open the port for remote access. The following example uses the default daemon port (58846):
"pkey": "ssl/deluge.key.pem",
+
  # iptables -A INPUT -p tcp --dport 58846 -j ACCEPT
...
+
See [[iptables]] for more information on firewall rules.
"cert": "ssl/deluge.cert.pem",
+
...
+
"https": true,
+
  
Afterwards just start the web UI again and you should be good to go:
+
If you are behind a NAT router/firewall, a port forward is also required there to access the daemon from outside the network.
  
  # rc.d start deluge-web
+
===Connect===
 +
In the console client:
 +
  connect <host>[:<port>] <user> <password>
  
==Troubleshooting==
+
In the gtk client, {{ic|'''Edit -> Connection Manager -> Add'''}}.
=== Web UI doesn't store settings ===
+
For some yet unknown reason, the web interface with Deluge 1.3.3 refuses to properly store the incoming (listen) ports configuration. This can manually be edited in core.conf. The Deluge bugtracker mentions this is fixed, it is not in 1.3.3.
+
  
{{hc|/srv/deluge/.config/deluge/core.conf|...
+
In the Web client, {{ic|'''Connection Manager -> Add'''}}.
"enc_prefer_rc4": true,
+
"listen_ports": [
+
  49160,
+
  49249
+
],
+
"dht": false,
+
...}}
+
  
==Resources==
+
==See Also==
[http://deluge-torrent.org/ Deluge Homepage]
+
* [http://deluge-torrent.org/ Deluge homepage]
 +
* [http://dev.deluge-torrent.org/wiki Deluge wiki]

Revision as of 02:53, 2 August 2013

Template:Article summary start Template:Article summary text Template:Article summary heading Template:Article summary wiki Template:Article summary wiki Template:Article summary wiki Template:Article summary wiki Template:Article summary wiki Template:Article summary heading Template:Article summary text Template:Article summary text Template:Article summary end

Deluge is a lightweight but full-featured BitTorrent application written in python2. It has a variety of features, including but not limited to: a client/server model, DHT support, magnet links, a plugin system, UPnP support, full-stream encryption, proxy support, and three different client applications. When the server daemon is running, users can connect to it via a console client, a gtk-based GUI, or a Web-based UI. A full list of features can be viewed here.

Installation

deluge is available from the official repositories.

# pacman -S deluge

The gtk UI requires additional dependencies as does the Web UI. Inspect the pacman output to determine which are right for the intended application.

python2-notify: libnotify notifications
pygtk: needed for gtk ui
librsvg: needed for gtk ui
python2-mako: needed for web ui

Daemon Setup

Warning: If multiple users are running a daemon, the default port (58846) will need to be changed for each user.

Deluge comes with a daemon called deluged. If it is not running when one of the clients is run, it will be started. It is useful, however, to have it started with systemd to allow torrents to run without starting a client and/or Xorg. This can be accomplished in one of two ways: a system service or a user service.

System Service

A system service will allow deluged to run at boot without the need to start Xorg or a client. Deluge comes with a system service called deluged.service, which can be started and enabled without change:

# systemctl start deluged
# systemctl enable deluged

This will run the deluge daemon as the deluge user, which is created by the deluge package. If you wish to run the daemon as another user, copy /usr/lib/systemd/system/deluged.service to /etc/systemd/system/deluged.service and change the User parameter within the file, such as the torrent user:

User=torrent

In that case, you will have to create a user called torrent.

User Service

A user service will allow deluged to run when systemd --user is started. This is accomplished by creating a user service file:

/etc/systemd/user/deluged.service
[Unit]
Description=Deluge Daemon
After=network.target

[Service]
Exec=/usr/bin/deluged -d -P %h/.config/deluge/deluge.pid

[Install]
WantedBy=default.target
 

The deluge user service can now be started and enabled by the user:

$ systemctl --user start deluged
$ systemctl --user enable deluged

The deluged user service can also be placed in $HOME/.config/systemd/user/. See systemd/User for more information on user services.

Configuration

Deluge can be configured through any of the clients as well as by simply editting the JSON-formatted configuration files located in $HOME/.config/deluge/. $HOME refers to the home directory of the user that deluged is running as. This means that if the daemon is running as the deluge user, the default home directory is /srv/deluge/.

Firewall

Deluge requires at least one port open for TCP and UDP to allow incoming connections for seeding. If deluge is informing you that it cannot open a port for incoming connections, you must open ports you wish to use. In this example, ports 56881 through 56889 are opened for TCP and UDP:

# iptables -A INPUT -p tcp --dport 56881:56889 -j ACCEPT
# iptables -A INPUT -p udp --dport 56881:56889 -j ACCEPT

If you are behind a NAT router/firewall, port forwards are also required there. UPnP may also be used, but that will not work with the local firewall on the system that the daemon is running on because it requires predefined ports.

Note: You can limit this to just one port, but you must open any ports for both TCP and UDP.

Clients

Console

The console client can be run with:

$ deluge-console

Enter the help command for a list of available commands.

Gtk

Note: If you plan on using the daemon (server) functionality, it is wise to disable Classic Mode in Edit -> Preferences -> Interface. This requires a restart of the client.

The gtk client can be run with:

$ deluge-gtk

or:

$ deluge

The gtk client has a number of useful plugins:

  • AutoAdd - Monitors directories for .torrent files
  • Blocklist - Downloads and imports an IP blocklist
  • Execute - Event-based command execution
  • Extractor - Extracts archived files upon completion (beware of random high disk I/O usage)
  • Label - Allows labels to be assigned to torrents, as well as state, tracker, and keyword filters
  • Notifications - Provides notifications (email, pop-up, blink, sound) for events as well as other plugins
  • Scheduler - Limits active torrents and their speed on a per-hour, per-day basis
  • WebUi - Allows the Web UI to be started via the gtk client

Web

Warning: If multiple users are running a daemon, the default port (8112) will need to be changed for each user.
Note: It is recommended that you use https for the Web client.
Warning: The deluge Web client comes with a default password. See the Setup section.

The Web UI can be started by running deluge-web, through a plugin in the gtk UI, or via systemd. It has many of the same features of the gtk UI, including the plugin system.

System Service

Deluge comes with a system service file called deluge-web.service. The process for this is the same as starting deluged.service, except with deluge-web instead of deluged. This service will also run as the deluge user unless the service file is modified in the same way as deluged.service.

User Service

A user service will allow deluge-web to run when systemd --user is started. This is accomplished by creating a user service file:

/etc/systemd/user/deluge-web.service
[Unit]
Description=Deluge Web UI
After=deluged.service

[Service]
Exec=/usr/bin/deluge-web --ssl

[Install]
WantedBy=default.target
 

The deluge user service can now be started and enabled by the user:

$ systemctl --user start deluge-web
$ systemctl --user enable deluge-web

The deluge-web user service can also be placed in $HOME/.config/systemd/user/. See systemd/User for more information on user services.

Setup

When deluge-web is initially started, it will create $HOME/.config/deluge/web.conf. The password in this file is hashed with SHA1 and salted. The default password is deluge. On the first visit, you will be advised to change the password.

You will also be greeted by a warning from your browser that the SSL certificate is untrusted. You must add an exception to this in your browser to continue on. See the OpenSSL page for information on creating your own certificate.

Headless Setup

Deluge is quite useful on a headless system, often referred to as a seed box, because of its client/server model. To set up deluge on a headless system, set up the daemon as shown above.

Create a User

To allow interaction with the server remotely, create a user in $HOME/.config/deluge/auth. For example:

$ echo "delugeuser:p422WoRd:10" >> $HOME/.config/deluge/auth
Note: The user/password created does not have to match any system users, and to maintain good security practices it should NOT!
Note: The user/password in this file are not hashed or salted like in the web client config.

The number 10 corresponds to a level of Admin. Refer to the following table for additional values:

Level Name Level Value
None 0
Read Only 1
Normal 5
Admin 10
Note: In Deluge 1.35, these values have no effect, but multiuser options are under development.

Allow Remote

The default settings disallow remote connections. Change the "allow_remote" setting in $HOME/.config/deluge/core.conf:

"allow_remote": true,

Firewall

You will need to open the port for remote access. The following example uses the default daemon port (58846):

# iptables -A INPUT -p tcp --dport 58846 -j ACCEPT

See iptables for more information on firewall rules.

If you are behind a NAT router/firewall, a port forward is also required there to access the daemon from outside the network.

Connect

In the console client:

connect <host>[:<port>] <user> <password>

In the gtk client, Edit -> Connection Manager -> Add.

In the Web client, Connection Manager -> Add.

See Also