Wednesday 31 December 2014

Ultimate Seedbox Tutorial (Step-By-Step)

14:05 Posted by Jurgens Krause , , , , , , 1 comment

Setting up your own seedbox from scratch, step by step tutorial.

While Ubuntu may not be the most lightweight Linux distro available, ti does make things very easy. I will be using Ubuntu 14.04 Server. I developed this tutorial using VirtualBox, but if you have a spare laptop or old pc, that will work just as well.

I will show you how to install Ubuntu 14.04 server, install the latest version of Deluge, including the daemon and web interface, as well as set up a basic FTP server and Samba share to access your downloads.

Skip to Part 2 - Installing Software

Skip to Part 3 - Using Deluge

Part 1 - Installing Ubuntu

First you will need to download Ubuntu, 

You can get the latest version here. Make sure you get the right version for your hardware.

You can burn it to a CD or install from USB using LinuxLiveUsb creator.
Once you have the machine booting from your installation media, follow the steps below to install Ubuntu.

Step 1

You will be greeted with an installer language selection. I speak English, so that is what I will be using.

 Step 2

It's not rocket science, just select "Install Ubuntu Server" and press enter.

 Step 3

You get to pick your language again for some reason.

Step 4

Select your location.

Step 5

Trust me it's faster to select your keyboard layout rather than letting Ubuntu try to detect it.

Step 4

In fact, based on your language choice it will probably already be selected

Step 5

English (US), not surprises here.

Step 6

I bet you can come up with a more creative name for your server than I did.

Step 7

To keep things simple, I am using "seedbox" as my username and password. This is not secure, also I don't care if this is secure, you might though. I would suggest that you stick with "seedbox" as the username and choose your own password.

Step 8

I don't care if it is not secure, I save my private pictures on iCloud anyways.

Step 9

You can let Ubuntu try to figure out the time, it has never failed me.

Step 9

Setting up the partitions can be intimidating, why not let Ubuntu do it for you. I usually just go for "Guided - use entire disk". you may have a reason to do it differently.

Step 10

I don't use a proxy, in fact if you want to run a seedbox through a proxy then good luck to you.

Step 11

You may elect different, but I am okay with security updates.

Step 12

I just select OpenSSH at this point, since I will be installing what I need later on.

Step 13

Finish out the installation and let the computer reboot.

Part 2 - Setting up the software

Log in with the username and password we configured while installing.
Username: seedbox
Password: seedbox

Switch to a root user, since everything that we need to do needs to be done as root
sudo -s

Setting your IP Address

While you can use DHCP to assign the server's IP Address, I find it much more useful to use a static IP. It will allow me to set up port forwarding on my router and also I will always know what IP to use when connecting with Putty or another SSH Client.

Use your favourite editor to open /etc/networking/interfaces
vim /etc/networking/interfaces

Change it to match the following, obviously you should change it to match your network configuration:
# The primary network interface
auto eth0
iface eth0 inet static

Run the following command
/etc/init.d/networking restart

You will now be able to connect using Putty, which is easier since you will be able to copy and paste the commands straight into the Putty window.

Installing and configuring Deluge

First we need to add the Deluge Repository so that get the latest version of Deluge
add-apt-repository ppa:deluge-team/ppa
apt-get update

Now let us install the Deluge Daemon, Deluge Console as well as the Deluge Web Interface
apt-get install deluged deluge-web deluge-console

Next we want to create the user that Deluge will run under, we also want to add our default "seedbox" user to the "deluge" group so that we have access to the downloaded files.
adduser --system --group --home /var/lib/deluge deluge
You also want to add the "seedbox" user to the "deluge" group to ensure that you can access the downloaded files.
sudo adduser seedbox deluge
In order to enable logging, which is invaluable in terms of troubleshooting, run the following on the command line:
sudo mkdir -p /var/log/deluge
sudo chown -R deluge:deluge /var/log/deluge
sudo chmod -R 750 /var/log/deluge

Now, open up your favorite text editor and put the following in /etc/init/deluged.conf. This is the upstart script to run the Deluge Deamon, and was taken from the Deluge documentation.
# deluged - Deluge daemon
# The daemon component of Deluge BitTorrent client. Deluge UI clients
# connect to this daemon via DelugeRPC protocol.

description "Deluge daemon"
author "Deluge Team"

start on filesystem and static-network-up
stop on runlevel [016]

respawn limit 5 30

env uid=deluge
env gid=deluge
env umask=007

exec start-stop-daemon -S -c $uid:$gid -k $umask -x /usr/bin/deluged -- -d -l /var/log/deluge/daemon.log -L warning

Do the same for the Web Interface startup script in /etc/init/deluge-web.conf
# deluge-web - Deluge Web UI
# The Web UI component of Deluge BitTorrent client, connects to deluged and
# provides a web application interface for users. Default url: http://localhost:8112

description "Deluge Web UI"
author "Deluge Team"

start on started deluged
stop on stopping deluged

respawn limit 5 30

env uid=deluge
env gid=deluge
env umask=027

exec start-stop-daemon -S -c $uid:$gid -k $umask -x /usr/bin/deluge-web -- -l /var/log/deluge/web.log -L warning

Now, create a remote user with the following command:
echo "seedbox:seedboxpassword:10">>/var/lib/deluge/.config/deluge/auth
This creates a user with the name "seedbox" and password "seedboxpassword"

Lastly, we need to enable remote access:

Stop the running deamon, this will cause it to write the current config into /var/lib/deluge/.config/deluge/core.conf:
service deluged stop

Edit the main config file located in /var/lib/deluge/.config/deluge/core.conf. You need to find the line that looks like this:
"allow_remote": false,
And change it to read:
"allow_remote": true,

Restart the Deluge daemon:
service deluged start

Installing and configuring FTP

If you want to be able to access your downloads via FTP, please follow the steps below.

Install vsftpd
apt-get install vsftpd

Using Symlinks you can make a shortcut in your home directory pointing to the Deluge download folder:
ln -s /var/lib/deluge/ /home/seedbox/deluge

That is all you need to do to get FTP up and running.

Using an FTP client you can now connect with the "seedbox" user and password, and it show a shortcut to the deluge folder where all your downloads will end up:

Installing and configuring Samba

If you want to be able to access your downloads directly with your Windows PC, you will need to install samba

Install Samba
apt-get install samba

Run smbpasswd to create a samba login for your "seedbox" user
smbpasswd -a seedbox

Next you want to edit the samba config in /etc/samba/smb.conf, but let's start by making a backup of the default config:
cp /etc/samba/smb.conf /etc/samba/smb.bak

Then add the following right at the end of  /etc/samba/smb.conf
path = /var/lib/deluge/
available = yes
valid users = seedbox
read only = no
browseable = yes
public = yes
writable = yes

Now, if you point a Windows Explorer to \\<seedbox ip> you can login using the username and password used above with smbpasswd:

Part 3 - Using Deluge

You will have two ways of managing your seedbox. The first method is by logging in to the web interface.

Using the web interface

Point your web browser to:
http://<seedbox ip>:8112

You will be greeted by the Deluge Login screen:

The default password for Deluge is "deluge"

On first login you will be prompted to change your password. My advice is that you do it.

Select the local server and click "Connect":

Change the password:

While we have the settings open, go to the Daemon category and make sure "Allow Remote Connections" is enabled.

You can now start using Deluge using the web interface. Add torrents as you would with any normal torrent client. You will be able to access any downloaded files using Samba or FTP.

Using the Daemon

This is in my opinion the best feature of Deluge.
You can install the Deluge client on your PC, and use that to manage your seedbox. That means you don't need to upload torrents using the web interface. You can simply open them on the client on your computer, and they will automatically be added to the server.

I assume you know how to install Windows applications, so I will walk through from the point where you run the Deluge client for the first time.

To get access to the connection manager you need to switch off classic mode, to do this, open up the Preferences window, and go to the "Interface" tab.

Under Classic Mode, deselect "enable" and click apply.

You will be prompted to restart Deluge, click yes.

After restarting you will have access to the connection manager.

Click on Add

Enter the login details we created earlier, along with the correct IP for your seedbox.
Username: seedbox
Password: seedboxpassword

If you did everything correctly, you will now be able to connect to the server and start seeding!

1 comment:

  1. Thank you so much!! This helped a lot, I just set up a seedbox on an UBUNTU vps.