Torrents are a popular way of distributing and sharing files on the internet. Next to browsing, torrenting is the next most common activity on the web. The person who uploads the torrent seed or users who have already downloaded the file are called seeders. Those who are in the process of downloading files are known as leechers. The users who are both downloading and seeding torrents are peers.
Downloading and seeding torrents takes time — from a few hours to several days or weeks, depending on the seeders-to-leechers ratio, download speed of the internet, and availability of the file/torrent.
Keeping a laptop or desktop computer on for this period is far from ideal for its battery life and power consumption. Fortunately, torrenting can be relegated to Raspberry Pi. A Raspberry Pi can download and seed a torrent while enabling another embedded application, such as a home surveillance system.
Raspberry Pi converts to a TorrentBox by running a torrent client on it. Only a few torrent clients designed for Linux work on Raspberry Pi. These include Transmission, Deluge, and qBittorrent.
In this project, we’ll set up Raspberry Pi 3B/4B as TorrentBox using Transmission. As Raspberry Pi 3B/4B already has built-in Wi-Fi, additional components are required to connect to the internet.
Components required
1. Raspberry Pi 3B/4B x1
2. Raspberry Pi power adapter x1
3. Display monitor x1
4. HDMI cable x1
5. Keyboard and mouse x1
6. MicroSD card x1
Pre-requisites
Before beginning this project, set up Raspberry Pi as a desktop (using this guide). Raspbian can now be uploaded to a MicroSD card using the Raspberry Pi imager, so there’s no need to format the MicroSD card and manually download Noobs to it. The new Raspbian image automatically detects location and keyboard type.
Transmission client
Transmission is an open-source Bit Torrent client for macOS, Microsoft Windows, and Linux. It’s a lightweight, private torrent client that’s excellent for Raspberry Pi.
Transmission configures to run at boot and without permissions 24×7. It comes with a web interface that can be launched in Chromium, the default browser on Raspberry Pi. The torrent client’s web interface can launch from any browser installed on Raspberry Pi. The torrents can be received through magnetic links.
Transmission also offers all the basic functions like start, stop, delete, start all, and stop all for managing torrents.
Preparing Raspberry Pi for the TorrentBox
Once you have set up Raspberry Pi as your desktop, ensure it’s fully updated before installing the Transmission torrent client. To do so, open the Terminal and run this command:
sudo apt-get update
To upgrade Raspberry Pi, run this command in the Terminal:
sudo apt-get upgrade
It may take a few minutes to upgrade Raspberry Pi depending on the number of packages and applications currently installed on it.
Installing Transmission
To install the Transmission torrent client on Raspberry Pi, run this command in Terminal:
sudo apt-get install transmission-daemon
When prompted, type ‘Y’ and press enter.
Once the transmission client is installed, it launches automatically as a service. To configure the client, it’s necessary to stop it. To do so, run this command in Terminal:
sudo systemctl stop transmission-daemon
Configuring Transmission
Now, the Transmission torrent client needs to be configured. To set up the configuration options, run the following command in the Terminal to open “settings.json” in the nano editor.
sudo nano /etc/transmission-daemon/settings.json
First, set the username and password. The default username is “transmission” and the password is a string of letters. We’ve kept the default username and changed the password to “password.” You can (and should) choose a stronger password.
Next, add “192.168.*.*” to “rpc-whitelist” and set “rpc-whitelist-enabled” to true. By default, Transmission is configured to allow only the local host to connect. By changing the setting, anyone on the local network can connect.
Save the changes you’ve made by pressing Ctrl+S, and close the settings file by pressing Ctrl+X. Next, we’ll add the directory permissions for the Transmission user.
The default user for the Transmission torrent client is “debian-tranmission” and the password is “debian-transmission.” The user and password can be changed to any name like “pi” or “raspberrypi.” But it’s not required. Here, we’ll continue with the default Transmission user and add directory permission by running these commands in the Terminal:
sudo chown -R debian-transmission:debian-transmission /etc/transmission-daemon
sudo chown -R debian-transmission:debian-transmission /etc/init.d/transmission-daemon
sudo chown -R debian-transmission:debian-transmission /var/lib/transmission-daemon
Running Transmission
After configuring the Transmission client, you’ll need to relaunch it. The Transmission client can be started by running this command in the Terminal:
sudo systemctl start transmission-daemon
For the configuration options to take effect, reload the client by running this command in the Terminal:
sudo systemctl daemon-reload
Now, you’ll need to retrieve the IP address of your Raspberry Pi by running this command in the Terminal:
hostname -I
To launch the web interface of the Transmission torrent client, open the browser — the default browser in Raspberry Pi is Chromium. Type in the IP address of Raspberry Pi, including the port number 9091 i.e. <IP_address>:9091.
The client will prompt you to enter your username and password. Enter the username and password as set in the settings.json and sign in.
The interface will launch with option to load, start, and stop the torrent, and to start all and stop all torrents.
Click on the folder icon to add a torrent. The torrent can be added through a torrent file or a magnetic link.
After you upload a torrent file or enter the URL of a magnetic link, the torrent automatically starts.
If you want to stop the Transmission torrent client, run this command in the Terminal:
sudo systemctl stop transmission-daemon
Running the Transmission client at boot
The Transmission client starts when it’s reloaded or started from the Terminal. To automate the launch at the boot, it’s necessary to create a file in the init.d folder. Run the following command to create a file “transmission-boot.”
sudo nano /etc/init.d/transmission-boot
Add the following lines to the newly created file:
sleep 20
systemctl start transmission-daemon
systemctl daemon-reload
Now, save and close the file “transmission-boot.” To make the file executable and launch at boot, run these commands in the Terminal:
sudo chmod +x /etc/init.d/transmission-boot
sudo update -rc.d /etc/init.d/transmission-boot defaults
Conclusion
Torrenting can be relegated to Raspberry Pi to save your laptop or desktop computer from running and wasting power or battery life. Raspberry Pi serves as an excellent TorrentBox. Transmission is the lightest torrent client that can be run on Raspberry Pi and is ideal for downloading and seeding torrents.
You may also like:
Filed Under: Tutorials
Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.