This guide explains how to create an additional Deluge instance running alongside your existing one.
Each instance has its own configuration, downloads directory, WebUI and daemon port, allowing you to manage multiple independent Deluge instances under the same user account.
Before you begin, make sure you can connect to your service via SSH. If you need help, please refer to our SSH guide:
Installation
Step 1 – Create the Required Directories
Create the directories used by the new deluge1 instance:
mkdir -p ~/downloads/deluge1/watch/deluge
Step 2 – Copy the Existing Configuration
Copy your current Deluge configuration to a new configuration directory:
cp -rf ~/.config/deluge ~/.config/deluge1
Step 3 – Remove Existing Torrent State
Remove the torrent state files from the new configuration so the new instance starts with a clean state.
find ~/.config/deluge1/state/ -name *torrent* -print0 | xargs -0 rm -f
rm -f ~/.config/deluge1/{deluged.pid,dht.state,deluged.log}
Step 4 – Update the Configuration
Modify the copied configuration so it uses the new download directory, configuration path and randomly generated daemon and WebUI ports.
sed -i "s:$(whoami)/downloads:$(whoami)/downloads/deluge1:" ~/.config/deluge1/core.conf
sed -i "s:$HOME\":$HOME/downloads/deluge1\":" ~/.config/deluge1/core.conf
sed -i "s:config/deluge:config/deluge1:" ~/.config/deluge1/core.conf
sed -i "s:daemon_port.*:daemon_port\"\: $(shuf -i 23700-23900 -n 1),:" ~/.config/deluge1/core.conf
sed -i "s:port.*:port\"\: $(shuf -i 23900-23999 -n 1),:" ~/.config/deluge1/web.conf
sed -i "s:/$(whoami)/deluge::" ~/.config/deluge1/web.conf
sed -i "9s:[0-9].*:$( \
grep daemon ~/.config/deluge1/core.conf \
| awk -F " " '{print $2}' \
| cut -d "," -f1),:" \
~/.config/deluge1/hostlist.conf.1.2
Step 5 – Set the WebUI Password
Replace deluge1pass with the password you want to use for the new Deluge instance.
PASS=deluge1pass; \
sed -i "s:sha1.*:sha1\"\: \"$( \
echo -n "$( \
grep salt ~/.config/deluge1/web.conf \
| awk -F "\"" '{print $4}')$PASS" \
| openssl dgst -sha1 \
| awk '{print $2}')\",:" \
~/.config/deluge1/web.conf
Step 6 – Start the New Instance
Start the daemon and WebUI for the new instance:
deluged -c ~/.config/deluge1/ && deluge-web -c ~/.config/deluge1/ -f
Step 7 – Create an Automatic Startup Cron Job
Create a cron job that checks every 5 minutes whether the new instance is running. If it is not running, it will be started automatically.
(crontab -l;echo -e "*/5\t*\t*\t*\t*\t/usr/bin/pgrep -f deluge1 || rm -f ~/.config/deluge1/deluged.pid && deluged -c ~/.config/deluge1/ && deluge-web -c ~/.config/deluge1/ -f") | crontab -u $(whoami) -
Step 8 – Verify That the Instance Is Running
Verify that the new Deluge instance has started successfully:
pgrep -f deluge1 > /dev/null && echo "Deluge started" || echo "Deluge not started"
Step 9 – Display the WebUI URL
Display the URL of the new Deluge WebUI:
echo -e "Deluge URL: http://$(hostname):$(grep port ~/.config/deluge1/web.conf | awk -F " " '{print $2}'|cut -d "," -f1)"
Use the displayed URL together with the password configured in Step 5 to access the new Deluge instance.
Using Multiple Instances
If you want to create additional instances, simply replace every occurrence of deluge1 in this guide with another instance name, for example:
- deluge2
- deluge3
- or any custom name such as mybox.
Each instance will use its own configuration, download directory and ports.
Restarting the Deluge Instance
If you need to restart the additional Deluge instance manually, follow the steps below.
Step 1 – Stop the Instance
Stop both the Deluge daemon and the WebUI:
kill -9 $(pgrep -f deluge1)
Step 2 – Start the Instance
Start the Deluge daemon and WebUI again:
deluged -c ~/.config/deluge1/ && deluge-web -c ~/.config/deluge1/ -f
Uninstallation
If you no longer need the additional Deluge instance, follow the steps below to remove it completely.
Step 1 – Remove the Cron Job
Remove the automatic startup cron job created during the installation:
crontab -l | sed -e "/deluge1/d" | crontab -u $(whoami) -
Step 2 – Stop the Instance
Stop the Deluge daemon and WebUI:
kill -9 $(pgrep -f deluge1)
Step 3 – Remove the Configuration
Delete the configuration directory for the additional instance:
rm -rf ~/.config/deluge1
Step 4 – Remove the Download Directory
Delete the download directory used by the additional instance:
rm -rf ~/downloads/deluge1
Notes
- This guide creates an additional Deluge instance named deluge1. You can replace deluge1 with any other instance name throughout the guide.
- Each Deluge instance has its own configuration directory, download directory, daemon port and WebUI port.
- The installation automatically assigns random daemon and WebUI ports to avoid conflicts with your existing Deluge instance.
- The cron job created during installation checks every 5 minutes whether the instance is running and automatically starts it if necessary.
- If you create multiple instances (for example deluge2 or deluge3), repeat the same procedure using a different instance name.