How to Install Deluge BitTorrent Client on Ubuntu 18.04 Desktop and Server

This tutorial will be showing you how to install Deluge on Ubuntu 18.04 desktop and server. Deluge is a free, open-source (GPL3) and lightweight BitTorrent client, available for Linux, FreeBSD, Mac OS X 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, 1.3.15, was released on May 12, 2017.

Install Latest Version of Deluge on Ubuntu 18.04 Desktop from PPA

Ubuntu 18.04 software repository includes Deluge 1.3.15. 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 official Deluge PPA. Open up a terminal window, then run the following 2 commands one at a time.

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

sudo apt install deluge

Note that on Ubuntu 18.04, you don’t need to manually run sudo apt update after adding a PPA. It will run automatically. 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 application menu.

deluge ubuntu 18.04

Deluge 1.3.15 user interface

deluge ubuntu install

How to Enable Deluge Autostart on Ubuntu 18.04 Desktop

To enable autostart, 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. Click Add.

deluge ubuntu autostart

You may want to use a VPN to hide your IP address when downloading torrents.

Install Deluge BitTorrent on Ubuntu 18.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 command to install Deluge daemon and Deluge Web interface on Ubuntu 18.04 server.

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

sudo apt install deluged deluge-webui

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 gpasswd -a 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.

[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. Now start deluge deamon with the following command. Since we want Deluge to run as the deluge user, there’s no need to add sudo to the command, but you will be asked to enter your password.

systemctl start deluged

deluge ubuntu 18.04 server

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

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 systemctl restart deluged.

install deluge ubuntu 18.04

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 texts into the file.

[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

Save and close the file. Then start and enable deluge-web, check its status. Again, there’ no need to add sudo to the commands.

systemctl start deluge-web

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

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

Then you will be able to change the WebUI password. Note that you need to click the Change button to apply this change.

install deluge ubuntu server 18.04

And now you can use Deluge BitTorrent on your Ubuntu 18.04 server from the web interface.

set up deluge ubuntu server

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 18.04

Set Up Nginx Reverse Proxy for Deluge WebUI

A reverse proxy is a proxy for another server, in this case the Deluge WebUI. First install Nginx on Ubuntu 18.04.

sudo apt install nginx

Start Nginx

sudo systemctl start nginx

Then create a 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 the A record for your domain name.

server {
  listen 80;
  server_name torrent.yourdomain.com;

  access_log /var/log/nginx/torrent.yourdomain.com.access;
  error_log /var/log/nginx/torrent.yourdomain.com.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). Now you may want the deluge-web process to listen only on localhost (127.0.0.1), so that it’s not 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

Change it to

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

Save and close the file. Then reload systemd daemon.

systemctl daemon-reload

And restart deluge-web service.

systemctl restart deluge-web

You can check the listening status with:

sudo netstat -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 18.04 server.

sudo apt install software-properties-common

sudo add-apt-repository ppa:certbot/certbot

sudo apt install certbot python3-certbot-nginx

Python3-certbot-nginx is the Certbot Nginx plugin. After they are installed, run the following command to automatically obtain and install Let’s Encrypt certificate.

sudo certbot --nginx --redirect --agree-tos --hsts --staple-ocsp --email your-email-address -d torrent.yourdomain.com

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

I hope this tutorial helped you install Deluge on Ubuntu 18.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: 14 Average: 4.4]

37 Responses to “How to Install Deluge BitTorrent Client on Ubuntu 18.04 Desktop and Server

  • Andrew Walden
    5 months ago

    I don’t know if you want to update this guide?
    But when starting the service I came across this error:

    andy@media-server:~$ systemctl start deluged
    ==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
    Authentication is required to start 'deluged.service'.
    Authenticating as: Andrew Walden (andy)
    Password:
    ==== AUTHENTICATION COMPLETE ===
    Warning: The unit file, source configuration file or drop-ins of deluged.service changed on disk. Run 'systemctl daemon-reload' to reload units.
    
    • Xiao Guo-An (Admin)
      5 months ago

      The warning already told you what you need to do: run systemctl daemon-reload, then restart deluged systemctl restart deluged

  • If you’re running ubuntu server (at least for 18.04.1), you’ll find missing dependencies when apt installing deluged. add-apt-repository universe solves this.

  • Andrew Walden
    4 months ago

    Thanks. That helped a lot.

  • Everything worked great until virtual host part.

    I already have ssl enabled, port 80 is blocked and everything goes through 443

    I tried changing “listen 443” but no joy

    any help?

  • I know where I went wrong now, I didn’t create an A record for torrent.domain

    all working now, thank you!!

  • what do you think of conf.d vs sites-available/enabled

    • Xiao Guo-An (Admin)
      2 months ago

      sites-available/enabled is a debian/Ubuntu specific thing. The upstream Nginx package does not use these two directories.

      There’s no real difference between conf.d and sites-available/enabled. Both of them need to be included in nginx.conf before you can use them. I choose to use conf.d because I don’t have to run another command to create symbolic link.

  • jeppezon
    1 month ago

    I have the issue where I try to visit the website and I get greeted by “Welcome to nginx!”
    It was working before I enable the https part.
    Also I’m not sure if I add the “A record” correctly. I went in to
    /etc/hosts
    and added:
    192.168.1.xx torrent.mydomain.com

    where I ofc replaced xx and torrent.mydomain.com
    is this the correct way of doing it?
    Also I tried changing the listen port to 443 since it’s https but then I don’t get any website, just connection refused.

    • Xiao Guo-An (Admin)
      1 month ago

      Hi, to access deluge from outside network via a domain name, first you need to buy a domain name. I recommend NameCheap because the price is low and you get whois privacy protection free for life.

      To create A record, go to the domain registrar’s DNS manager and point your domain name to your public IP address.

      • jeppezon
        1 month ago

        I’m using no-ip and it’s linked to my IP.
        The problem is when I connect to the mydns.com with https enabled I get to the Nginx welcome page, telling me that I need to configure it.
        If I disable the https and use http I get to deluge.

    • Xiao Guo-An (Admin)
      1 month ago

      You can delete the default virtual host.

      sudo rm /etc/nginx/sites-enabled/default

      Then reload Nginx.

      sudo systemctl reload nginx
      • jeppezon
        1 month ago

        Did not help, then I get 404.

      • jeppezon
        1 month ago

        The problem is that it do not how to transfer the https to my 127.0.0.1:xxx
        It works fine with http.

    • Xiao Guo-An (Admin)
      1 month ago

      You don’t need to edit /etc/hosts file.

      Please check Nginx error log (/var/log/nginx/error.log)

      • jeppezon
        1 month ago

        Removed the entry I had in hosts.
        I tried to reinstall my cert with the command
        sudo certbot –nginx –redirect –agree-tos –hsts –staple-ocsp –email your-email-address -d torrent.yourdomain.com

        Now, trying to connect with https I get the error “ERR_TOO_MANY_REDIRECTS”.

        The last entry in the error log is:
        2018/11/13 11:00:41 [warn] 22186#22186: conflicting server name “domain.com” on 0.0.0.0:80, ignored

    • Xiao Guo-An (Admin)
      1 month ago

      Change the listen port back to original in deluge. Then restart nginx.

      Look for errors in the log, not warnings.

      • jeppezon
        1 month ago

        Reinstalled nginx, certbot python3-certbot-nginx and software-properties-common. now it’s working.

  • Amadeus
    6 years ago

    Thanks for this amazing how-to-tutorial !

    However I didnt get it up and running following this guide 🙁

    So if anyone get the same problems with the deluge-web(UI) not starting here is how to fix it:

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

    Edit: ExecStart=/usr/bin/deluge-web
    After Edit: ExecStart=/usr/bin/deluge-web -d

    Save file: Ctrl+X+Y and hit Enter

    Last but not least:

    sudo systemctl daemon-reload
    sudo systemctl start deluge-web.service
    sudo systemctl status deluge-web.service

    Hopefully it helps someone 🙂

    Kinds Regards / Amadeus

  • Thank you for this guide it works perfect 🙂

    One thing to mention, I feel that there is a step missing with ssl right at the end?

    Thanks again!

  • Great tutorial! I was wondering though, how do I set up auto-connect with the daemon? There is no web.conf it seems…

    Thanks in advance!

    • Xiao Guo An (Admin)
      5 years ago

      I’m not sure what you mean by “auto-connect with the daemon”.

  • Hey all,
    This worked for me with some additional steps.
    The trouble I had was connecting to the Web-UI from another PC. Here is what I did to resolve it.

    1. Stop all instances of deluged and deluge-web.

    sudo systemctl stop deluged && sudo systemctl stop deluge-web

    2. Run deluged as local user (not the deluge user which we cannot log into). This will create /home/user/.config/deluge/core.conf

    deluged

    3. Kill the process deluged.

    ctrl + c

    4. Create directories /home/deluge/.config/deluge/ as deluge

     sudo -u deluge mkdir /home/deluge/.config 
     sudo -u deluge mkdir /home/deluge/.config/deluge

    5. Modify /home/user/.config/deluge/core.conf to show “allow_remote”: true,

    nano /home/user/.config/deluge/core.conf
    "allow_remote": true,

    6. Copy /home/user/.config/deluge/core.conf to /home/deluge/.config/deluge/

    sudo cp /home/user/.config/deluge/core.conf /home/deluge/.config/deluge/

    7. Change ownership of /home/deluge/.config/deluge/core.conf to deluge:deluge

    sudo chown deluge:deluge /home/deluge/.config/deluge/core.conf

    8. Delete /home/user/.config/deluge/

    sudo rm -r /home/user/.config/deluge

    9. Startup deluged and deluge-web as per instructions.

    sudo systemctl start deluged && sudo systemctl start deluge-web

    Hope this helps someone else.

  • Carlo Wood
    5 years ago

    `A home directory /home/deluge/ will be created for this user` this is not correct. The “home” directory of a system user is `/var/lib/deluge` (at least on ubuntu – likely also debian and derivatives).

    • Xiao Guoan (Admin)
      5 years ago

      This is probably because you are installing a newer version of Deluge. I will check and update the article later.

      • Carlo Wood
        5 years ago

        Actually, I take that back. Later I found that it *is* created.

        However, that is not what I want – or what should happen. On debian (and ubuntu) the normal user that deluged runs under is ‘debian-deluged’ which gets as home directory `/var/lib/deluged`. Although we DO want to change that user, because deluge seems to have a bug that makes it impossible to log into deluged using web-deluge when there is a ‘-‘ in the username (see https://forum.deluge-torrent.org/viewtopic.php?t=55340#p229626), it seems to make sense to still keep using `/var/log/deluged`. Unfortunately this requires to forcefully change the user and group of the following directories after installation of deluged: `sudo chown -R deluge:deluge /var/lib/deluged /var/log/deluged` which is slightly ugly since their user id and group is stored as part of the package installation (aka, what will happen when those packages are upgraded? I don’ t know yet.)

        I am currently still fighting with getting this to work :/.

  • Carlo Wood
    5 years ago

    Ok, I got it to work. Since it is in some points significantly different from this HowTo, I hope you’ll allow me to add my solution here:

    Installing deluge

    sudo apt install -y deluged deluge-web

    Create a user group deluge/deluge

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

    Add yourself to this group

    sudo adduser yourname deluge

    Create the file /etc/systemd/system/deluged.service with the following contents:

    [Unit]
    Description=Deluge Bittorrent Client Daemon
    Documentation=man:deluged
    After=network-online.target
    
    [Service]
    Type=simple
    UMask=007
    
    ExecStart=/usr/bin/deluged -d -l /var/log/deluge/daemon.log -L warning
    
    Restart=on-failure
    
    # Time to wait before forcefully stopped.
    TimeoutStopSec=300
    
    [Install]
    WantedBy=multi-user.target
    

    Create directory:

    sudo mkdir /etc/systemd/system/deluged.service.d/

    Create the file /etc/systemd/system/deluged.service.d/user.conf with the following contents:

    # Override service user
    [Service]
    User=deluge
    Group=deluge
    

    Create a log directory for Deluge and give the service user (e.g. deluge), full access:

    sudo mkdir -p /var/log/deluge
    sudo chown -R deluge:deluge /var/log/deluge
    sudo chmod -R 750 /var/log/deluge
    

    Start the service:

    sudo systemctl enable /etc/systemd/system/deluged.service
    sudo systemctl stop deluged
    sudo systemctl start deluged
    sudo systemctl status deluged
    

    Create the file /etc/systemd/system/deluge-web.service containing the following:

    [Unit]
    Description=Deluge Bittorrent Client Web Interface
    Documentation=man:deluge-web
    After=network-online.target deluged.service
    Wants=deluged.service
    
    [Service]
    Type=simple
    UMask=027
    
    ExecStart=/usr/bin/deluge-web -l /var/log/deluge/web.log -L warning
    
    Restart=on-failure
    
    [Install]
    WantedBy=multi-user.target
    

    Create directory:

    sudo mkdir /etc/systemd/system/deluge-web.service.d/

    Create the file /etc/systemd/system/deluged.service.d/user.conf with the following contents:

    # Override service user
    [Service]
    User=deluge
    Group=deluge
    

    Start the service:

    sudo systemctl enable /etc/systemd/system/deluge-web.service
    sudo systemctl start deluge-web
    sudo systemctl status deluge-web
    

    Log files will be written to /var/log/deluge/.

    Downloaded files need to written to a directory with write access for deluge:deluge
    and gives also access to you (in group deluge). I use the following, where I download
    to `/opt/verylarge/deluge/downloads` and move completed to `/opt/verylarge/deluge/completed`

    cd /opt/verylarge
    sudo mkdir deluge
    sudo chown deluge:deluge deluge
    sudo chmod 2770 deluge
    sudo -u deluge mkdir deluge/completed
    sudo chmod 770 deluge/completed
    sudo chmod g-s deluge/completed
    

    Test:

    sudo -u deluge ls -al deluge
      total 12
      drwxrws---  3 deluge deluge 4096 apr 16 17:00 .
      drwxr-xr-x 12 root   root   4096 apr 16 16:56 ..
      drwxrwx---  2 deluge deluge 4096 apr 16 17:00 completed
    

    Connect to http://localhost:8112/ with browser.
    Password is ‘deluge’ – change it.

  • OptimusPrime
    5 years ago

    Hi. Following the guide, I had no issues installing Desktop and Server version. However, I don’t see my desktop torrents reflected in the server webui. Please advise, was there a step I missed? I downloads find in the desktop console.

    • Xiao Guoan (Admin)
      5 years ago

      The desktop version and server version are two separate programs. They don’t share torrents with each other.

  • Hi

    Is there a way of completely removing deluge server version and all it’s components from my ubuntu server?

    Thanks

    • Xiao Guoan (Admin)
      5 years ago

      Remove the binary.

      sudo apt purge deluged deluge-webui

      Disable auto-start at boot time.

      sudo systemctl disable deluged deluge-web

      Remove the systemd service file

      sudo rm /etc/systemd/system/deluged.service
      
      sudo rm /etc/nginx/conf.d/deluge-webui.conf

      Remove Nginx configuration file.

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

      Reload Nginx.

      sudo systemctl reload nginx
  • Hello.
    On a debian system, but same setup as with deluged.service.

    When i try to start the service as normal user i get error code “ExecStart …. (code=exited , status=216/GROUP)”

    Any toughts?

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. Drop file here