Installing Deluge on the Raspberry Pi

In this Raspberry Pi Deluge project, we will show you how to set up the popular Deluge torrent client on the Pi.

Raspberry Pi Deluge Thumbnail

Throughout this tutorial, we will be showing you how to install and configure the Deluge torrent client alongside the Deluge web interface. We will also show you how to enable Deluge’s remote access ability.

As well as showing you how to install and setup the software on your Raspberry Pi we will also be showing you how you can setup Deluge as a service.

Setting Deluge up on your Raspberry Pi as a service will allow it so that the software will automatically start when the Raspberry Pi boots up.

There are VPNs that you can setup on the Raspberry Pi to help with privacy. I recommend using something like ExpressVPN or VyprVPN. There are plenty others that you can install.

For the maximum amount of storage you might want to mount an external hard drive. You also might want to setup a Raspberry Pi NAS so you can access your files remotely.

Equipment List

Below is all the equipment that I made use of for this Raspberry Pi Deluge tutorial.

Recommended

Optional

Setting up Deluge on the Raspberry Pi

Firstly, we will be using the latest Raspbian operating system anything else you might run into problems.

1. Before we install the Deluge torrent client on to the Raspberry Pi, we should first ensure all our packages are up to date. You can do this by running the following two commands.

sudo apt update
sudo apt upgrade

2. In this step, we will now install the Deluge torrent client to the Raspberry Pi.

The version of the Deluge torrent client that we will be installing contains its web interface. The Deluge web interface will allow you to manage your torrents from any web browser easily.

To install Deluge, deluges web interface module and the python module the web interface requires we run the command below.

sudo apt install deluged deluge-web deluge-console python3-mako

3. If you want to store your downloaded torrents in a different location, then you can now go ahead and create the required folder.

In our example, we will be creating a folder within a drive we mounted to our “/media/NASHDD” folder called “torrent-downloads“.

This folder is a Samba share, and our pi user already has the privileges to write to this directory.

We can create this folder by running the following command.

mkdir /media/NASHDD/torrent-downloads

4. Let’s now start-up and then shutdown the Deluged daemon by running the following two commands. This process will make the Deluge torrent software create the config files we need on our Raspberry Pi.

We will modify two config files so that we can allow remote access to Deluge and create a user to login to the Deluge daemon.

deluged
sudo pkill -i deluged

5. We can easily insert a user into Deluges auth file by running the command below.

Make sure you swap out certain parts of this command such as “<USERNAME>” with the username you want to set and “<PASSWORD>” with the password that you want to give the user.

echo "<USERNAME>:<PASSWORD>:10" >> ~/.config/deluge/auth

6. With the authentication now modified we need to go ahead and fire up the Deluge software again.

Without the software running we won’t be able to make the next configuration change.

deluged

7. Now we can go ahead and change Deluge’s config file so that the “allow_remote” variable is set to “True“.

We can do this by making use of the “deluge-console” package and running the command below.

deluge-console "config -s allow_remote True"

8. With all the required configuration changes done, we can now go ahead and fire up the Deluge web interface.

Run the following command to launch the web interface. We use “-f” on “deluge-web” to launch it as a daemon.

deluge-web -f

9. Lastly, let’s grab the Raspberry Pi’s local IP address with the command below. We will need this IP so that we can access the Raspberry Pi Deluge web interface.

hostname -I

The Deluge Web Interface

1. With the Deluge web interface up and running on the Raspberry Pi, we can now access it by going to the Pi’s IP address followed by the “8112” port.

Enter the following web address, make sure you swap out “<IPADDRESS>” with your Pi’s IP address.

http://<IPADDRESS>:8112

2. Upon going to the web address, you will be greeted by Deluge’s web interface.

To access the interface, you will be first asked to enter a password (1.). The web interface password by default is “deluge“. We will update this password later on in the tutorial.

Raspberry Pi Deluge Web Login Screen

Once you have entered the password for Deluge, press the “Login” button (2.).

3. After logging into the Deluge web interface, you will then be shown the “Connection Manager” (1.).

Click the available host and then click the “Connect” button (2.).

Deluge Connection Manager

4. Once you have selected a connection in the “Connection Manager” box, you will now be brought to the main Deluge web interface screen.

If you want to change the download location or the default password, you can now do this by opening up the preferences dialog box by clicking “Preferences” in the toolbar.

Deluge Preferences Location

5. The first screen within the Deluge preferences interface is the “Downloads” screen. This screen lets you set things such as the download folder (1.)

Within this interface, you can specify the general download folder. You can also pick more specific options such as a location you want the completed torrents kept.

If you want to change the default password for the Deluge web interface, then you will need to go to the “Interface” screen (2.).

Deluge Web Download Settings

6. Now within the “Interface” screen, you can set the password (1.).

First, you will need to specify the original password in the “Old password” textbox, which in a first-run case, this will be “deluge“.

Next, specify your desired password in both the “New Password:” and “Confirm Password:” text fields.

Once you are all set, click the “Change” button (2.)

Deluge Web Change Password

Setting up Deluge as a service

1.  Now we need to make a service file for the Deluge daemon. This service file is what systemd will read from so that it knows how to manage the daemon.

Run the following command to begin writing our “deluged.service” file.

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

2. Within this file, enter the following text.

These settings will set it up so that Deluged daemon will be started after the network has come online.

We also set it so that the default “pi” user starts the service. Setting the user helps prevent any potential permission issues.

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

[Service]
Type=simple
User=pi
Group=pi
UMask=007
ExecStart=/usr/bin/deluged -d
Restart=on-failure
TimeoutStopSec=300

[Install]
WantedBy=multi-user.target

3. Once done, you can go ahead and save the Deluged service file by pressing CTRL + X then Y followed by ENTER.

4. Now that we have created our Deluged service file let’s go ahead and enable it. Enabling the service means that on the next boot, it will start automatically.

Enable the service by running the following command.

sudo systemctl enable deluged.service

We won’t be running the service straight away because the “deluged” daemon will be running already from the previous sections of this tutorial.

5. Next, we will need to create another service that will manage running the deluge web interface for us.

We will be calling this service file “deluge-web.service“, we can begin writing this file by running the following command on the Raspberry Pi

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

6. Within this file, enter the following text.

This text defines our Deluge web interface service. This service will only start up after both the network has come online and the deluged service is active.

Like our other service, we also set this so that the “pi” user will run the deluged web server.

[Unit]
Description=Deluge Web Interface
After=network-online.target deluged.service
Wants=deluged.service

[Service]
Type=simple
User=pi
Group=pi
UMask=027
ExecStart=/usr/bin/deluge-web -d
Restart=on-failure

[Install]
WantedBy=multi-user.target

7. With our “deluge-web.service” now created, let’s go ahead and enable it by running the command below.

sudo systemctl enable deluge-web.service

8. Finally, we need to restart our Raspberry Pi Deluge setup by running the following command.

Restarting our Raspberry Pi will allow us to test that our services are running as they should be.

sudo reboot

9. Once your Raspberry Pi has finished rebooting you can now check to ensure that both Deluged and the Deluge web service is up and running.

Run the following two commands to retrieve the current status of the two services.

sudo systemctl status deluged
sudo systemctl status deluge-web

If the status returns as “Active: active (running)” then you have successfully set up the Deluge torrent client on your Raspberry Pi.

There are other alternative torrent software packages for the Raspberry Pi that you can utilize. Each has its pros and cons, so it’s entirely up to you which one you pick.

By the time you’re at this point in this Raspberry Pi Deluge tutorial, you should have everything configured and set up correctly. If you’re running into issues, then please don’t hesitate to leave a comment below.

20 Comments

  1. Avatar for Tim
    Tim on

    I recently had an SD card fail, and used it as an opportunity to upgrade to a pi 4 as a seedbox, but had to reinstall of the programs.

    This tutorial was great, and was very easy to follow. I have Deluge up and running, and the web interface is working great. For some reason though, with all of the information input the same as before, just the remote Daemon will not connect. I have the IP address, the username and password correct, but it just never shows up as available. I’ve verified that Remote Connection is enabled, and am at a loss.

  2. Avatar for Ian
    Ian on

    Used this tutorial several times before, it’s excellent thank you. But I just setup again after a SD card failure and the services don’t seem to work anymore. I have zero linux skills so now I just have to manually launch deluged and deluged web on restart.

    This is what I get when I run:

    sudo systemctl status deluged
    sudo systemctl status deluge-web
    deluged.service - Deluge Daemon
         Loaded: loaded (/etc/systemd/system/deluged.service; enabled; vendor preset: enabled)
         Active: failed (Result: exit-code) since Fri 2022-05-27 12:49:54 BST; 33min ago
        Process: 659 ExecStart=/usr/bin/deluged -d (code=exited, status=217/USER)
       Main PID: 659 (code=exited, status=217/USER)
            CPU: 5ms
    
    May 27 12:49:54 raspberrypi systemd[1]: deluged.service: Scheduled restart job, restart coun>
    May 27 12:49:54 raspberrypi systemd[1]: Stopped Deluge Daemon.
    May 27 12:49:54 raspberrypi systemd[1]: deluged.service: Start request repeated too quickly.
    May 27 12:49:54 raspberrypi systemd[1]: deluged.service: Failed with result 'exit-code'.
    May 27 12:49:54 raspberrypi systemd[1]: Failed to start Deluge Daemon.
    May 27 12:49:55 raspberrypi systemd[1]: deluged.service: Start request repeated too quickly.
    May 27 12:49:55 raspberrypi systemd[1]: deluged.service: Failed with result 'exit-code'.
    May 27 12:49:55 raspberrypi systemd[1]: Failed to start Deluge Daemon.

    and for the web

    deluge-web.service - Deluge Web Interface
         Loaded: loaded (/etc/systemd/system/deluge-web.service; enabled; vendor preset: enabled)
         Active: failed (Result: exit-code) since Fri 2022-05-27 12:49:55 BST; 38min ago
        Process: 672 ExecStart=/usr/bin/deluge-web -d (code=exited, status=217/USER)
       Main PID: 672 (code=exited, status=217/USER)
            CPU: 5ms
    
    May 27 12:49:55 raspberrypi systemd[1]: deluge-web.service: Scheduled restart job, restart c>
    May 27 12:49:55 raspberrypi systemd[1]: Stopped Deluge Web Interface.
    May 27 12:49:55 raspberrypi systemd[1]: deluge-web.service: Start request repeated too quick>
    May 27 12:49:55 raspberrypi systemd[1]: deluge-web.service: Failed with result 'exit-code'.
    May 27 12:49:55 raspberrypi systemd[1]: Failed to start Deluge Web Interface.
    1. Avatar for Emmet
      Emmet on
      Editor

      Hi Ian,

      I just re-ran the tutorial and am unable to reproduce this issue.

      May I ask what operating system you are using exactly?

      Cheers,
      Emmet

    2. Avatar for Ian
      Ian on

      Solved it myself.
      When I booted up the OS for the first time it prompted me to created a new user, so I thought why not. Later in deluged.service I changed the user=pi and group=pi it =myusername, and the service worked fine after that.

  3. Avatar for Viragored
    Viragored on

    6th February 2022 – successfully installed on a new Pi 4 with Bullseye OS 11.
    Great tutorial, very easy to follow and clear explanations. Thanks for doing it so well!

  4. Avatar for Kay
    Kay on

    Great tutorial, just a not for the deluge-web service it needs to be “ExecStart=/usr/bin/deluge-web -d” without -d on the actual system it would not start.

    1. Avatar for Emmet
      Emmet on
      Editor

      Hi Kay,

      Thank you for pointing that out. I have updated the tutorial so it should now be correct.

      Cheers,
      Emmet

  5. Avatar for Odyseja
    Odyseja on

    I get:

      File "/usr/lib/python3/dist-packages/deluge/_libtorrent.py", line 23, in 
        import deluge.libtorrent as lt
    ModuleNotFoundError: No module named 'deluge.libtorrent'
    
    [SNIPPED]
    
    ImportError: /lib/arm-linux-gnueabihf/libtorrent-rasterbar.so.10: undefined symbol: __atomic_fetch_add_8

    There seem to be no way around it.

    1. Avatar for Emmet
      Emmet on
      Editor

      Hi Odyseja,

      If you want to use Raspberry Pi OS Bullseye you will have to use something like Transmission or qBittorrent instead.

      The version of “libtorrent” being provided through the package repository in Bullseye is not compatible with the Pi’s architecture at this time.

      Cheers,
      Emmet

  6. Avatar for Deke
    Deke on

    Is this guide accurate for Bullseye? I’m getting errors when installing python-mako, and when running deluged for the first time, I see an error ModuleNotFoundError: No module named ‘deluge.libtorrent’

    1. Avatar for Emmet
      Emmet on
      Editor

      Hi Deke,

      Unfortunately the “libtorrent” library that Deluge relies on is not currently working on Raspberry Pi OS Bullseye.

      I am testing compiling libtorrent as a separate tutorial and will link to that if everything works.

      In the meantime I would recommend checking out our guide on Transmission or qBittorrent. Both are solid alternatives to managing your torrents on a Raspberry Pi.

      Cheers,
      Emmet

  7. Avatar for George
    George on

    mthx, great tutorial

    in case anyone needs to also use a thin client, in my case anyway, has also to edit the .config/deluge/auth file by running:

    sudo nano .config/deluge/auth

    (in my case I had to remove the on username and password) and save the file

    thx agn!

  8. Avatar for Chris
    Chris on

    I follow the guide but for some reason cannot connect to the webui on any browser other than on the rpi.

    I’ve spent quite a lot of time trying to find out what’s going wrong but I can’t figure it out.

    Please help

    1. Avatar for Emmet
      Emmet on
      Editor

      Hi Chris,

      Can you make sure that you ran the following command to allow remote connections to Deluge.

      deluge-console "config -s allow_remote True"

      The web UI should be accessible after running this command. You may have to restart the web service after running this command.

      Cheers,
      Emmet

  9. Avatar for MonkeyPet
    MonkeyPet on

    Tutorial is good. However, the Raspberry Pi original version 1 has some performance issues while running torrents, so keep that in mind. Opening more than 2 torrents will cause the web connection to go down and the downloading of the torrents may stall also.

  10. Avatar for Ibarra
    Ibarra on

    Hi. Thanks for the tutorial, is by far, the best i found out over the net. Just to add, I´ve used it to install it on Debian 10 (Buster) just changing the user and group in service files, both deluge-web.service and deluged.service.

    1. Avatar for Emmet
      Emmet on
      Editor

      Hi Ibarra,

      Glad to hear that this tutorial on installing Deluge has been a great help to you!

      Cheers,
      Emmet

  11. Avatar for Snorter
    Snorter on

    If you keep a lot of torrents in Deluge, you will probably get a “too many open files” error eventually. To fix this, you can add the following line after the TimeoutStopSec=300 setting in the deluged.service file:

    LimitNOFILE=16384

    You can adjust the value as needed to eliminate the error.

    1. Avatar for Joseba
      Joseba on

      Thanks for this point

  12. Avatar for Riz
    Riz on

    This tutorial is excellent..
    Thank you and keep up the good work.

Leave a Reply

Your email address will not be published.