How to Install Deluge BitTorrent Client on Ubuntu 20.04 Desktop/Server

This tutorial will be showing you how to install Deluge on Ubuntu 20.04 desktop and server. Deluge is a free, open-source (GPL3) and lightweight BitTorrent client, available for Linux, FreeBSD, macOS and Windows. It has a rich collection of plugins that you can install to extend its functionality. For example, you can install the streaming plugin so you can stream video or audio directly from Deluge while downloading. The latest stable version, 2.0.3, was released on June 12, 2019.

Install Latest Version of Deluge on Ubuntu 20.04 Desktop from PPA

Ubuntu 20.04 software repository includes Deluge 2.0.3. However, when a newer version comes out, it would take some time for the Ubuntu team to update it. To ensure you get the newest version as soon as possible, you need to install it from the official Deluge PPA. Open up a terminal window, then run the following 3 commands one at a time.

sudo apt install software-properties-common

sudo add-apt-repository ppa:deluge-team/stable

sudo apt install deluge

This PPA also works on other Linux distributions that are based on Ubuntu such as Linux Mint and Elementary OS. If you already have deluge installed, then the above commands will update your deluge to the latest version. Don’t worry, your existing torrents will be fine.

Once installed, you can start it from the application menu.

deluge-ubuntu-20.04

Deluge 2.0.3 user interface

deluge ubuntu 20.04 install

How to Enable Deluge Autostart on Ubuntu 20.04 Desktop

To enable autostart at boot time, open the Startup Applications from your applications menu. Then click Add button to add a new startup program. In the Name field, you can enter something like “Deluge GTK”. In the Command field, enter /usr/bin/python /usr/bin/deluge-gtk. You can leave the comment field blank. Then click Add button.

deluge-ubuntu-20.04-autostart

Warning: You need to use a VPN to hide your IP address when downloading torrents, or you may receive copyright infringement complaints from motion picture companies and may face a financial penalty in a worst-case scenario.

Install Deluge BitTorrent on Ubuntu 20.04 Server

You can install Deluge BitTorrent daemon on a server and manage the program via the Deluge web interface (You control it in a web browser). Use the following commands to install Deluge daemon and Deluge Web interface on Ubuntu 20.04 server.

sudo apt install software-properties-common

sudo add-apt-repository ppa:deluge-team/stable

sudo apt install deluged deluge-web

Then create the deluge user and group so that deluge can run as an unprivileged user, which will increase your server’s security.

sudo adduser --system --group deluge

The --system flag means we are creating a system user instead of normal user. A system user doesn’t have password and can’t login, which is what you would want for Deluge. A home directory /home/deluge/ will be created for this user. You may want to add your user account to the deluge group with the following command so that the user account has access to the files downloaded by Deluge BitTorrent. Files are downloaded to /home/deluge/Downloads by default. Note that you need to re-login for the groups change to take effect.

sudo adduser your-username deluge

Once that’s done, create a systemd service file for deluge with your favourite text editor such as nano.

sudo nano /etc/systemd/system/deluged.service

Copy and paste the following lines into the file. By default, deluged will run as a background daemon. Since we run it as a systemd service, which already runs in the background, so we add the -d (--do-not-daemonize) option to make it run in the foreground.

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

[Service]
Type=simple
User=deluge
Group=deluge
UMask=007
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

To save a file in Nano text editor, press Ctrl+O, then press Enter to confirm. To exit, press Ctrl+X. Now restart deluge deamon with the following command.

sudo systemctl restart deluged

You may also want to enable auto-start when Ubuntu 20.04 is booting up.

sudo systemctl enable deluged

Check Deluge status:

systemctl status deluged

You can see that deluged is running and autostart is enabled. If it’s exited or isn’t running, you may need to restart it with sudo systemctl restart deluged.

deluge-ubuntu-20.04-server

Accessing Deluge WebUI

To be able to access the deluge WebUI, we also need to create a systemd service file for deluge web.

sudo nano /etc/systemd/system/deluge-web.service

Copy and paste the following text into the file. By default, deluge-web will run as a background daemon. Since we run it as a systemd service, which already runs in the background, so we add the -d (--do-not-daemonize) option to make deluge-web run in the foreground.

[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 -d
Restart=on-failure

[Install]
WantedBy=multi-user.target

Save and close the file. Then start and enable deluge-web, check its status.

sudo systemctl start deluge-web

sudo systemctl enable deluge-web

systemctl status deluge-web

Once the deluge-web service is running, it listens on TCP port 8112. Now in your Web browser address bar, type

your-server-ip:8112

You will be asked to enter a password, which by default is deluge, to access the Web UI. (Your firewall might be preventing access to port 8112, so check your firewall setting if you can’t access the web UI).

deluge-webui-password-ubuntu-20.04

It’s recommended to change the default password. After you choose to change password, the connection manager window will pop up asking you to connect to Deluge daemon which is listening on 127.0.0.1:58846. Select the connection and click Connect button.

deluge-web-ubuntu-server-20.04.

Then you will be able to change the WebUI password.

install-deluge-ubuntu-server-20.04

 

To add new torrents, click the add button on the upper left corner. You can add a torrent file from your local computer or add magnet link. By default, files are downloaded to /home/deluge/Downloads directory.

install-deluge-webui-ubuntu-20.04

Set Up Reverse Proxy for Deluge WebUI

A reverse proxy is a proxy for another server, in this case the Deluge WebUI. You can set up reverse proxy so that you will be able access Deluge WebUI from a domain name and secure HTTPS connection. I will show you how to set up reverse proxy with Nginx and Apache.

Nginx

Nginx is a very popular web server and reverse proxy. If you prefer to use Nginx, run the following command to install it on Ubuntu 20.04.

sudo apt install nginx

Start Nginx

sudo systemctl start nginx

Then create an Nginx server block file for Deluge WebUI.

sudo nano /etc/nginx/conf.d/deluge-webui.conf

Copy and paste the following texts into the file. Replace the red-colored text with your own domain name. You should also set DNS A record for your domain name. If you don’t have a real domain name, I recommend going to NameCheap to buy one. The price is low and they give whois privacy protection free for life.

server {
  listen 80;
  listen [::]:80;
  server_name torrent.yourdomain.com;

  access_log /var/log/nginx/deluge-web.access;
  error_log /var/log/nginx/deluge-web.error;

  location / {
    proxy_pass http://127.0.0.1:8112;
  }
}

Save and close the file. Then test Nginx configuration.

sudo nginx -t

If the test is successful, reload Nginx

sudo systemctl reload nginx

Now you can access Deluge WebUI via your domain name (torrent.yourdomain.com).

Apache

If you prefer Apache over Nginx, then install Apache web server on Ubuntu 20.04 by using the following command.

sudo apt install apache2

To use Apache as a reverse proxy, we need to enable the proxy modules and the header module.

sudo a2enmod proxy proxy_http headers proxy_wstunnel

Then create a virtual host file for Deluge WebUI.

sudo nano /etc/apache2/sites-available/deluge-webui.conf

Put the following configurations into the file. Replace torrent.yourdomain.com with your actual domain name. Don’t forget to create DNS A record for this sub-domain. If you don’t have a real domain name, I recommend going to NameCheap to buy one. The price is low and they give whois privacy protection free for life.

<VirtualHost *:80>
   ServerName torrent.yourdomain.com
   ErrorDocument 404 /404.html

   #HTTP proxy
   ProxyPass / http://localhost:8112/
   ProxyPassReverse / http://localhost:8112/

   Header always unset X-Frame-Options
</VirtualHost>

Save and close the file. Then enable this virtual host.

sudo a2ensite deluge-webui.conf

Restart Apache

sudo systemctl restart apache2

Now you can access Deluge WebUI via your domain name (torrent.yourdomain.com).

Listening on localhost only

After setting up the reverse proxy, we can configure deluge-web process to listen only on localhost (127.0.0.1), so that it’s not directly exposed to the Internet. To achieve that, we need to edit the systemd service file.

sudo nano /etc/systemd/system/deluge-web.service

Find the following line.

ExecStart=/usr/bin/deluge-web -d

Change it to

ExecStart=/usr/bin/deluge-web -d -i 127.0.0.1

Save and close the file. Then reload systemd daemon.

sudo systemctl daemon-reload

And restart deluge-web service.

sudo systemctl restart deluge-web

You can check the listening status with:

sudo ss -lnpt | grep 8112

Enable HTTPS

To secure the Web UI, you can install a free Let’s Encrypt certificate. First you need to install the Let’s Encrypt client (certbot) on Ubuntu 20.04 server.

sudo apt install certbot

If you use Nginx, then you also need to install the Certbot Nginx plugin.

sudo apt install python3-certbot-nginx

Next, run the following command to automatically obtain and install Let’s Encrypt certificate.

sudo certbot --nginx --agree-tos --redirect --hsts --staple-ocsp --email [email protected] -d torrent.yourdomain.com

If you use Apache, then you need to install the Certbot Apache plugin.

sudo apt install python3-certbot-apache

Next, run the following command to obtain and install TLS certificate.

sudo certbot --apache --agree-tos --redirect --hsts --staple-ocsp --email [email protected] -d torrent.yourdomain.com

Where:

  • –nginx: Use the Nginx authenticator and installer
  • –apache: Use the Apache authenticator and installer
  • –agree-tos: Agree to Let’s Encrypt terms of service
  • –redirect: Enforce HTTPS by adding 301 redirect.
  • –staple-ocsp: Enable OCSP Stapling.
  • –email: Email used for registration and recovery contact.
  • -d flag is followed by a list of domain names, separated by comma. You can add up to 100 domain names.

You will be asked if you want to receive emails from EFF(Electronic Frontier Foundation). After choosing Y or N, your TLS certificate will be automatically obtained and configured for you, which is indicated by the message below.

deluge webui https certbot

Once that’s done, refresh deluge Web UI. It will be automatically redirected to HTTPS connection.

Having Trouble Obtaining TLS Certificate?

If you see the following error while trying to obtain TLS certificate:

module 'acme.challenges' has no attribute 'TLSSNI01'

You need to edit a config file.

sudo nano /usr/lib/python3/dist-packages/certbot_nginx/configurator.py

Change

return [challenges.HTTP01, challenges.TLSSNI01]

to:

return [challenges.HTTP01]

Save and close the file. Then run the above certbot command again.

Wrapping Up

I hope this tutorial helped you install Deluge on Ubuntu 20.04 desktop or server. As always, if you found this post useful, then subscribe to our free newsletter to get more tips and tricks. Take care.

Rate this tutorial
[Total: 4 Average: 4.8]

17 Responses to “How to Install Deluge BitTorrent Client on Ubuntu 20.04 Desktop/Server

  • Mike Starr
    11 months ago

    Awesome tutorial, LB. Don’t particularly need a Torrent client for myself right now but when I do I will remember Deluge and your tutorial.

  • I have got Deluged working (at least it says it is active (running)) but when I check deluge-web I get this:

    m*a:~$ systemctl status deluge-web
    ● deluge-web.service - Deluge Bittorrent Client Web Interface
         Loaded: loaded (/etc/systemd/system/deluge-web.service; enabled; vendor preset: enabled)
         Active: inactive (dead) since Fri 2020-06-26 14:15:58 BST; 45s ago
       Main PID: 62586 (code=exited, status=0/SUCCESS)
    
    Jun 26 14:15:57 s*t deluge-web[62586]: Unable to initialize gettext/locale!
    Jun 26 14:15:57 s*t deluge-web[62586]: 'ngettext'
    Jun 26 14:15:57 s*t deluge-web[62586]: Traceback (most recent call last):
    Jun 26 14:15:57 s*t deluge-web[62586]:   File "/usr/lib/python3/dist-packages/deluge/i18n/util.py", line 118, in setup_translation
    Jun 26 14:15:57 s*t deluge-web[62586]:     builtins.__dict__['_n'] = builtins.__dict__['ngettext']
    Jun 26 14:15:57 s*t deluge-web[62586]: KeyError: 'ngettext'

    Here is my Deluge Web Service:

    m*a:~$ sudo vi /etc/systemd/system/deluge-web.service
    [Unit]
    Description=Deluge Bittorrent Client Web Interface
    After=network-online.target
    
    [Service]
    Type=simple
    [email protected]
    Group=deluge
    UMask=027
    ExecStart=/usr/bin/deluge-web -d
    Restart=on-failure
    
    [Install]
    WantedBy=multi-user.target

    I have tried with and without a ‘-d’ on the ‘ExecStart=/usr/bin/deluge-web’ line

    • I got it working. I removed deluge-web ran sudo apt install software-properties-common then started again.

      Get guide.

      One more question can I use LetsEncrypt on a domain like ‘yourdomain.ddns.net’?

      • Hey Andrew just wondering if you did anything else to get it working. I’m getting the same error regarding ngettext so followed your lead, removed deluge-web and then ran sudo apt install software-properties-common, then apt install deluge-web and started it up, but still get the same error. Was there anything else that you did to get rid of that?

        • Andrew
          6 months ago

          I am sorry David, I do not remember doing anything else.

        • David
          6 months ago

          Thanks anyway Andrew. FWIW and in case it might be of interest to anyone else, I was able to fix by manually editing /usr/lib/python3/dist-packages/deluge/i18n/util.py by adding brackets around ‘ngettext’ in line 117 – see https://dev.deluge-torrent.org/changeset/d6c96d629183e8bab.

          - gettext.install(I18N_DOMAIN, translations_path, names='ngettext', **kwargs) 
          + gettext.install(I18N_DOMAIN, translations_path, names=['ngettext'], **kwargs)
          

          I imagine it will get overwritten by updates, but hopefully by then the patch will have worked its way into the update.

    • I don’t use ddns.net, but in theory, as long as your web browser can load a web page from “yourdomain.ddns.net”, you can use certbot to obtain a free Let’s Encrypt certificate.

      • Hello Xiao,
        I have a diffrent subnet for my VM in UNRAID running Ubuntu, what should i do to make it work?

        Andre

  • I followed this guide however I can’t connect to the Deluge server from another system on the network using deluge to sign in with the user I created in auth and I also enabled it under core.conf

    However I can access the WebUI still from the other machine.

  • I got this when I ran systemctl status deluged and it turned out that I hadn’t actually installed deluged! I had run apt-get install deluge, but I needed to also run apt-get install deluged

    systemd[1]: deluged.service: Service hold-off time over, scheduling restart.
    systemd[1]: Stopped Deluge Bittorrent Client Daemon.
    systemd[1]: deluged.service: Start request repeated too quickly.
    systemd[1]: Failed to start Deluge Bittorrent Client Daemon.
    systemd[1]: deluged.service: Unit entered failed state.
    systemd[1]: deluged.service: Failed with result ‘start-limit’.

  • sudo apt install deluge

    Receiving error wwhile running above command –
    E: dpkg was interrupted, you must manually run ‘sudo dpkg –configure -a’ to correct the problem.

    • It’s because a previous apt install command was interrupted on your system. You need to run sudo dpkg –configure -a to finish the previous apt install command.

      Then install Deluge.

      sudo apt install deluge
  • Thanks, for this really fantastic write-up!

  • Thank you very much, I’m new with Ubuntu (20.04) and finally I’ve been able to get it working perfectly on my VPS, very easy to understand!!!
    By the way, is it very different to do it but with rtorrent? I have tried many guides but I can’t always understand them 100%.

  • Thierry
    1 month ago

    Hello,

    First of all, thank you very much for all your tutorials.
    I build a home server which run almost perfectly.
    Your tutorial are very good explain.

    I have problem with torrent software, I also tried Transmission without any succes. I think that there is probably a problem with IPTABLES/UFW.

    I followed your tutorial for Wireguard, LAMP, Nextcloud, Plex

    Could you help me to solve my problem?

    Thanks in advance

    Thierry

  • hi, Thanks for the walk through – it was really helpful. I’ve ran into one problem though in that once I’ve set for local listening only I can still access my domain name from an outside connection. Simple test was to try from my phone and I can access the website so not sure what’s gone wrong. I used the apache route for access.

    The output of running ‘ sudo ss -lnpt | grep 8112 ‘ is below. I’m not sure whether what its showing is correct or how to troubleshoot it.

    LISTEN 0 50 127.0.0.1:8112 0.0.0.0:* users:((“deluge-web”,pid=728,fd=7))

    Thanks for any help.

  • Srikar
    6 days ago

    hi i forgot password of deluge-web. How can i reset it?

Leave a Comment

  • Comments with links are moderated by admin before published.
  • Your email address will not be published.
  • Use <pre> ... </pre> HTML tag to quote the output from your terminal/console.
  • Please use the community (https://community.linuxbabe.com) for questions unrelated to this article.
  • I don't have time to answer every question. Making a donation would incentivize me to spend more time answering questions.

The maximum upload file size: 2 MB. You can upload: image. Links to YouTube, Facebook, Twitter and other services inserted in the comment text will be automatically embedded.