Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Make a Debian GNU/Linux seedbox with rtorrent and screen

Share your HowTo, Documentation, Tips and Tricks. Not for support questions!.
Message
Author
User avatar
Hallvor
Global Moderator
Global Moderator
Posts: 2041
Joined: 2009-04-16 18:35
Location: Kristiansand, Norway
Has thanked: 149 times
Been thanked: 212 times

Make a Debian GNU/Linux seedbox with rtorrent and screen

#1 Post by Hallvor »

What is a seedbox?

A seedbox is a dedicated server for downloading and uploading digital files. There are several possibilities when it comes to protocols, but this tutorial will teach you how to set up, configure and use a Debian server with the rtorrent bittorrent client.

The main reason why people get a seedbox is to upload large amounts of data. If you have access to a high-speed Internet connection that`s not in your house, you can administer the server`s uploads and downloads from home. If you set up a seedbox at home it can take care of all the torrenting and run day and night without wasting diskspace and resources on your main computer. Some private trackers have strict ratios, so you may have to seed the files for a long time to hit a decent ratio. This is where a seedbox comes in.

In this tutorial we`ll make a headless server running the very efficient rtorrent bittorrent client with screen for remote administration.


Requirements


1.Preferably a high speed internet connection
2.A computer (that we`ll use as server) with a big hard drive
3.A main computer running GNU/Linux, Windows or Mac OS to administer the seedbox


Since we are not installing a GUI, system requirements are very low. Just about any old computer will do:

CPU: 500 MHZ or higher is plenty for home usage
RAM: At least 64 MB, but 256 MB or more is recommended
HD: The install will use about 600 MB of diskspace + SWAP, but it is a good idea to give the OS more room to expand. A large HD with plenty of diskspace is obviously a good idea for sharing files

First you need the correct ISO. You only need CD1. http://www.debian.org/CD/http-ftp/#stable If you are on a DSL, it will be faster to use a netinstall. Your computer will get the files it needs from the Internet: http://www.debian.org/CD/netinst/

Burn the ISO to a blank CD and boot from it.


Installing the base system

Basic configuration

When the system boots, you`ll see the splash screen. Select graphical install or text-mode install.

Image

Here is an example of a text mode install: http://www.youtube.com/watch?v=fmV1c6bcKb0

And here is an example of a graphical install: http://www.youtube.com/watch?v=sJuJbqxxhos

Select language, country and keyboard layout.

Image

Image

Image

Image

Now you need to choose a name for your server, e.g. «seedbox». You also need to put in the name of the network.

Image

Image


Next up is the partitioning. There are several ways of doing this, and the easiest is to use the entire hard drive, and this is recommended for beginners.

Image

Image

Image

Image

Image


If you want a little more control, select manual partitioning. In this case we make three partitions:

/swap <---- temporary process memory image (size: 2xRAM)
/ <---- the main system (3 GB)
/home <---- config files and data storage (remaining diskspace)

Assuming that your drive is empty and without a partition table, you need to select it and hit enter. The installer will ask if we want to make a partition table. Select yes. We have now got a hard drive with free space to partition. Next, select “FREE SPACE” and hit enter.

The installer will now ask some questions. We are first going to create the swap partition. We make this twice the size of our RAM. (Of course if your server has 4 GB of RAM it will hardly need swap at all, so making an 8 GB swap partition will for the most part be a waste of diskspace. On a server with 64 MB of RAM, making a swap partition larger than 128 MB makes a lot of sense, because the less RAM you have, the more swap you need.)

In this case we make a swap partition with a size of 1000 MB. Select mountpoint, hit enter and change it to “swap area”. The rest of the settings for the swap partition should be Primary; Beginning of the drive; non-bootable.

Repeat the same for

/ (root): 3 GB; Primary; Beginning of the drive; filesystem “ext3”; Mountpoint / ; bootable

and finally

/home; (the remaining diskspace); Primary; Filesystem “ext3”; Mountpoint /home; non-bootable

After this you are done with the partitioning and can write the changes to the disk.

The installer will now install your base system.

Image

You are now asked for a root password. Make sure this password is strong. Repeat the password to make sure there are no typos.

Image

Image

Next you must make a normal user account. In this case we call our user rtorrent. (It is important that you call the user rtorrent if you just want to copy and paste commands later on.) Choose a password and confirm.

Image

Image

Image

Image


Next you must configure apt. Choose a mirror geographically close to you.

Image

Image

Unless you want to use a proxy server, skip the next step.


Image

Apt will now update the packages.

Image

Image


You will be questioned if you want to participate in the package survey. You can skip it by pressing no.

Image

After this you have reached the package selection screen. Make sure you unmark ALL the checkboxes. We will install what we need later on.

Image


When you are asked to install the GRUB boot loader on the master boot record, select yes.

Image

The base system install is now complete. Remove the CD from the drive and hit continue to reboot the system.

Image


Further base system configuration

You will be greeted by a black screen.

Image

Log in using root as login and your root password.

First it is a good idea to edit your sources.list. This file decides where to look for updates. We don`t want to use the CD anymore since we are connected to the Internet on a DSL connection. Open the file with

Code: Select all

nano –w /etc/apt/sources.list

Delete the top cdrom entries, so that your computer only looks for files on the Internet.


Your sources.list should look something like this:

Code: Select all

deb http://ftp.no.debian.org/debian/ squeeze main
deb-src http://ftp.no.debian.org/debian/ squeeze main

deb http://security.debian.org squeeze/updates main
deb-src http://security.debian.org squeeze/updates main

deb http://ftp.us.debian.org/debian/ squeeze-updates main
deb-src http://ftp.us.debian.org/debian/ squeeze-updates main
We do not need any contrib or non-free sources.

Save with Control+X, press y to confirm and press enter to overwrite the old /etc/apt/sources/list

Now update the sources with

Code: Select all

aptitude update

and install upgrades (if there are any) with

Code: Select all

aptitude safe-upgrade
Next we need to install the openssh server, to make it possible to remote control your server

Code: Select all

aptitude install ssh openssh-server
After the install is complete we can configure the SSH server

Code: Select all

nano -w /etc/ssh/sshd_config
Look for the line containing X11Forwarding and change «yes» to «no» since we are not going to install a GUI.

Restart the SSH server for the new change to take effect

Code: Select all

/etc/init.d/ssh restart
From now on you can remote control your server using an SSH client such as Putty if you are on Windows. In GNU/Linux you can use the console.

You connect to the server using the following syntax: ssh user@host. Assuming that your server is located at 192.168.1.10, you can connect to it by typing

Code: Select all

ssh root@192.168.1.10
into your console or SSH shell.

You will now get logged in as root with all its power.

If you for some reason want to log in directly as user (rtorrent), you can do it like this:

Code: Select all

ssh rtorrent@192.168.1.10
You will now get logged in as a regular user.


Static IP

If you are behind a router, some routers will give the computers behind them the same IP every time, based on their MAC addresses. If this is the case, you can skip this step. (My router is a Linksys WRT54G with dd-wrt, and it always gives the server the same IP.)

Because the Debian Lenny installer has configured our system to get its network settings via DHCP, we have to change that now because a server should have a static IP address. An IP address is pretty much like a phone number. (If you are calling someone often, you don`t want them to have a new phone number every time.)

First make a backup of the old config file. If something goes wrong, you can copy everything back with a simple commend.

Code: Select all

cp /etc/network/interfaces /etc/network/interfaces.bak
If something goes wrong you can restore the file later with

Code: Select all

cp /etc/network/interfaces.bak /etc/network/interfaces
To view your current route/gateway, you can use

Code: Select all

netstat –nr
Now you can edit the file using

Code: Select all

nano –w /etc/network/interfaces


Look for the line called “iface eth0 inet dhcp” to “iface eth0 static” and add the info from netstat to keep the current IP, and the result could be like this, assuming your router is 192.168.1.1 and you want your static IP to be 192.168.1.10:

Code: Select all

# The loopback interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
       address 192.168.1.10
       netmask 255.255.255.0
       network 192.168.1.0 
       gateway 192.168.1.1

When all this info is in place, press Control+x, y to save and enter to exit.

Then type

Code: Select all

/etc/init.d/networking restart
Cross your fingers and test if it works by pinging something

Code: Select all

ping -c 3 google.com
If you get 0% package loss you can turn the server off, unplug the screen, keyboard and mouse and connect the server to your router with just the power cord and Ethernet cable connected. Turn it on and you are up and running in no time.

Now we are going to connect to the server. Open a console and type ssh root@the static ip address you just set, e.g.

Code: Select all

ssh root@192.168.1.10
If everything goes well, you will be asked to type the root password you set during the install, and you will be greeted with a console. You are now in control of the server.


Installing and configuring rtorrent

Code: Select all

aptitude install rtorrent screen psmisc
Then we are going to create an init file in /etc/init.d/rtorrent

Code: Select all

nano -w /etc/init.d/rtorrent

Code: Select all

#! /bin/sh
### BEGIN INIT INFO
# Provides: rtorrent
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: rtorrent
# Description: start rtorrent
### END INIT INFO

case "$1" in
  start)
	echo "Starting rtorrent..."
    su rtorrent -c 'screen -dmS rtorrent rtorrent'
    ;;
  stop)
	echo "Stopping rtorrent..."
	killall -s 2 rtorrent
    ;;
  *)
    echo "Usage: $0 {start|stop}"
    exit 1
    ;;
esac

exit 0

Save and exit.

Make the script executable and create symlinks:

Code: Select all

chmod 755 /etc/init.d/rtorrent

Code: Select all

update-rc.d rtorrent defaults


Now log in as user

Code: Select all

su – rtorrent
Copy the rtorrent config file to the home directory:

Code: Select all

cp /usr/share/doc/rtorrent/examples/rtorrent.rc /home/rtorrent/.rtorrent.rc
Create the directories needed by rtorrent:

Code: Select all

mkdir /home/rtorrent/watch/

mkdir /home/rtorrent/session/

mkdir /home/rtorrent/download/

Open /home/rtorrent/.rtorrent.rc

Code: Select all

nano –w /home/rtorrent/.rtorrent.rc


and add/change the following lines to this:

Code: Select all

directory = /home/rtorrent/download/

session = /home/rtorrent/session/

schedule = watch_directory,5,5,load_start=/home/rtorrent/watch/*.torrent


So your file looks something like this. Change the settings to your liking. If you don`t know what you are doing, these settings are mine and should work just fine:

Code: Select all

# This is an example resource file for rTorrent. Copy to
# ~/.rtorrent.rc and enable/modify the options as needed. Remember to
# uncomment the options you wish to enable.

# Maximum and minimum number of peers to connect to per torrent.
#min_peers = 40
max_peers = 100

# Same as above but for seeding completed torrents (-1 = same as downloading)
#min_peers_seed = 10
max_peers_seed = 50

# Maximum number of simultanious uploads per torrent.
max_uploads = 15

# Global upload and download rate in KiB. "0" for unlimited.
download_rate = 0
upload_rate = 200

# Default directory to save the downloaded torrents.
directory = /home/rtorrent/download/

# Default session directory. Make sure you don't run multiple instance
# of rtorrent using the same session directory. Perhaps using a
# relative path?
session = /home/rtorrent/session/

# Watch a directory for new torrents, and stop those that have been
# deleted.
schedule = tied_directory,10,10,start_tied=
schedule = untied_directory,10,10,close_untied=
schedule = watch_directory,5,5,load_start=/home/rtorrent/watch/*.torrent

# Close torrents when diskspace is low.
schedule = low_diskspace,5,60,close_low_diskspace=100M

# Stop torrents when reaching upload ratio in percent,
# when also reaching total upload in bytes, or when
# reaching final upload ratio in percent.
# example: stop at ratio 2.0 with at least 200 MB uploaded, or else ratio 20.0
#schedule = ratio,60,60,"stop_on_ratio=200,200M,2000"

# The ip address reported to the tracker.
#ip = 127.0.0.1
#ip = rakshasa.no

# The ip address the listening socket and outgoing connections is
# bound to.
#bind = 127.0.0.1
#bind = rakshasa.no

# Port range to use for listening.
port_range = 9000-9008

# Start opening ports at a random position within the port range.
port_random = yes

# Check hash for finished torrents. Might be usefull until the bug is
# fixed that causes lack of diskspace not to be properly reported.
check_hash = yes

# Set whetever the client should try to connect to UDP trackers.
use_udp_trackers = yes

# Alternative calls to bind and ip that should handle dynamic ip's.
#schedule = ip_tick,0,1800,ip=rakshasa
#schedule = bind_tick,0,1800,bind=rakshasa

# Encryption options, set to none (default) or any combination of the following:
# allow_incoming, try_outgoing, require, require_RC4, enable_retry, prefer_plaintext
#
# The example value allows incoming encrypted connections, tries to start 
# encrypted RC4 outgoing connections, but retries unencrypted if it fails.

encryption = allow_incoming,try_outgoing,enable_retry

# Enable peer exchange (for torrents not marked private)
#
peer_exchange = yes

# Enable DHT support for trackerless torrents or when all trackers are down.
# May be set to "disable" (completely disable DHT), "off" (do not start DHT),
# "auto" (start and stop DHT as needed), or "on" (start DHT immediately).
# The default is "off". For DHT to work, a session directory must be defined.
#Enabling DHT will give you more peers on public trackers, bit should not
#be enabled on private trackers as this will reduce speed and cause a privacy risk
# 

dht = auto

# UDP port to use for DHT. 
# 
dht_port = 9009

#
# Do not modify the following parameters unless you know what you're doing.
#

# Hash read-ahead controls how many MB to request the kernel to read
# ahead. If the value is too low the disk may not be fully utilized,
# while if too high the kernel might not be able to keep the read
# pages in memory thus end up trashing.
#hash_read_ahead = 10

# Interval between attempts to check the hash, in milliseconds.
#hash_interval = 100

# Number of attempts to check the hash while using the mincore status,
# before forcing. Overworked systems might need lower values to get a
# decent hash checking rate.
#hash_max_tries = 10
Afterwards, as always, save the file with Control+x, press y to confirm and press enter to overwrite the old file.

Remember to open the entire portrange above in your router and forward it to the seedbox IP. If you plan on using SSH for remote administration (i.e. outside your LAN), you must also open port 22 in your router and forward it. If you don`t know how this is a good starting point: http://portforward.com/

Now that you have configured everything, log in as root

Code: Select all

su
and type your root password

Start rtorrent as a daemon and use the new config file

Code: Select all

/etc/init.d/rtorrent start
rtorrent is running and ready to seed your torrents on your shiny new server. New torrents will be started automatically if they are dropped in /home/rtorrent/watch/

If you want to check the status of your torrents, and assuming that your server is 192.168.1.10, you can see the rtorrent status screen from your computer. (You must first exit the current ssh session.)

Open the console on your computer and type

Code: Select all

ssh -t rtorrent@192.168.1.10 'screen -r'
to access rtorrent (screen) on the server. If you haven`t added any torrents to /home/rtorrent/watch/, you will be greeted by this sight:

Image

You can also add torrents manually. Just press enter and type in the location of the torrent

Image

Now the torrent is added, but it won`t download until you tell it to. It is still maked inactive.

Image

To activate it, use the arrow keys to highlight the torrent and start it by pressing Control+s

Image

Now the torrent is moving.

There are some useful shortcuts to remember while using rtorrent

After you highlight a torrent with the arrow keys Up and Down, the arrow keys Left and Right gives more information about a particular torrent. To change the status of individual files (download or don`t download), press the spacebar on a highlighted file name.

If you have set a seed ratio, highlighting a torrent and pressing Shift + i will ignore default seed limits for this torrent.

Control + d will stop a download in progress. Pressing it again will remove a stopped download.

Control + s will start a stopped download

To increase the max upload rate, press a, s or d (a will increase with 1 Kb/s, s will increase it with 10 Kb, and d will increase it with 50Kb) To reduce, press z, x or c

To increase the max download rate, press Shift + a, s, or d. To reduce press Shift + z, x or c.

The finished files will be placed in /home/rtorrent/download/

To quit screen, press Control+a+d. (rtorrent will keep running on your server)

rtorrent will start automatically on boot and start seeding without any intervention.


Copying files to and from the seedbox

First we need to upload a torrent to /home/rtorrent/watch/ in the seedbox, and the download will start automatically. Once finished, we can copy the downloaded file(s) to the hard drive. To do that download Filezilla or any other FTP application that supports SFTP.

Assuming you want to use Filezilla, it is in the Debian repositories. (You can also use Filezilla for Windows and Mac.) You can install it in Debian with

Code: Select all

aptitude install filezilla
Start it and go to File -> Site Manager -> New site, and type in the following information

Host = The IP address of the seedbox, i.e. 192.168.1.10
Port = 22
Server Type = SFTP
Logon Type = Normal
User = rtorrent
Password = password for user rtorrent

Press connect and then upload your torrentfile to /home/rtorrent/watch/

If you want you can follow the download using screen, and when everything is done, use Filezilla (or another suited FTP client) to transfer the downloaded file(s) from /home/rtorrent/download/

It is also possible to copy files from the CLI using the scp command:

To copy a file from your machine to a remote machine:

Code: Select all

scp /path/file user@host:/path
To copy a file from a remote machine to your machine via ssh:

Code: Select all

scp user@host:/path/file /path

Seeding a torrent

As explained above, to download a torrent, drop the .torrent file in /home/rtorrent/watch/

To seed a torrent, follow these steps:

1. Make a .torrent file on your computer.

2. Upload the data files to /home/rtorrent/download/

3. Upload the .torrent file to the tracker

4. Upload the .torrent file to /home/rtorrent/watch/



… and you are seeding the file.



Maintaining and securing the seedbox



Security updates

The server, just like your regular computer, needs maintenance. It needs to have the latest security updates. Of course, if you want, you can log on using SSH and run

Code: Select all

aptitude update && aptitude safe-upgrade
now and then.

But if you are really lazy or have better things to do there is an easier way out. How about getting the server to automatically download and install all the security updates on its own? If that sounds good, type

Code: Select all

aptitude install unattended-upgrades
Enable them with

Code: Select all

dpkg-reconfigure -plow unattended-upgrades

The server will now keep itself up to date without you having to do anything.

But if the kernel has been upgraded you must still reboot the server to make the new changes take effect.


Fail2ban

Since you are running a server with SSH, there are probably already bots run by sociopaths trying to brute force into your seedbox already. As long as you made a strong password like I told you, you`re fine. But if you made login=root and password=root, your seedbox could already be cracked by now - if port 22 is open to the web. Changing the standard SSH port will make most of the bots move on to greener pastures, but if someone targets your seedbox, all they need is a portscan to discover what port you are using, and then try to brute force it.

With fail2ban you can make your own rules when it comes to failed password attempts. Say, if someone makes a certain number of failed password attempts for SSH within a certain amount of time, they will get banned for a certain amount of time. If fail2ban discovers a given number of failed password attempts, it will make a new rule in the powerful firewall iptables (installed by default).

You can list existing rules in iptables by typing

Code: Select all

iptables –L
into the terminal. By default there are no rules – which means all ports are open

You`ll probably get something like this

Code: Select all

 Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination 




You can install fail2ban with

Code: Select all

aptitude install fail2ban
The config files are located in /etc/fail2ban/, but the only file you need to edit is /etc/fail2ban/jail.conf

Let`s open it with

Code: Select all

nano –w /etc/fail2ban/jail.conf
In this section you can adjust the bantime of an offending IP

Code: Select all

[DEFAULT]

# "ignoreip" can be an IP address, a CIDR mask or a DNS host
ignoreip = 127.0.0.1
bantime  = 7200
maxretry = 4
Make sure SSH is enabled and adjust the number of retries:

Code: Select all

[ssh]

enabled = true
port	= ssh
filter	= sshd
logpath  = /var/log/auth.log
maxretry = 4

This means that if there are 4 failed password attempts from a certain IP, the IP will get banned in iptables for 7200 seconds.

If you are not checking the root mailbox, change it from “true” to “false”.

Save and exit when you are done.

Check if fail2ban is running by typing

Code: Select all

/etc/init.d/fail2ban status
You can stop and start fail2ban to make configuration changes effective with

Code: Select all

/etc/init.d/fail2ban stop
and

Code: Select all

/etc/init.d/fail2ban start
Fail2ban will start automatically on boot.


Accessing your seedbox from a remote location

So far we have concentrated on administering the seedbox from a computer at home. But if you want to use your seedbox when you are on holiday, or you left your seedbox connected in your friend`s house in Sweden – who has a 10 gigabit connection – you need to be able to transfer files to and from a remote location.

Assuming the seedbox is up and running, you just need the external IP to connect to your seedbox. The problem is that now and then the IP is changing, and if it is changing while you are on the other side of the planet, the old IP won`t work.

However there is a way to circumvent this – by getting a dynamic DNS. That means you`ll have a hostname instead of a changing IP address. It works like this: Your computer will notify the DNS server of its IP at given intervals, so you can always use the same hostname for login – even if your IP is changing.

There are several providers of free DNS services, for instance http://www.no-ip.org

If you want to use it you need to register for a hostname, make an account and (on the web page) attach the hostname to your username.

After that install the noip2 package on your server

Edit 18.08.11: You may have to grab this package from Sid/unstable. (It has no dependencies.)

Code: Select all

aptitude install noip2
and fill in, among others, username and password that you just registered on the Internet and the name of your network interface, e.g. eth0. If you make a mistake you can change the input data with

Code: Select all

dpkg-reconfigure noip2
When everything is set up you can log into your seedbox replacing the old hostname with the new one you just made.

To SSH into your seedbox you still use ssh user@hostname, e.g. like this, but with letters replacing numbers:

Code: Select all

ssh rtorrent@myshinynewseedbox.no-ip.org
As hostname on SFTP, just use the same hostname, e.g. myshinynewseedbox.no-ip.org instead of the IP. Using the IP will still work, but the new hostname will work regardless of the IP changing – and it will sooner or later.


Good luck!

I`d love to hear your experiences from this tutorial and likewise if there are tips, tricks or errors I need to be aware of.

That`s it. Happy torrenting!


Please discuss here: http://www.debianuserforums.org/viewtop ... f=24&t=293


Edits:
25.02.11: Updated for Squeeze


Credits:

http://www.howtoforge.org/perfect-serve ... ispconfig3
http://forums.bit-tech.net/showthread.php?t=129569
http://www.the-art-of-web.com/system/fail2ban/
http://www.bytetouch.com/blog/linux/how ... on-debian/
http://kmandla.wordpress.com/2007/05/02 ... ike-a-pro/
http://geekfeat.com/2010/06/howto-setup ... orrenting/
Last edited by Hallvor on 2011-08-24 14:23, edited 26 times in total.
[HowTo] Install and configure Debian bookworm
Debian 12 | KDE Plasma | ThinkPad T440s | 4 × Intel® Core™ i7-4600U CPU @ 2.10GHz | 12 GiB RAM | Mesa Intel® HD Graphics 4400 | 1 TB SSD

User avatar
Bro.Tiag
Posts: 1924
Joined: 2007-06-02 19:14

Re: Make a Debian GNU/Linux seedbox with rtorrent and screen

#2 Post by Bro.Tiag »

Thanks for this How To, finally got me off me arse to set up some type of server thingy.

I ran into a few issues I could use some help with, I'm sure it's operator error. The first bit of trouble I ran into was here.
Hallvor wrote:Static IP

If you are behind a router, some routers will give the computers behind them the same IP every time, based on their MAC addresses. If this is the case, you can skip this step. (My router is a Linksys WRT54G with dd-wrt, and it always gives the server the same IP.)

Because the Debian Lenny installer has configured our system to get its network settings via DHCP, we have to change that now because a server should have a static IP address. An IP address is pretty much like a phone number. (If you are calling someone often, you don`t want them to have a new phone number every time.)

First make a backup of the old config file. If something goes wrong, you can copy everything back with a simple commend.

Code: Select all

cp /etc/network/interfaces /etc/network/interfaces.bak

If something goes wrong you can restore the file later with

Code: Select all

cp /etc/network/interfaces.bak /etc/network/interfaces
To view your current route/gateway, you can use

Code: Select all

netstat –nr
Now you can edit the file using

Code: Select all

nano –w /etc/network/interfaces
Look for the line called “iface eth0 inet dhcp” to “iface eth0 static” and add the info from netstat to keep the current IP, and the result could be like this, assuming your router is 192.168.1.1 and you want your static IP to be 192.168.1.10:

Code: Select all

auto eth
iface eth0 inet static
       address 192.168.1.10
       netmask 255.255.255.0
       network 192.168.1.0  
       broadcast 192.168.1.255
       gateway 192.168.1.1
When all this info is in place, press Control+x, y to save and enter to exit.

Then type

Code: Select all

/etc/init.d/networking restart
Cross your fingers and test if it works by pinging something

Code: Select all

ping -c 3 google.com
If you get 0% package loss you can turn the server off, unplug the screen, keyboard and mouse and connect the server to your router with just the power cord and Ethernet cable connected. Turn it on and you are up and running in no time.
I'm hoping you can help me out on what to put in /etc/network/interfaces. Here is my output from "netstat –nr"

Code: Select all

netstat -nr
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.168.1.0     0.0.0.0         255.255.255.0   U         0 0          0 eth0
0.0.0.0         192.168.1.1     0.0.0.0         UG        0 0          0 eth0
and when I run "/etc/init.d/networking restart" I get the following:
netstat –nr wrote:seedbox:~# /etc/init.d/networking restart
Reconfiguring network interfaces.../etc/network/interfaces:14: duplicate option
ifdown: couldn't read interfaces file "/etc/network/interfaces"
/etc/network/interfaces:14: duplicate option
ifup: couldn't read interfaces file "/etc/network/interfaces"
failed.
This is what I have in my /etc/network/interfaces
/etc/network/interfaces wrote:# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
#auto lo
#iface lo inet loopback

# The primary network interface
#auto eth
iface eth0 inet static
       address 192.168.1.6
       netmask 255.255.255.0
       network 192.168.1.0
       broadcast 192.168.1.255
       gateway 192.168.1.1
Cheers

User avatar
Hallvor
Global Moderator
Global Moderator
Posts: 2041
Joined: 2009-04-16 18:35
Location: Kristiansand, Norway
Has thanked: 149 times
Been thanked: 212 times

Re: Make a Debian GNU/Linux seedbox with rtorrent and screen

#3 Post by Hallvor »

I see I made a mistake in the howto. It`s fixed now. Setting a static IP is the only part in the howto I didn`t test myself.

Try changing your entry to this and remove broadcast address:

Code: Select all

# The loopback interface
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
       address 192.168.1.6
       netmask 255.255.255.0
       network 192.168.1.0
       gateway 192.168.1.1
If that doesn`t help, perhaps someone more experienced than myself can help you in the General help subforum.

Thanks for trying it out and good luck!
[HowTo] Install and configure Debian bookworm
Debian 12 | KDE Plasma | ThinkPad T440s | 4 × Intel® Core™ i7-4600U CPU @ 2.10GHz | 12 GiB RAM | Mesa Intel® HD Graphics 4400 | 1 TB SSD

User avatar
Bro.Tiag
Posts: 1924
Joined: 2007-06-02 19:14

Re: Make a Debian GNU/Linux seedbox with rtorrent and screen

#4 Post by Bro.Tiag »

Hallvor wrote:I see I made a mistake in the howto. It`s fixed now. Setting a static IP is the only part in the howto I didn`t test myself.

Try changing your entry to this and remove broadcast address:

Code: Select all

# The loopback interface
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
       address 192.168.1.6
       netmask 255.255.255.0
       network 192.168.1.0
       gateway 192.168.1.1
If that doesn`t help, perhaps someone more experienced than myself can help you in the General help subforum.

Thanks for trying it out and good luck!
I'll give that a try when I get home from worktonight.

Cheers

User avatar
Bro.Tiag
Posts: 1924
Joined: 2007-06-02 19:14

Re: Make a Debian GNU/Linux seedbox with rtorrent and screen

#5 Post by Bro.Tiag »

Bro.Tiag wrote:
Hallvor wrote:I see I made a mistake in the howto. It`s fixed now. Setting a static IP is the only part in the howto I didn`t test myself.

Try changing your entry to this and remove broadcast address:

Code: Select all

# The loopback interface
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
       address 192.168.1.6
       netmask 255.255.255.0
       network 192.168.1.0
       gateway 192.168.1.1
If that doesn`t help, perhaps someone more experienced than myself can help you in the General help subforum.

Thanks for trying it out and good luck!
I'll give that a try when I get home from worktonight.

Cheers
OK, first time I tryed what you suggested, no go.The second time I tryed, I got a new error "ignoring eth=eth0", so I tryed a reboot, but no internet, not even with dhclient, so I re-typed everything into a new /etc/network/interfaces & rebooted. This time it worked, pure CFM I guess. Thanks.


The second thing I'm having trouble with is:
Hallvor wrote: Installing and configuring rtorrent

Code: Select all

aptitude install rtorrent screen psmisc
Then we are going to create a script located in /etc/init.d/rtorrent

Code: Select all

nano -w /etc/init.d/rtorrent
CODE: SELECT ALL

Code: Select all

#! /bin/sh
# rTorrent init script
#

case "$1" in
  start)
   echo "Starting rtorrent..."
    su rtorrent -c 'screen -dmS rtorrent rtorrent'
    ;;
  stop)
   echo "Stopping rtorrent..."
   killall -s 2 rtorrent
    ;;
  *)
    echo "Usage: $0 {start|stop}"
    exit 1
    ;;
esac

exit 0
Save and exit.

Make the script executable and create symlinks:

Code: Select all

chmod 755 /etc/init.d/rtorrent

Code: Select all

update-rc.d rtorrent defaults
I copied the script you provided for "/etc/init.d/rtorrent", but when I first ran "/etc/init.d/rtorrent start" I got the following error:

Code: Select all

seedbox:~# /etc/init.d/rtorrent start
/etc/init.d/rtorrent: line 6: syntax error near unexpected token `start'
/etc/init.d/rtorrent: line 6: `  start)'
seedbox:~#
I fixed that by removing the white spaces in front of "start", and had the same again for "*)". The when I run "/etc/init.d/rtorrent start" I get this error:

Code: Select all

seedbox:~# /etc/init.d/rtorrent start
/etc/init.d/rtorrent: line 7:  : command not found
/etc/init.d/rtorrent: line 8:  : command not found
/etc/init.d/rtorrent: line 9:  : command not found
seedbox:~#
I'm sure I'm missing something simple, but what?

The last thing was something very minor.
Hallvor wrote:Now copy the rtorrent config file to the home directory:

Code: Select all

cp /usr/share/doc/rtorrent/examples.rc /home/rtorrent/.rtorrent.rc
Should be (at least on my fresh Lenny install:

Code: Select all

cp /usr/share/doc/rtorrent/examples/rtorrent.rc /home/rtorrent/.rtorrent.rc
Cheers

User avatar
Hallvor
Global Moderator
Global Moderator
Posts: 2041
Joined: 2009-04-16 18:35
Location: Kristiansand, Norway
Has thanked: 149 times
Been thanked: 212 times

Re: Make a Debian GNU/Linux seedbox with rtorrent and screen

#6 Post by Hallvor »

OK, first time I tryed what you suggested, no go.The second time I tryed, I got a new error "ignoring eth=eth0", so I tryed a reboot, but no internet, not even with dhclient, so I re-typed everything into a new /etc/network/interfaces & rebooted. This time it worked, pure CFM I guess. Thanks.
Glad to hear it worked!
I copied the script you provided for "/etc/init.d/rtorrent", but when I first ran "/etc/init.d/rtorrent start" I got the following error:

Code: Select all

seedbox:~# /etc/init.d/rtorrent start
/etc/init.d/rtorrent: line 6: syntax error near unexpected token `start'
/etc/init.d/rtorrent: line 6: `  start)'
seedbox:~#
I fixed that by removing the white spaces in front of "start", and had the same again for "*)". The when I run "/etc/init.d/rtorrent start" I get this error:

Code: Select all

seedbox:~# /etc/init.d/rtorrent start
/etc/init.d/rtorrent: line 7:  : command not found
/etc/init.d/rtorrent: line 8:  : command not found
/etc/init.d/rtorrent: line 9:  : command not found
seedbox:~#
I'm sure I'm missing something simple, but what?
Could something have happened while copying the script? I found the script on this page (listed as one of my sources):

http://www.bytetouch.com/blog/linux/how ... on-debian/

Comparing the two scripts, I didn`t notice any differences at all, so I am quite surprised you are having problems. You could always try copying the script directly from that page to rule out any error on my part and try again. I use a fresh Lenny install myself, and it worked flawlessly on my computer. (There are also some additional tips on that page.)

Code: Select all

cp /usr/share/doc/rtorrent/examples.rc /home/rtorrent/.rtorrent.rc
Should be (at least on my fresh Lenny install:

Code: Select all

cp /usr/share/doc/rtorrent/examples/rtorrent.rc /home/rtorrent/.rtorrent.rc
Cheers
Sorry about that. Fixed.

Greetings
[HowTo] Install and configure Debian bookworm
Debian 12 | KDE Plasma | ThinkPad T440s | 4 × Intel® Core™ i7-4600U CPU @ 2.10GHz | 12 GiB RAM | Mesa Intel® HD Graphics 4400 | 1 TB SSD

User avatar
Bro.Tiag
Posts: 1924
Joined: 2007-06-02 19:14

Re: Make a Debian GNU/Linux seedbox with rtorrent and screen

#7 Post by Bro.Tiag »

Hallvor wrote:Could something have happened while copying the script? I found the script on this page (listed as one of my sources):

http://www.bytetouch.com/blog/linux/how ... on-debian/

Comparing the two scripts, I didn`t notice any differences at all, so I am quite surprised you are having problems. You could always try copying the script directly from that page to rule out any error on my part and try again. I use a fresh Lenny install myself, and it worked flawlessly on my computer. (There are also some additional tips on that page.)
Aye, definitely operator error at my end. After banging me head a few more times after making the above post I remembered a similar issue I had when utilizing a script julian67 gave me. It seems that sometimes when I cut/paste from my browser (uzbl) into vi I get additional noise or something. So what I did was re-entered all the code by hand. That seemed to do the trick. {Note to self, check for white spaces in vi before asking for help regarding someone else's script}

Anyhow, it seems to be working now and I've moved on to the Accessing your seedbox from a remote location phase. Which so far seems to be going alright. I also need to go back and strengthen what I did in the Maintaining and securing the seedbox phase. Aside from that things look good. Now if I could only get some colour in rtorrent.

Hallvor wrote:

Code: Select all

cp /usr/share/doc/rtorrent/examples.rc /home/rtorrent/.rtorrent.rc
Should be (at least on my fresh Lenny install:

Code: Select all

cp /usr/share/doc/rtorrent/examples/rtorrent.rc /home/rtorrent/.rtorrent.rc
Cheers
Sorry about that. Fixed.

Greetings
No worries, I mentioned it just so others might think to look a little bit before complaining it's not where you said it was.

Thanks again.
Cheers
ps -not sure why, but for some reason the images started showing up, they just add to the over all high quality of this How To (especially since they are the old installer).

User avatar
Hallvor
Global Moderator
Global Moderator
Posts: 2041
Joined: 2009-04-16 18:35
Location: Kristiansand, Norway
Has thanked: 149 times
Been thanked: 212 times

Re: Make a Debian GNU/Linux seedbox with rtorrent and screen

#8 Post by Hallvor »

Sounds good. You are past the major pitfalls and have got yourself a fine seedbox. :)

Thanks for helping me improve this howto!

Greetings
[HowTo] Install and configure Debian bookworm
Debian 12 | KDE Plasma | ThinkPad T440s | 4 × Intel® Core™ i7-4600U CPU @ 2.10GHz | 12 GiB RAM | Mesa Intel® HD Graphics 4400 | 1 TB SSD

User avatar
Bro.Tiag
Posts: 1924
Joined: 2007-06-02 19:14

Re: Make a Debian GNU/Linux seedbox with rtorrent and screen

#9 Post by Bro.Tiag »

I'm having a couple of minor issues with my new seedbox. I'm wandering if you (on anyone else) would be willing to entertain them.

The for starters, conductibility.

If I'm logged into my seedbox computer via ssh from one computer (at home) and I then login from a second computer (say from my office) would that cause my seedbox computer to go off line.

For example, I left home this morn with my daily ride connected via ssh to my seedbox computer. Screen was running with rtorrent and several other applications also running. I got to the office and I wanted to transfer some files from home to my office. So I used gftp to logon to my seedbox, downloaded the files I wanted to my work computer and closed gftp down. Later in the morn I wanted to check some of the torrent files I had been downloading when I left home earlier. So I used putty to connect to my seedbox, no problem. I then started screen to have a look at the torrents. One was finished and one was still downloading, so I detached from screen and exited putty. At lunch time I again wanted to check on the last torrent I was downloading, but now when I try to use either putty or gftp I get an error "Network error:No route to host".

I realize that the computer could simply be off. We could also be having issues with my ISP or my home router (although if either we the case Herself or one of the bhoyos would have been on the phone to me complaining).

I'll hold off with my other queries for now.

Cheers

User avatar
Hallvor
Global Moderator
Global Moderator
Posts: 2041
Joined: 2009-04-16 18:35
Location: Kristiansand, Norway
Has thanked: 149 times
Been thanked: 212 times

Re: Make a Debian GNU/Linux seedbox with rtorrent and screen

#10 Post by Hallvor »

"If I'm logged into my seedbox computer via ssh from one computer (at home) and I then login from a second computer (say from my office) would that cause my seedbox computer to go off line."
I don`t think that logging in from a second computer would cause the seedbox to go offline. I have connected from two different computers in my LAN, and also from outside the LAN without any issues. But I haven`t tried establishing two simultaneous SSH sessions.
"At lunch time I again wanted to check on the last torrent I was downloading, but now when I try to use either putty or gftp I get an error "Network error:No route to host."
It could be off, you could be banned in IPtables because of failed (SSH) password attempts, and it could be that the IP has changed and that the seedbox hasn`t yet notified the DNS of the change in IP address. (My seedbox notifies the DNS every 30 minutes, so in theory I could get an error for 30 minutes if the IP address changes a second after the DNS receives the IP.)

What happens if you ping it?
[HowTo] Install and configure Debian bookworm
Debian 12 | KDE Plasma | ThinkPad T440s | 4 × Intel® Core™ i7-4600U CPU @ 2.10GHz | 12 GiB RAM | Mesa Intel® HD Graphics 4400 | 1 TB SSD

User avatar
Bro.Tiag
Posts: 1924
Joined: 2007-06-02 19:14

Re: Make a Debian GNU/Linux seedbox with rtorrent and screen

#11 Post by Bro.Tiag »

Well of course I'm at the office right now, and it seems to be online. Anyhow when I ping it from my windows computer at work I get the following;

Code: Select all

C:\>ping -n 3 98.114.178.205

Pinging 98.114.178.205 with 32 bytes of data:

Reply from 98.114.178.205: bytes=32 time=37ms TTL=47
Reply from 98.114.178.205: bytes=32 time=19ms TTL=47
Reply from 98.114.178.205: bytes=32 time=31ms TTL=47

Ping statistics for 98.114.178.205:
    Packets: Sent = 3, Received = 3, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 19ms, Maximum = 37ms, Average = 29ms

C:\>

User avatar
Bro.Tiag
Posts: 1924
Joined: 2007-06-02 19:14

Re: Make a Debian GNU/Linux seedbox with rtorrent and screen

#12 Post by Bro.Tiag »

Hallvor wrote:It could be off, you could be banned in IPtables because of failed (SSH) password attempts, and it could be that the IP has changed and that the seedbox hasn`t yet notified the DNS of the change in IP address. (My seedbox notifies the DNS every 30 minutes, so in theory I could get an error for 30 minutes if the IP address changes a second after the DNS receives the IP.)
While I am apt to miss type my passwd from time to time, on my work computer I set my username & passwd in putty & gftp for testing reasons. Besides, I usually get the error when trying to connect the first time (some time after a previous session).

It also appears that my IP has not changed since I set things up, since that is what I pinged in stead of the hostname I set up. I used my IP because I had though of your suggestion of falling through the crack.

Something I did notice, that I find strange, and most likely is part of my issue, is that to re-open port 22 on my seed box, I plug in a mouse to the ps/2 port and that lets me connect again.

I know this is being caused by operator error, because I just can't leave well enough alone. For example I did deviate from your How To by adding gpm (because I'm such a bad typist & speller) at the very start. I've also upgraded to squeeze, added htop, mc, links2 & ncdu.

Cheers

User avatar
Hallvor
Global Moderator
Global Moderator
Posts: 2041
Joined: 2009-04-16 18:35
Location: Kristiansand, Norway
Has thanked: 149 times
Been thanked: 212 times

Re: Make a Debian GNU/Linux seedbox with rtorrent and screen

#13 Post by Hallvor »

To rule out any problems with fail2ban you could try

Code: Select all

/etc/init.d/fail2ban stop
and see if the problem persists.

And the port 22 issue with the mouse sounds very strange indeed.

I`m afraid I don`t know what more to suggest.
[HowTo] Install and configure Debian bookworm
Debian 12 | KDE Plasma | ThinkPad T440s | 4 × Intel® Core™ i7-4600U CPU @ 2.10GHz | 12 GiB RAM | Mesa Intel® HD Graphics 4400 | 1 TB SSD

User avatar
Bro.Tiag
Posts: 1924
Joined: 2007-06-02 19:14

Re: Make a Debian GNU/Linux seedbox with rtorrent and screen

#14 Post by Bro.Tiag »

Hallvor wrote:To rule out any problems with fail2ban you could try

Code: Select all

/etc/init.d/fail2ban stop
and see if the problem persists.

And the port 22 issue with the mouse sounds very strange indeed.

I`m afraid I don`t know what more to suggest.
I'll give stopping fail2ban a try. I think I may even remove gpm since I don't need it in a headless box and can cut/paste in a terminal already. You've been helpful, so thanks again. I'll keep you posted.

Cheers

User avatar
Bro.Tiag
Posts: 1924
Joined: 2007-06-02 19:14

Re: Make a Debian GNU/Linux seedbox with rtorrent and screen

#15 Post by Bro.Tiag »

Here is an update (although I'm hesitant to post it).

I tryed "/etc/init.d/fail2ban stop", no affect. So I removed gpm. My seedbox stayed connected for 'bout 18 hours. Sometime in the early morning hours it went off line. Granted I had not rebooted after removing gpm, so I'm hoping a reboot will finally fix things. Anyhow, it's been back on-line for seven hours now.

Cheers

User avatar
Hallvor
Global Moderator
Global Moderator
Posts: 2041
Joined: 2009-04-16 18:35
Location: Kristiansand, Norway
Has thanked: 149 times
Been thanked: 212 times

Re: Make a Debian GNU/Linux seedbox with rtorrent and screen

#16 Post by Hallvor »

Bro.Tiag wrote:Here is an update (although I'm hesitant to post it).

I tryed "/etc/init.d/fail2ban stop", no affect. So I removed gpm. My seedbox stayed connected for 'bout 18 hours. Sometime in the early morning hours it went off line. Granted I had not rebooted after removing gpm, so I'm hoping a reboot will finally fix things. Anyhow, it's been back on-line for seven hours now.

Cheers
Hope it works out for you. Keep me posted of your progress. I see it is online now, as I just pinged it.

Code: Select all

hallvor@debian:~$ ping -c 3 98.114.178.xxx
PING 98.114.178.xxx (98.114.178.xxx) 56(84) bytes of data.
64 bytes from 98.114.178.xxx: icmp_seq=1 ttl=47 time=147 ms
64 bytes from 98.114.178.xxx: icmp_seq=2 ttl=47 time=149 ms
64 bytes from 98.114.178.xxx: icmp_seq=3 ttl=47 time=148 ms

--- 98.114.178.xxx ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2010ms
rtt min/avg/max/mdev = 147.329/148.326/149.027/0.789 ms
hallvor@debian:~$
Not bad across the Atlantic.
[HowTo] Install and configure Debian bookworm
Debian 12 | KDE Plasma | ThinkPad T440s | 4 × Intel® Core™ i7-4600U CPU @ 2.10GHz | 12 GiB RAM | Mesa Intel® HD Graphics 4400 | 1 TB SSD

ClayD
Posts: 5
Joined: 2010-10-10 16:51

Re: Make a Debian GNU/Linux seedbox with rtorrent and screen

#17 Post by ClayD »

Hey, I'm having a bit of trouble with the copying of the rtorrent config.

Code: Select all

Now log in as user

Code: Select all
    su – rtorrent



Type in the user password and press enter

Now copy the rtorrent config file to the home directory:

Code: Select all
    cp /usr/share/doc/rtorrent/examples/.rtorrent.rc /home/rtorrent/.rtorrent.rc
When I do the last step, I get the error:

Code: Select all

cp: cannot stat `/usr/share/doc/rtorrent/examples/.rtorrent.rc': No such file or directory
My username is clay instead of rtorrent, so I changed the second part to /home/clay/, but it won't work for me. Also, another curious thing is that when I log in as the user "su - clay" I'm not asked for a password.

Any ideas?

Thanks

User avatar
Hallvor
Global Moderator
Global Moderator
Posts: 2041
Joined: 2009-04-16 18:35
Location: Kristiansand, Norway
Has thanked: 149 times
Been thanked: 212 times

Re: Make a Debian GNU/Linux seedbox with rtorrent and screen

#18 Post by Hallvor »

Hi!

Sorry, this is my mistake. The file is called rtorrent.rc, not .rtorrent.rc:

Code: Select all

seedbox:~# cd /usr/share/doc/rtorrent/examples
seedbox:/usr/share/doc/rtorrent/examples# ls
rtorrent.rc
The correct command should be:

Code: Select all

cp /usr/share/doc/rtorrent/examples/rtorrent.rc /home/rtorrent/.rtorrent.rc
(replacing /home/rtorrent with /home/clay is unproblematic if you don't copy my config file without editing it and make the correct directories).

I don't know why you are not asked for a user password, but it makes sense since you are already logged in as root. I get the same:

Code: Select all

seedbox:/usr/share/doc/rtorrent/examples# su - rtorrent
rtorrent@seedbox:~$ 
[HowTo] Install and configure Debian bookworm
Debian 12 | KDE Plasma | ThinkPad T440s | 4 × Intel® Core™ i7-4600U CPU @ 2.10GHz | 12 GiB RAM | Mesa Intel® HD Graphics 4400 | 1 TB SSD

ClayD
Posts: 5
Joined: 2010-10-10 16:51

Re: Make a Debian GNU/Linux seedbox with rtorrent and screen

#19 Post by ClayD »

That fixed that problem, then I could change the config and such. That worked out fine, but now I have a problem with:

Code: Select all

Start rtorrent as a daemon and use the new config file

Code: Select all
    /etc/init.d/rtorrent start
When I do that, I get:

Code: Select all

seedbox:~# /etc/init.d/rtorrent start
Starting rtorrent...
Unknown id: rtorrent
And nothing else happens. It goes back to the seedbox prompt. Any ideas on this one?

Thanks again

User avatar
Hallvor
Global Moderator
Global Moderator
Posts: 2041
Joined: 2009-04-16 18:35
Location: Kristiansand, Norway
Has thanked: 149 times
Been thanked: 212 times

Re: Make a Debian GNU/Linux seedbox with rtorrent and screen

#20 Post by Hallvor »

Looks like it is caused by your decision to use clay as your user name instead of rtorrent. You need to edit the init file and replace user rtorrent with user clay to make it work.
[HowTo] Install and configure Debian bookworm
Debian 12 | KDE Plasma | ThinkPad T440s | 4 × Intel® Core™ i7-4600U CPU @ 2.10GHz | 12 GiB RAM | Mesa Intel® HD Graphics 4400 | 1 TB SSD

Post Reply