Skip to content

Installation instructions

chros73 edited this page Oct 7, 2018 · 12 revisions

Installation instructions

Contents

Requirements

Hardware

Fortunately rtorrent is very lightweight so you don't need any special hardware for it. The minimal suggested config is:

  • dual-core CPU, 2-4 GB RAM, large HDD

OS

Although probably all Linux based OS would work, but a Debian based one (Debian/Ubuntu) is suggested with bash v4.x (some of the shell scripts use features of it). These instructions assume it.

What will not work with the extended-canvas of rTorrent-PS-CH is an OS without proper locale support, like OpenWRT.

Installation

Let's see the hard part :) These instructions will work on a freshly installed minimal OS as well.

Core of the setup ^^^^^^^^

Please refer Debian Install From Source - The Easy Way to get rTorrent-PS-CH and pyrocore utilities up and running in tmux in 20 minutes.

This will also take care of the major dependencies.

Getting this project in hand ^^^^^^^^

This should be used under your normal user account.

mkdir -p ~/src/; cd ~/src/
git clone https://github.com/chros73/rtorrent-ps-ch_setup.git

Additional stuff ^^^^^^^^

These steps must be performed by the root user (i.e. in a root shell, or by writing sudo before the actual command).

If we missed something """""""""

Install more packages we need:

apt-get install sudo coreutils ssmtp dnsutils iproute2 dialog aria2
  • sudo is used during queue management
  • ssmtp is used for email reporting
  • dig (requires dnsutils) is used for getting public IP address
  • ip (requires iproute2) is used for setting IP address of an interface to bind to
  • dialog and aria2 are used for handling magnet links easily

Location of HDD """""""""

Make sure that you use a file system that supports fallocate like btrfs, ext4, ocfs2, xfs. (Read more: Disk allocation)

This setup assumes that a symlink called Torrents are created in /mnt directory that actually points to the main Torrents directory of the mounted HDD in /media/chros73/wdred. You can create such a symlink like this:

ln -s /media/chros73/wdred/Torrents /mnt/Torrents

SSH server """""""""

You can install openssh-server by:

apt-get install openssh-server openssh-client

You also want to enable SSH key authentication to automate login process via SSH without the need of a password. This has to be done under your regular user account.

Here is an example config, modify the AllowUsers directive in it, along with instructions how to connect to it from Windows and Android devices.

Samba server """""""""

If you need Samba file sharing server on your local network then you can install it by:

apt-get install samba

Here are some explained options for the example config, along with instructions how to connect to it from Windows and Android devices.

FTP server """""""""

You can install e.g. proftpd by:

apt-get install proftpd openssl

Here are example configs, along with instructions how to connect to it from Windows and Android devices.

Here is how to generate a server certificate to be able to use TLS with it.

You also need the modified init script for it to prevent being killed by logrotate on Ubuntu 14.04 (read more).

Raising open file limit for a user """""""""

In order to be able to raise the default 1024 open file limit for a user, these lines has to be added into their corresponding files:

SSMTP

To be able to receive email reports to your gmail account all you need is this simple config file, modify the following directives in it: root, AuthUser, AuthPass.

Other system tweaks """""""""

You can also apply some other system tweaks with the help of sysctl.conf file.

rTorrent related stuff ^^^^^^^^

Finally we arrived to the part that actually interests us.

init script """""""""

You need root for this as well. Assuming rTorrent-PS-CH was installed into system way, place the init script into /etc/init.d/ and edit the user, sessiondir variables at the beginning of it. You can install and enable it on Ubuntu by running:

update-rc.d rtorrent defaults 92
update-rc.d rtorrent enable

In order to be able to use status and start functionality of it from a script, /etc/sudoers file has to be modified as well. You have to edit the username in 2 places.

Directory structure """""""""

We can switch to a normal user account now.

Copy the given directory structure into the above created /mnt/Torrents directory. That will setup all the needed categories as well.

We have to delete all the unnecessary .gitignore files from them with:

find "/mnt/Torrents/" -type f -iname .gitignore -delete

Additional files """""""""

Copy all the directories/files from the given home directory into yours ~/. Check the content of yours if some files wanted to be overwritten.

You have to check the variables at the beginning of the following:

Finally, you only have to modify 1 rtorrent config file:

Start rTorrent-PS-CH """""""""

Finally, you can try to start rTorrent-PS-CH with sudo (it shouldn't ask for password):

sudo /etc/init.d/rtorrent start

It should be started in tmux in the 3rd window. You can attach to that tmux session, as it will automatically happen when you log in via SSH (with the help of ~/.profile), with:

tmux -2u new-session -A -s rtorrent

Run scripts from cron """""""""

You need root for this. If all went well, copy the example cron file into /etc/cron.d directory. Modify the filename, HOME variable, and existing usernames in it to your username.

Reboot

If everything seems to work then reboot the OS: rTorrent-PS-CH should be automatically started in tmux and you can manually or will be automatically attach to that session.

Backup your system ^^^^^^

Don't forget, more precisely, don't be lazy to create a full system backup!

You can create a similar script as doBackup.sh, take a look at e.g. this article that may give you good advise what to backup.

One day you will be grateful for the effort you're doing now. :)

Summary

It was a piece of cake, wasn't it? :) Enjoy your new Tamagotchi!