How to set up a torrent server

29th Jan 2012 | 12:00

How to set up a torrent server

Put an old PC to good use as a headless torrent and file server

Set up a torrent server: what you need

Have you been holding onto that 10-year-old workhorse that saw you through college, in the hope that one day you'll be able to put it to good use? If you're like us, you've probably cannibalised most of its peripherals and all that's left is its tiny processor and a meagre amount of RAM.

It might not be able to run any bleeding edge OS, but you can use it as a centralised file server to download and share files on your network and the web.

Follow the walkthrough below to install the Torrent Server appliance and bring your server online.

Once you have it running on your remote headless server, fire up a browser and point it to the IP address of the server. The control panel of the Torrent Server has five icons that point to the five major components of the appliance.

The 'Basic' icon takes you to the P2P-GUI interface. This is simpler than MLDonkey's default interface, which can be intimating to first-time users. You can get to it via the 'Advanced' icon.

Another speciality of this appliance is the browser-based file manager eXtplorer, which you can use to manipulate files and directories, as well as their permissions.

Web Shell fires up an AJAX-based terminal emulator called Shell in a Box, which you can use to log into your remote server from your web browser.

Finally, there's Webmin for CLI-averse users. Webmin is a web-based configuration tool that you can use to control all aspects of your remote server, such as setting up a cron job, reading logs, managing running processes and so on.

All these components are pre-configured out of the box. For example, MLDonkey has all file-sharing protocols enabled, including HTTP, FTP, and BitTorrent. Besides these visible elements, there are also additional useful components that work in the background. For example, there's the Samba file server, which ensures that you can access your server easily from Windows PCs.

On Windows, you'll find the remote server listed as TORRENTSERVER under Network in My Computer. You can log into the server using the credentials of the user 'root' that you set during installation. This lets you easily drag and drop files into the remote server. The default storage directory in the server is /srv/storage.

MLDonkey

ML donkey stats

Downloading and controlling torrents on the remote server is straightforward. But you can also use MLDonkey to seed your own torrents. The only real downside is that its interface isn't anything like those of the popular desktop torrent clients.

Once you get a hang of it though, you'll be able to appreciate its flexibility. Let's familiarise ourselves with MLDonkey and its pre-configured download/ upload directories.

The Torrent Server appliance we have set-up comes with MLDonkey pre-configured. To review its settings, head to its Advanced interface from the Control Panel. Now click 'Help+ > Sysinfo' to bring up the configuration information.

MLDonkey can also be controlled via its own set of commands, so you can also access the configuration option simply by entering 'sysinfo' in the text box in the main interface.

The default directories are listed at the bottom of the page. MLDonkey is installed under /var/lib/mldonkey. That directory houses all the configuration files for all the different protocols. So for example, bittorrent.ini houses all the config options for MLDonkey's BitTorrent client.

Seeding your torrents

With MLDonkey you can seed either individual files (like some-distro.iso) or a group of files housed under a directory (like the_best_distros/). To seed individual files, keep them under the /var/lib/ mldonkey/incoming/files directory. Similarly, seeded directories must be placed under /var/lib/mldonkey/ incoming/directories.

You can move or copy the files from their original location to these directories in several ways. You can upload them to the remote server using the browser-based file manager, or by accessing it via Samba.

To move the files around in the remote server you can either use the web shell, or you can log into the remote server via ssh using the command ssh root@<server- IP-address>.

Before you can seed the local files you need to create a .torrent file. To create a .torrent file, you need a tracker that will announce its presence to other peers. By default, MLDonkey will use the IP address of the server it's running on to track torrents within the local network.

To use an external tracker, you'll have to modify MLDonkey's configuration. The simplest way to do this is to head to 'Client settings' in the basic interface and look for the 'bt-default_tracker' entry. By default it's empty, which means it'll use the local tracker.

To point it to an external tracker, enter its location in the space provided – for example, http://linuxtracker.org:2710/announce, which is the tracker for LinuxTracker.org. Now use the compute_ torrent command to point to the files you need to seed.

For example, compute_torrent/srv/storage/incoming/files/some-distro.iso will generate its .torrent file with the tracker information you've specified in the configuration file. The generated .torrent file is kept under the /var/lib/mldonkey/torrents/seeded directory.

You can confirm that your torrents are being seeded by going to 'Transfers > Uploads'. To view more details about a torrent, click the 'Details' link under the Status column. That's it. Now you can download files unattended and earn brownie points from your peers by serving torrents.

Set up a torrent server: install

Install the TurnKey appliance on your old PC

1. Run the live CD

setup 1

You can either install the Torrent Server appliance directly, or try its components by first running it in live mode. The installer is a modified Debian installer. Unless you know what you're doing, let the installer partition the disk for you.

2. Set passwords

setup 2

Whether you install the appliance or run it in live mode, you'll be prompted for password to the root user as well as to the 'admin' user for the various components in the appliance: the MLDonkey filesharing app, the P2P-GUI to MLDonkey, and the eXtplorer file manager.

3. Server's up

setup 3

That's all there is to it. Once you've configured the users, the appliance will copy all the files and install the boot loader as well. After restarting, it will boot to the configuration console, which lists all the addresses for accessing the various apps in the server.

Additional software

Flesh out any TurnKey appliance

1. Refresh package lists

software 1

Log in to the server's control panel and click on the 'Webmin' icon and log in using the credentials of user root. In Webmin, go to 'System > Software packages'. Scroll down to the bottom of this page, toggle the 'Re-synchronize package list' radio button and click the 'Upgrade now' button.

2. Install packages

software 2

After the package lists have been refreshed, you can search for packages you want to install from the top of this page. This will list all the packages in Ubuntu's repository that match your search string, and you can select packages you wish to install (and later uninstall).

3. Install from the CLI

software 3

Power users can also use the web shell to install packages. After logging into the server from the web shell as root, first refresh the package lists with apt-get update and then install the packages you want with apt-get install <package-name>, just like you would on a regular Ubuntu installation.

Set up a torrent server: downloading torrents

With the torrent server installed, it's time to put it to work

1. Log in to the server

download 1

Head to the Torrent server by entering its IP address in a web browser from any computer on the same network as the server. This will bring up the Control Panel. Click on the 'Basic' icon and login using the user 'admin' and password that you specified during setup.

2. Connect to the torrent server

download 2

Now you are in the simpler of the two interfaces for the MLDonkey file sharing app. The first thing you have to do is to connect to your MLDonkey instance. For that head to the 'Clients' tab and click on the 'Connect' button next to the server running on 127.0.0.1:4001.

3. Client settings

download 3

To configure MLDonkey's BitTorrent settings, head to the 'Client settings' tab and then click the 'BitTorrent' link. From here you can alter settings such as the default tracker (which is useful when creating torrents), the number of peers to request from a tracker and lots more.

4. Download torrent

download 4

Once you've connected with the server, browse to your favourite torrent website and copy the link to the .torrent file you wish to download. In the basic interface, click the 'Links' tab, paste the URL in the text box and click the 'Load link' button to load the torrent.

5. Control the download

download 5

Torrents that are in the process of being downloaded are listed under the 'Download' tab, along with various pieces of information such as total size, download progress and ETA. You also have buttons to pause and resume each torrent, and set their individual priority.

6. Download completed files

download 6

Once a torrent has been downloaded, it's scanned by the inbuilt ClamAV antivirus scanner (which updates its antivirus signatures automatically). After being cleared, the files are placed under /var/lib/mldonkey/incoming, from where you can download them to any machine.

--------------------------------------------------------------------------------------------------

First published in PC Plus Issue 317

Liked this? Then check out our

Sign up for TechRadar's free Week in Tech newsletter
Get the top stories of the week, plus the most popular reviews delivered straight to your inbox. Sign up at http://www.techradar.com/register

Follow TechRadar on Twitter * Find us on Facebook * Add us on Google+

tutorial file sharing Linux
Share this Article
Google+

Most Popular

Edition: UK
TopView classic version