Deluge BitTorrent
Deluge was started by two members of ubuntuforums.org, Zach Tibbitts and Alon Zakai, who previously hosted and maintained the project at Google Code, but who subsequently moved it to its own website.
Deluge is released under the terms of the GNU General Public License version 3.
Running a BitTorrent server on the Raspberry Pi is a good way to offload work from your main workstation, saving precious resources, such as processing power, memory, bandwidth and even electricity.
You may thus have it always-on without interruption.
This tutorial provides step-by-step instructions for configuring a Deluge BitTorrent server on the Raspberry Pi 4 2GB motherboard.
What is BitTorrent?
BitTorrent (abbreviated to BT) is a communication protocol for peer-to-peer file sharing (P2P), which enables users to distribute data and electronic files over the Internet in a decentralized manner.
BitTorrent is one of the most common protocols for transferring large files; such as, digital video files containing TV shows and video clips, or digital audio files containing songs.
In 2019, BitTorrent was a dominant file sharing protocol and generated a substantial amount of Internet traffic, with 2.46% of downstream, and 27.58% of upstream traffic.
Power up and get your Raspberry Pi online
Click on the wireless icon then choose the WiFi network name and enter the its secured password.
Open the LXTerminal and update your system
sudo apt update
sudo apt upgrade
That should be enough for the Raspberry Pi preparation.
Verify the presence of the external harddisk drive
sudo fdisk -l
you would expect to see /dev/sda1 at the bottom of the command response.
To install the Deluge BitTorrent server:
sudo apt install deluged deluge-web
Create a new service to run the Deluge daemon automatically after system start and once a network connection has been established. Use the “deluged-user” user that was created automatically during the initial installation of the Deluge daemon
Setup Deluge to run as a Service:
sudo nano /etc/systemd/system/deluged.service
Add the text below:
[Unit]
Description=Deluge Daemon
After=network-online.target
[Service]
Type=simple
User=deluged-user
Group=deluged-user
UMask=002
ExecStart=/usr/bin/deluged -d
Restart=on-failure
TimeoutStopSec=300
[Install]
WantedBy=multi-user.target
Press “CTRL+X” to exit, “Y” to save changes, and “Enter” to confirm the filename.
Enable the service we just created in the system:
sudo systemctl enable deluged.service
Create a new service to run the Deluge web interface automatically after system start, and once a network connection has been established. Use the “deluged-user” user that was created automatically during the initial installation of the Deluge daemon.
Setup the Web Interface as a service:
sudo nano /etc/systemd/system/deluge-web.service
Add the text below:
[Unit]
Description=Deluge Web Interface
After=network-online.target deluged.service
Wants=deluged.service
[Service]
Type=simple
User=deluged-user
Group=deluged-user
UMask=002
ExecStart=/usr/bin/deluge-web
Restart=on-failure
[Install]
WantedBy=multi-user.target
Press “CTRL+X” to exit, “Y” to save changes, and “Enter” to confirm the filename.
Enable the service we just created in the system:
sudo systemctl enable deluge-web.service
Configuration and Permissions
The first time Deluge runs, it generates its default configuration files in the users home directory. Our user, “deluged-user” has a home directory at “/var/lib/deluged.” We will start our new system services, which will have “deluged-user” run Deluge for us.
To start the new system services:
sudo systemctl start deluged
sudo systemctl start deluge-web
Optionally, you can check the status of these services now to double-check that they are working. If they are working or not, it will be indicated by some highlighted green or red text, respectively.
To check status of the services:
sudo systemctl status deluged
sudo systemctl status deluge-web
Now, lets stop the services and Deluge components from running so we can make some needed changes.
To stop the services:
sudo systemctl stop deluged
sudo systemctl stop deluge-web
Add your regular user to the “deluged-user” group so you will have access to the files its creates (your downloads):
sudo usermod -aG deluged-user pi
Ensure file ownership of all the new configuration files by the new user group, “deluged-user.”:
sudo chown -R deluged-user:deluged-user /var/lib/deluge
Ensure file access to all the new configuration files by the new user group, “deluged-user.”:
sudo chmod -R 770 /var/lib/deluge
Reboot your Raspberry Pi for these permission changes to take effect:
sudo reboot
Configure the Web Interface
Enter the following commands to see the status of the two Deluge services. Both services should automatically be running after a reboot:
sudo systemctl status deluged
sudo systemctl status deluge-web
Determine your current IP:
hostname -I
Navigate to the Deluge web interface from your main workstation (a computer other than the Raspberry Pi).
Use the address below with the IP address we identified above:
http://IPADDRESS:8112
You should be presented with a login prompt. The default password is “deluge.” Change this password to one of your liking. You may also be presented with a prompt from the “Connection Manager.” Here you will want to connect to the host with an address of “127.0.0.1” which is your local machine. This connects the web interface to the Deluge daemon which does all the heavy lifting in the background.
From here you can change any number of settings through the web interface, by selecting the “Preferences” menu. I would highly recommend changing the download folder locations, as well as allowing remote access.
Any folder that you choose to download to, or setup as one of your various download locations for torrents, you must grant permissions to the “deluged-user” group to function, or you’ll encounter errors.
For example ↡
sudo mkdir /myCLOUD/shared/tt
sudo chown deluged-user:deluged-user /myCLOUD/shared/tt
sudo chmod 770 /myCLOUD/shared/tt
To stop the services:
sudo systemctl stop deluged
sudo systemctl stop deluge-web
To stop the services:
sudo systemctl stop deluged
sudo systemctl stop deluge-web
Packing List
myCLOUD NAS DIY Kit
↺ GO BACK
- 1 x USB3.0 Dual Harddisk Docking Station (See Note*)
- 1 x Aluminum Case Enclosure = Heat Sink
- 1 x USB WiFi dongle
- 1 x 5dBi Omni Antenna
- 1 x micro htmi to hdmi 6 FT cable
- 1 x 5V 3.5A Power Supply Module
- 1 x myCLOUD NAS installer
- 1 x User guide
M18 MESH Router
↺ GO BACK
- Compliant to IEEE 802.11ax International Standard
- 3 WAN/LAN Gigabit Ethernet Ports
- Power supply unit
- 中文 menu supplemented with English user guide
Note* : Two drive slots - harddisk not included. You may fit a 3.5in SATA or 2.5in SATA on each slot. Max 16TB each drive. Total max storage capacity 32TB. The Harddisk Docking Station also comes with CLONE feature. Simply insert the master harddisk in the SOURCE slot and the slave harddisk in the TARGET slot, then press the CLONE button to clone.