[How to] Create a SeedBox from start to finish


#1

This page show you how to use a C1 server to create a SeedBox from start to finish

With 2GB of RAM and a quad-core ARM processor, a Cloud C1 instance is more than enough for a simple SeedBox.

Edit: This topic describes how to install a seedbox manually. To install everything automatically, check our torrents instant app!

Requirements

In this guide, we will create from start to finish a seedbox on a c1 server.

There are three steps to spawn a new server

  • Spawning a new server
  • Adding volumes
  • Provisioning the server

There are eight steps to setting up the server

  • Log in to the server
  • Updating the packages
  • Formatting the volumes
  • Installing the Software Repository
  • Installing rTorrent
  • Configuring rTorrent
  • Installing ruTorrent (WebUI)
  • Installing NGINX / PHP
  • Running rTorrent
  • Bonuses

Spawning a new server

Before we can start we have to spawn a new C1 Instance that we will be using for our SeedBox. You should be fluent with the following steps but I’ll detail them here anyway.

Step 1- Create a new server

First step is to create new server. Once you are logged into your cloud account click the Create Server button. You should get a screen that looks like the following:

Once you are here simply give your server a name (preferably something obvious like SeedBox) and choose Ubuntu Trusty (14.04 LTS) as the Image. (Whilst Ubuntu Utopic (10.10) and Debian Wheezy should work, I haven’t tested them and thus I can’t provide any support if they don’t work)

Step 2 - Adding Volumes

The next step is to add a volume to your SeedBox. The size of the volume will much depend on how much content you think you will be seeding.

Whilst everyone’s initial reaction will be to create a volume that is the largest possible, please think about your actual use cases before creating a large volume as this impacts other customers in the Cloud Preview.

This is a free trial so be fair and try not to use too many resources.

You server will have an existing volume already added to your server. Click the edit button and change the name.

This will come in handy in the future incase you want to snapshot it or attach it to another server. You can also change the default size from 100GB if you think you need more or less space.

Please take note of what I said above and be fair to other Online Lab’s users. Once you have edited the volume click the Add New Volume button. Heres an example:

Optional Bonus

If the maximum size of a single volume isn’t enough (which would make me wonder what you are seeding) then you can create a second volume at this stage too. If you choose to do this, make sure you make both volumes the same type (either LSSD or LHDD). Later on in the guide I’ll show you how to utilize both the volumes. Please note that due to space issues currently in the cloud, trying to provision a server with more than two volumes will fail. Keep that in mind.

Step 3 - Provisioning the server

Once you have got everything looking how you want it, click the Create Server button at the bottom and give your server some time to provision.

Setting up the server

Now we get to the fun part, readying the server for use as a seedbox.

Step 1 - Log in to the server

The IP used to connect to your server is the public one listed in the control panel:

Step 2 - Updating the packages

Now that we are connected, It’s always a good idea to make sure your system is up to date before you start doing anything else so lets make sure all our packages are up to date.

To update our server we’ll start by fetching the latest list of packages and versions from the repository:

apt-get update

Then upgrade all the packages to their latest version:

apt-get upgrade

If there are packages to update they will be listed on the screen. Press the Y key if prompted to accept the upgrade.

Step 3 - Formatting the volumes

Now that everything is ready we are going to format the volume we added in the creation step so it’s ready for use.

Optional Bonus

If you chose to create more than one volume in the creation step please skip to 3B now!

Step 3A - Single Volume

If you added a single volume in the creation stage formatting and mounting your volume is reasonably easy. For this guide I’m going to be using ext4 as the file system type.

To format the volume carefully enter the following command:

mkfs -t ext4 /dev/nbd1

Give it some time to format the volume. Once its complete we can now mount the drive. Simply enter the following command to mount it at the path /mnt:

mount /dev/nbd1 /mnt

Congratulations you have just mounted your data volume!

Step 3B - Multiple Volumes

In order to easily utilize both the volumes we added in the creation stage we are going to make use of LVM. LVM is a volume manager that can do all sorts of amazing things with disks in software. To get started we need to install LVM:

apt-get install -y lvm2

Then we are going to create what is called a physical volume (pv) on each of our volumes:

pvcreate /dev/{nbd1,nbd2}

Next we are going to create a volume group (vg) which groups all our physical drives into one big drive:

vgcreate lvm /dev/nbd1 /dev/nbd2

Now we are ready to create a logical volume (lv) which is a chunk of our volume group that we can use as if it was a physical drive. We want to use all the space available so we use the following command:

lvcreate -l 100%FREE -n downloads lvm

The drive will now be available at /dev/lvm/downloads (where lvm is the volume group and downloads is the logical volume). Lets format it and mount it:

mkfs -t ext4 /dev/lvm/downloads

This command can take a while to run as it has to format two separate drives over the network.

mount /dev/lvm/downloads /mnt

Congratulations you have just mounted your data volume on /mnt!

Step 4 - Installing the Software Repository

Now comes the fun part, installing the SeedBox software. For this we’ll be using rTorrent and the wonderful Web-GUI ruTorrent.

I have compiled and uploaded the latest version of rTorrent and libTorrent to my Cloud Ports repository. To access it we first have to install the verification key for the repository and then add it to our repository list. To install the key enter the following command:

apt-key adv --keyserver hkp://keys.gnupg.net --recv B51AD4BE

This will download and install my GPG key that is used to sign the packages I compile and upload (to make sure you are downloading packages I built!). Run the following to install the repository:

echo "deb http://10.1.22.179/ubuntu cloud main" > /etc/apt/sources.list.d/cloud.list

Now that it is added we have to update our packages list again. To do that:

apt-get update

Note

If you do not wish to use my repository, rTorrent 0.9.2 is available in the Ubuntu repository.

Step 5 - Installing rTorrent

The first step is to install rTorrent. To get the latest version enter the following:

apt-get install -y rtorrent

It will grab rTorrent and its dependencies from my cloud ports repository and install them! Congratulations rTorrent is now installed! Now to configuring it.

Step 6 - Configuring rTorrent

This step is probably one of the most delicate and takes some time to refine. Most of the following configuration options are based on personal preference but some are also tweaked for the Cloud. Lets start by creating the configuration file for rTorrent. I’ll provide my configuration file for you to get started with:

wget -qO ~/.rtorrent.rc http://gist.ptn.re/xeoncore/323fb644f6804671bfce

Now open it up and edit it to you liking:

nano ~/.rtorrent.rc

The first thing you will need to change is the ip = xxx.xxx.xxx.xxx line. Replace the xxx.xxx.xxx.xxx with your Public server IP! This enables rTorrent to forward the correct external IP to trackers and the DHT. You may also want to change the directory and session entries but make sure you put them under the /mnt path otherwise they won’t end up being put on your second volume. Probably the main part you will want to modify is this section:

min_peers = 20
max_peers = 100
min_peers_seed = 10
max_peers_seed = 100
max_uploads = 40

Change the values to what you need or want. Once you are done press Ctrl+O and then Enter to save the file, then Ctrl+X to close nano.

The next step is to create the paths we will be storing files in. If you kept the example paths in your rTorrent configuration file the command looks like the following:

mkdir /mnt/{downloads,session,watch}

And thats it for the rTorrent configuration!

Step 7 - Installing ruTorrent (WebUI)

The next step is to install the ruTorrent web interface for rTorrent. First create a folder to store it in:

mkdir /var/www

Then get the latest version of it and install it there:

curl -sN https://codeload.github.com/Novik/ruTorrent/tar.gz/master | tar xzv --strip 1 -C /var/www/

Now we just need to edit the configuration a bit to work in our environment. Run the following commands:

sed -i "s|topDirectory = '/'|topDirectory = '/mnt'|" /var/www/conf/config.php
for cmd in php curl gzip id stat; do sed -i "s|\"$cmd\"\s*=>\s*''|\"$cmd\" => '"`which $cmd`"'|" /var/www/conf/config.php; done

Next we will remove some plugins that don’t play nicely:

rm -fr /var/www/plugins/{httprpc,rpc}

Step 8 - Installing NGINX / PHP

ruTorrent is a Web interface for controlling rTorrent, so our next step in getting it running is installing a web server. If you have a preference of web server and you know how to set it up, skip this step and install/configure your own web server and PHP.

First start by installing nginx and PHP:

apt-get install -y nginx php5-fpm

Next remove the existing default config files:

rm /etc/nginx/conf.d/*

And grab the configuration file from here:

wget -qO /etc/nginx/conf.d/rtorrent.conf http://gist.ptn.re/xeoncore/6955956701d1a449e3f2

Next we create a username and password to protect our ruTorrent interface from unauthorized people. I’ve provided a script that will ask for a username and a password, will salt and hash it then generate a passwd entry for nginx. The following scripts source can be found here:

bash <(curl -sSL http://gist.ptn.re/xeoncore/a9238c51921d04c878f2) > /etc/nginx/passwd

Add nginx to the www-data group:

usermod -a -G www-data nginx

Now just restart NGINX:

service nginx restart

9 - Running rTorrent

Congratulations on making it this far! To keep rTorrent running in the background we need to install a program called screen:

apt-get install -y screen

Now we can start rTorrent and hope for the best:

screen -dmS rtorrent rtorrent

Enjoy!

Now simply browse to your public IP address, enter your username and password, and enjoy your seedbox!

Bonuses

Everyone likes bonuses right? Heres a few tips and tricks to making it all work a bit better!

Install extra dependencies for ruTorrent

ruTorrent and some of its plugins require extra dependencies to work. You can install them by doing the following:

sed -i "s/universe/universe multiverse/" /etc/apt/sources.list
apt-get update
apt-get install -y mediainfo unzip unrar

Fix CPU Load plugin

The CPU load plugin works based on the Load Avg. reported by the server. Because the kernel on the Cloud instance has a Load Avg. bug, it will report 30% as the minimum load. To fix this, simply run the following command:

sed -i "s/\$arr\[0\]\*100/(\$arr[0]-1)*100/" /var/www/plugins/cpuload/cpu.php

Fusion de 2 volumes
[ANSWERED] - Combine hard disks?
[ANSWERED] - LVM partitioning on VC1S
#2

Good tutorial , written in detail.

Thanks


#3

Im running a test seedbox for 2 weeks now with deluge, works ok, only the speed is not so fast, what is the average transfer speeds you guys have with your seedboxes?


#4

Average upload speed depends on what I’m seeding and how popular it is, but I’m getting on average no less than 7MB/s


#5

Hey,
I need a bit of help.
Got to the end but nothing is seeding after a download. While its downloading things are seeding. Is this something to do with there being a notice at the bottom about 6890 being blocked?


#6

Maybe, although it shouldn’t be connecting to anything on port 6890 with the stock configuration. I’ll look further.


#7

I restarted and it changed port. Its still not seeding something which currently has more leechers then seeders?? This is happening over two different trackers?


As you can see one of them has uploaded 1 gig or so. This happened while it was downloading, but then as soon as 100% was reached it stopped uploading to other peoples?


#8

Same here here getting notice of port 6890 closed.


#9

Refreshed the browser and its ok now.


#10

I see this in my log.How to fix this all?

[26.01.2015 09:24:29] WebUI started.
[26.01.2015 09:24:32] Webserver user doesn’t have read/write/execute access to the torrents directory. You cannot add torrents via ruTorrent. (/var/www/share/users/kloud/torrents)
[26.01.2015 09:24:32] Webserver user doesn’t have read/write/execute access to the settings directory. ruTorrent settings cannot be saved. (/var/www/share/users/kloud/settings)
[26.01.2015 09:24:32] rTorrent user must have read/execute access to the torrents directory. You cannot add torrents via ruTorrent. (/var/www/share/users/kloud/torrents)
[26.01.2015 09:24:32] rTorrent user must have read/write/execute access to the settings directory. (/var/www/share/users/kloud/settings)
[26.01.2015 09:24:32] rTorrent user can’t access ‘stat’ program. Some functionality will be unavailable.
[26.01.2015 09:24:32] unpack: Plugin will not work. rTorrent user can’t access external program (php).
[26.01.2015 09:24:32] create: Plugin will not work. rTorrent user can’t access external program (php).
[26.01.2015 09:24:32] loginmgr: Some functionality will be unavailable. rTorrent user can’t access external program (php).
[26.01.2015 09:24:32] rss: Plugin will not work. rTorrent user can’t access external program (php).
[26.01.2015 09:24:32] history: Plugin will not work. rTorrent user can’t access external program (php).
[26.01.2015 09:24:32] rutracker_check: Plugin will not work. rTorrent user can’t access external program (php).
[26.01.2015 09:24:32] datadir: Plugin will not work. rTorrent user can’t access external program (php).
[26.01.2015 09:24:32] scheduler: Plugin will not work. rTorrent user can’t access external program (php).
[26.01.2015 09:24:32] trafic: Plugin will not work. rTorrent user can’t access external program (php).
[26.01.2015 09:24:32] autotools: Plugin will not work. rTorrent user can’t access external program (php).
[26.01.2015 09:24:32] retrackers: Plugin will not work. rTorrent user can’t access external program (php).
[26.01.2015 09:24:32] ratio: Some functionality will be unavailable. rTorrent user can’t access external program (php).
[26.01.2015 09:24:32] rss: Some functionality will be unavailable. rTorrent user can’t access external program (curl).
[26.01.2015 09:24:32] screenshots: Plugin will not work. rTorrent user can’t access external program (ffmpeg).
[26.01.2015 09:24:32] _task: Some functionality will be unavailable. rTorrent user can’t access external program (pgrep).
[26.01.2015 09:24:32] mediainfo: Plugin will not work. rTorrent user can’t access external program (mediainfo).


#11

hi .
thank you very much for this useful tutorial .
i get some problem in this step

apt-key adv --keyserver hkp://keys.gnupg.net --recv B51AD4BE

after i run this command it says

root@tor1:~# apt-key adv --keyserver hkp://keys.gnupg.net --recv B51AD4BE
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --homedir /tmp/tmp.CZXTker7X0 --no-auto-check-trustdb --trust-model always --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver hkp://keys.gnupg.net --recv B51AD4BE
gpg: requesting key B51AD4BE from hkp server keys.gnupg.net
gpg: keyserver timed out
gpg: keyserver receive failed: keyserver error

is there anything i am doing wrong


#12

@synan_hero You have to change the dns to 8.8.8.8 / 8.8.4.4


#13

ok thanks .
when i trying i also solved like this

apt-key adv --keyserver hkp://104.207.151.221 --recv B51AD4BE

#14

You need to change the permissions of the /var/www folder. I don’t know why this has only just started happening now.

chown -R www-data:www-data /var/www

#15

You need to follow every step till end of tutorial , you are missing some plugins.


#16

We created an instant app to help you installing rtorrent and rutorrent in one click. Everything is on our hub!


#17

Hello,

Why removing the RPC plugins? How to control rutorrent from another server then? Is there a workaround?
Thanks


#18

Hi,

I honestly don’t remember exactly why I removed the plugin :stuck_out_tongue: Probably because otherwise rtorrent could be accessed without authentication?


#19

I have a C2M server. How can I install on it your Torrent apps pack?