This tutorial will guide you the procedure to install Deluge BitTorrent Server on Ubuntu 22.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.
Install Deluge BitTorrent Server and Client on Ubuntu
Install Latest Version of Deluge on Ubuntu 22.04 Desktop from PPA
- Deluged – Bittorrent Server
- Deluge – Bittorrent client
- Deluge-Console – Console
Latest Version of Deluge (2.x.x) available in the apt repository is not compatible with Deluge clients (windows and others) remotely, so we need to install an older version of deluge from deluge archive in the .deb format and install it
Create a directory in downloads section
mkdir -p ~/Downloads/deluge
cd ~/Downloads/deluge
Now create a file to batch downloads all the required deluge packages
vi ~/Downloads/deluge/temp
and copy the following lines into, save and close.
wget http://archive.ubuntu.com/ubuntu/pool/universe/libt/libtorrent-rasterbar/python-libtorrent_1.1.5-1build1_amd64.deb
wget http://archive.ubuntu.com/ubuntu/pool/universe/libt/libtorrent-rasterbar/libtorrent-rasterbar9_1.1.5-1build1_amd64.deb
wget http://archive.ubuntu.com/ubuntu/pool/main/b/boost1.65.1/libboost-system1.65.1_1.65.1+dfsg-0ubuntu5_amd64.deb
wget http://archive.ubuntu.com/ubuntu/pool/universe/b/boost1.65.1/libboost-python1.65.1_1.65.1+dfsg-0ubuntu5_amd64.deb
wget http://archive.ubuntu.com/ubuntu/pool/universe/d/deluge/deluge-common_1.3.15-2_all.deb
wget http://security.ubuntu.com/ubuntu/pool/main/t/twisted/python-twisted-core_17.9.0-2ubuntu0.1_all.deb
wget http://security.ubuntu.com/ubuntu/pool/main/t/twisted/python-twisted-bin_17.9.0-2ubuntu0.1_amd64.deb
wget http://archive.ubuntu.com/ubuntu/pool/main/i/incremental/python-incremental_16.10.1-3_all.deb
wget http://archive.ubuntu.com/ubuntu/pool/universe/p/pygtk/python-glade2_2.24.0-5.1ubuntu2_amd64.deb
wget http://archive.ubuntu.com/ubuntu/pool/universe/p/pygtk/python-gtk2_2.24.0-5.1ubuntu2_amd64.deb
wget http://archive.ubuntu.com/ubuntu/pool/universe/n/notify-python/python-notify_0.1.1-4_amd64.deb
wget http://archive.ubuntu.com/ubuntu/pool/universe/d/deluge/deluge-common_1.3.15-2_all.deb
wget http://archive.ubuntu.com/ubuntu/pool/universe/d/deluge/deluge-gtk_1.3.15-2_all.deb
wget http://archive.ubuntu.com/ubuntu/pool/universe/d/deluge/deluge_1.3.15-2_all.deb
wget http://archive.ubuntu.com/ubuntu/pool/universe/d/deluge/deluged_1.3.15-2_all.deb
wget http://archive.ubuntu.com/ubuntu/pool/universe/d/deluge/deluge-web_1.3.15-2_all.deb
wget http://archive.ubuntu.com/ubuntu/pool/universe/d/deluge/deluge-console_1.3.15-2_all.deb
Make the file executable and run it
chmod +x temp
./temp
Now Install the deb files
sudo apt install ./*.deb
After succesful installation of all the packages, lock their versions in apt-repository with single long command
cat <<EOF | sudo tee /etc/apt/preferences.d/pin-deluge
Package: deluge
Pin: version 1.3.15-2
Pin-Priority: 1337
Package: deluge-common
Pin: version 1.3.15-2
Pin-Priority: 1337
Package: deluge-gtk
Pin: version 1.3.15-2
Pin-Priority: 1337
Package: deluged
Pin: version 1.3.15-2
Pin-Priority: 1337
Package: deluge-console
Pin: version 1.3.15-2
Pin-Priority: 1337
Package: deluge-web
Pin: version 1.3.15-2
Pin-Priority: 1337
Package: libtorrent-rasterbar9
Pin: version 1.1.5-1build1
Pin-Priority: 1337
EOF
check the version of file
deluge --version
It should output
deluge: 1.3.15
libtorrent: 1.1.5.0
finally run the following command
sudo apt-get install -f
Enable Deluge on System Boot
Follow the below article on enable /etc/rc.local with systemd on Ubuntu 20.04
Deluge Bittorrent Server Configuration on Ubuntu 22.04
Now lets run the deluged demon once and kill it again. By doing so it will create the initial configuration files e.g. “~/.config/deluge/auth”. Run the following command in the console
deluged
sudo pkill deluged
Now that the default configuration files are created you may edit them and add authentication information. This information will be used for remote login from windows/mac to the Deluge daemon.
Next we shall make a backup of the default configuration file and add an authentication line for remote login to the same
cp ~/.config/deluge/auth ~/.config/deluge/auth.old
now open the file
vi ~/.config/deluge/auth
and add the following line at the end of the file
user:passwd:10
replace user with your linux user and passwd with a strong password.
Next, we shall start the Deluged daemon and run the Deluge console to make some additional configuration change
deluged
deluge-console
If starting the console gives you an error code instead of nice cleanly formatted console interface type “exit” and then make sure you’ve started up the daemon.
Once you are logged in to the console, we shall make some configuration change to allow remote client connection, by entering the following command on deluge-console
config -s allow_remote True
config allow_remote
exit
The deluge terminal output shall confirm you that the configuration changes are saved. Now we shall need to restart deluged command one more time to let the configuration changes to take effect.
sudo pkill deluged
deluged
Setting up client environment on (on Windows):
We shall now install a desktop client of deluge and connect remotely to the deluge running on your server. To do so we shall first download the Deluge desktop client appropriate for your desktop environment
http://download.deluge-torrent.org/windows/deluge-1.3.15-win32-py2.7.exe
Install and launch the client and edit the preferences to run the client in non-classic mode.
Connect the raspberry pi deluge daemon with the windows client
Add the raspberry pi IP address, user name and password as set in the above steps and connect. You are all set to start downloading using torrents and magnet files.
Setup Deluge for WEB UI access
The default port for the WebUI is 8112. If you wish to change it, run the following commands
sudo pkill deluge-web
vi ~/.config/deluge/web.conf
This stops the WebUI and opens up the configuration file for it. Use vi to edit the line: “port”: 8112, and replace the 8112 with any port number above 1000 (as 1-1000 are reserved by the system).
Open up a browser on your regular desktop machine and point it at the IP address of your Pi with the port you just chose (e.g. http://localhost:8112).
You’ll be greeted with a password prompt (the default password is “deluge”) and be immediately encouraged to change it after you enter it for the first time. After that, you’ll be able to interact with Deluge via the lightweight interface. Change password to server’s password for easy reference.
Go to router settings and forward all the traffic received from port 8112 to the server’s IP address, to be able to access the deluge-web page with the following URL
https://mydomain.com:8112
To Enable and Configure SSL for Deluge on Ubuntu for Secure Access using LetsEncrypt Secure Cerificates, follow the below mentioned article
Copy the SSL certificate to /deluge/ssl directory
sudo cp -rf /etc/letsencrypt/archive/yourdomain.com/fullchain1.pem ~/.config/deluge/ssl/fullchain.pem
sudo cp -rf /etc/letsencrypt/archive/yourdomain.com/privkey1.pem ~/.config/deluge/ssl/privkey.pem
Now using the web UI interface change the interface to use SSL connection and point the above-mentioned SSL certificate and Key file to have a secure connection for the below mentioned URL
https://yourdomain.com:8112
Enable Deluge at System Startup
Before we leave the Deluge setup, there is one final detail to attend to. We need to set up the Deluge daemon and WebUI to run automatically when our Raspberry Pi boots up. To do so simply and without the fuss of editing more complicated init files and settings, we’ll simple annotate the rc.local file. Run the following command in a Terminal to do so
# Start Deluge on boot:
#sudo -u pi /usr/bin/python /usr/bin/deluged
sudo -u pi deluged
#sudo -u pi /usr/bin/python /usr/bin/deluge-web
sudo -u pi deluge-web
To stop deluge or deluge-web from running anytime, issue the following command
sudo pkill deluged
Configure Deluge Download Location
sudo mkdir /mnt/drive/Deluge/Torrents/Downloading
sudo mkdir /mnt/drive/Deluge/Torrents/Completed
sudo mkdir /mnt/drive/Deluge/Torrents/Watch
sudo mkdir /mnt/drive/Deluge/Torrents/Torrent-Backups
Now using Deluge client configure the locations as per the directories created above
One Reply to “Install Deluge BitTorrent Server on Ubuntu 22.04”
Just to assist anyone following the (very good) process to install
wget http://security.ubuntu.com/ubuntu/pool/main/t/twisted/python-twisted-core_17.9.0-2ubuntu0.1_all.deb
wget http://security.ubuntu.com/ubuntu/pool/main/t/twisted/python-twisted-bin_17.9.0-2ubuntu0.1_amd64.deb
the “ubuntu0.1” of python_twisted_core/bin should now be edited to ubuntu0.3 from searching of the current versions when I got errors running the script.
thanks
Paul