Como converter Raspberry Pi em uma caixa de torrent 24×7

How to Convert Raspberry Pi into a 24×7 Torrent Box

Torrents are a popular way of distributing and sharing files on the Internet. After browsing, torrenting is the second most common activity on the web. The person who uploads the torrent seed or the users who have already downloaded the file are called seeders. Those who are downloading files are known as leeches. Users who download and propagate torrents are peers.

Downloading and seeding torrents takes time – from a few hours to several days or weeks, depending on the ratio of seeders to leechers, Internet download speed, and file/torrent availability.

Keeping a laptop or desktop on during this period is far from ideal for battery life and power consumption. Fortunately, torrenting can be relegated to the Raspberry Pi. A Raspberry Pi can download and seed a torrent while enabling another built-in application, such as a home surveillance system .

Raspberry Pi is converted into TorrentBox by running a torrent client on it. Only a few torrent clients designed for Linux work on the Raspberry Pi. These include Broadcast, Deluge and qBittorrent.

In this project, we will configure Raspberry Pi 3B/4B as TorrentBox using Transmission. As the Raspberry Pi 3B/4B already has built-in Wi-Fi, additional components are required to connect to the internet.

Required components
1. Raspberry Pi 3B/4B x1
2. Raspberry Pi x1 Power Adapter
3. Display Monitor x1
4. HDMI cable x1
5. Keyboard and mouse x1
6. MicroSD Card x1

Prerequisites
Before starting this project, set up your Raspberry Pi as a desktop (using this guide ). Raspbian can now be loaded onto a MicroSD card using the Raspberry Pi Imager, so there is no need to format the MicroSD card and manually download Noobs to it. The new Raspbian image automatically detects keyboard location and type.

Streaming client
Transmission is an open source Bit Torrent client for macOS, Microsoft Windows and Linux. It's a lightweight, private torrent client that's great for Raspberry Pi.

The stream is configured to run on startup and without permissions 24/7. It comes with a web interface that can be launched in Chromium, the Raspberry Pi's default browser. The torrent client's web interface can be launched from any browser installed on the Raspberry Pi. Torrents can be received via magnet links.

Transmission also offers all the basic functions like start, stop, delete, start all and stop all to manage torrents.

Preparing Raspberry Pi for TorrentBox
Once you've set up your Raspberry Pi as your desktop, make sure it's fully updated before installing the Transmission torrent client. To do this, open Terminal and run this command:

sudo apt-get update

To update your Raspberry Pi, run this command in Terminal:

sudo apt-get update

Updating your Raspberry Pi may take a few minutes depending on the number of packages and applications currently installed on it.

Installing the 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 streaming client is installed, it will automatically start as a service. To configure the client you need to stop it. To do this, run this command in Terminal:

sudo systemctl stop broadcast-daemon

Configuring the broadcast
Now the Transmission torrent client needs to be configured. To set configuration options, run the following command in 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 “broadcast” and the password is a string of letters. We kept the default username and changed the password to “password”. You can (and should) choose a stronger password.

Then add “192.168.*.*” to “rpc-whitelist” and set “rpc-whitelist-enabled” to true. By default, Transmission is configured to only allow localhost connection. By changing the setting, anyone on the local network will be able to connect.

Save the changes made by pressing Ctrl+S and close the settings file by pressing Ctrl+X. Next, we'll add directory permissions for the Transmission user.

The default user for the Transmission torrent client is “debian-transmission” and the password is “debian-transmission”. The username and password can be changed to any name like “pi” or “raspberrypi”. But it's not mandatory. Here, we'll stick with the default Transmission user and add directory permission by running these commands in 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

Broadcast running
After configuring the Transmission client, you will need to restart it. The Transmission client can be launched by running this command in Terminal:

sudo systemctl starts the broadcast daemon

For the configuration options to take effect, reload the client by running this command in Terminal:

sudo systemctl daemon-reload

Now, you will need to retrieve your Raspberry Pi's IP address by running this command in Terminal:

hostname -I

To launch the Transmission torrent client web interface, open the browser – the default browser on the Raspberry Pi is Chromium. Enter the IP address of the Raspberry Pi, including port number 9091, i.e. :9091.

The client will ask you to enter your username and password. Enter the username and password as defined in settings.json and log in.

The interface will launch with the option to load, start and stop torrent and to start and stop all torrents.

Click the folder icon to add a torrent. The torrent can be added via a torrent file or magnet link.

Once you upload a torrent file or enter the URL of a magnet link, the torrent will start automatically.

If you want to stop the Transmission torrent client, run this command in Terminal:

sudo systemctl stop broadcast-daemon

Running the Transmission client at startup
The Transmission client starts when it is reloaded or launched from the Terminal. To automate the launch at boot, it is necessary to create a file in the init.d folder. Run the following command to create a “transmission-boot” file.

sudo nano /etc/init.d/transmission-boot

Add the following lines to the newly created file:

sleep 20
systemctl starts the broadcast daemon
systemctl daemon-reload

Now, save and close the “transmission-boot” file. To make the file executable and launch at startup, run these commands in 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 the Raspberry Pi to prevent your laptop or desktop computer from running and wasting power or battery. Raspberry Pi serves as an excellent TorrentBox. Transmission is the lightest torrent client that can run on Raspberry Pi and is ideal for downloading and seeding torrents.

Related Content

Back to blog

Leave a comment

Please note, comments need to be approved before they are published.