Install SABNZBD + Transmission + Sickbeard + Couchpotato on Ubuntu 12.04 & 12.10

INSTALLING TRANSMISSION ON UBUNTU SERVER 12.04 LTS / 12.10
Please be aware there a issues with Transmission in Ubuntu 13.04 and higher!

The Transmission bittorrent client is one of the most widely used bittorrent clients for the Linux operating system, especially on Ubuntu servers. I have used it in all of the server incarnations I’ve had installed and have loved it more and more with each little update the software gets. In this guide, I’ll show you the super simple steps at getting a fully functional Transmission client installed on your Ubuntu Server and how you can configure it for your specific needs.

First off, we will need to add the apt-repository for Transmission to our repository list, but before we do that, we’ll need to install a small little application that allows us to add apt repositories directly from the terminal. Type the following:

sudo apt-get install python-software-properties

In Ubuntu 12.10, use the following command:

sudo aptitude install software-properties-common

Now, issue this command:

sudo add-apt-repository ppa:transmissionbt/ppa

That will give you the Transmission apt repository and allow you to automatically keep your Transmission software up-to-date instead of having to build the application by source. Now, update your apt-list:

sudo apt-get update

After your list is up to date, issue this command to install Transmission:

sudo apt-get install transmission-cli transmission-common transmission-daemon

Now, what we need to do is create some folders in our home folder for Transmission to use. Issue the following commands:

mkdir ~/Downloads
mkdir ~/Downloads/Completed
mkdir ~/Downloads/Incomplete
mkdir ~/Downloads/Torrents

The Completed folder will hold all of our torrents that have finished downloading, the Incomplete folder will hold all of our torrents that are still downloading, and the Torrents folder will allow us to drag-and-drop torrent files from our Windows machine to the folder and have Transmission automatically pick up the torrent and begin downloading it. You can add torrents for Transmission to download through the web interface, but doing it this way is sometimes quicker for some folks who may not have browser access.

Now, when Transmission downloads torrents, it automatically sets the rights of the files that it downloads to the Transmission user group. We need to make sure that our username is a part of that group, and we need to set the correct permissions on the Downloads folders. Issue the following commands:

sudo usermod -a -G debian-transmission username
sudo chown -R debian-transmission:debian-transmission /home/username/Downloads
sudo chmod -R 775 /home/username/Downloads

Replace the bold “username” sections with the username of your Ubuntu user that will be accessing the files and folders.

Note: If you want to use the same folders for both transmission and SABNZBD use the following command:

sudo chown -R <user>:debian-transmission /home/username/Downloads

Alright, so, that’s all the deep configuration and installation we need to do. Now, all we have to do is edit the Transmission configuration file so that we can access the WebUI and tweak a couple more settings. Again, I’m using Nano as my text editor, so if you are too, issue the following command:

sudo nano /etc/transmission-daemon/settings.json

That’s going to bring up the big configuration file. I’m only going to give you the settings I tweaked, however you can have a look throughout the entire configuration and tweak whatever you’d like.

“download-dir”: “/home/username/Downloads/Complete”,
“incomplete-dir”: “/home/username/Downloads/Incomplete”,
“incomplete-dir-enabled”: true,
“rpc-authentication-required”: false,
“rpc-whitelist-enabled”: false,

Once you’ve tweaked those settings, add this to the very end of the configuration file (before the ending “}” bracket, but also keep in mind that you will need to change the “utp-enabled” line to have a comma “,” at the end of it):

“watch-dir”: “/home/username/Downloads/Torrents”,
“watch-dir-enabled”: true 

That should do it! Now all you need to do is save that file by issuing a CTRL+X to Nano and then saving when it prompts you. After you’ve saved the file, reload (DO NOT restart) your Transmission server:

sudo /etc/init.d/transmission-daemon reload

Once it has reloaded and if it starts back up, go ahead and go to your browser and navigate to: 0.0.0.0:9091 (where 0.0.0.0 is the IP address of your Ubuntu server). You should be greeted with the Transmission WebUI. Now if you’d like, you can apply over 370,000 IP filters to the blocklist from one of my other posts.

Installing SABnzbd
First lets organize our folders. TV Shows and Movies refers to the location of your TV Shows and movies. For me it is in the Media folder.

$ cd ~
$ sudo mkdir /mnt/mass_storage downloads
$ ln -s /mnt/mass_storage/downloads downloads
$ ln -s /mnt/Media/TV Shows TVShows
$ ln -s /mnt/Media/Movies Movies
This puts shortcuts to the folders in our home folder.

Now to install SABnzbd. You can install from apt-get, but the version in there is out of date. Instead lets add another repo to pull from, then install it from apt.

$ echo "deb http://ppa.launchpad.net/jcfp/ppa/ubuntu $(lsb_release -c -s) main" | sudo tee -a /etc/apt/sources.list && sudo apt-key adv --keyserver hkp://pool.sks-keyservers.net:11371 --recv-keys 0x98703123E0F52B2BE16D586EF13930B14BB9F05F

$ sudo apt-get update
$ sudo apt-get install sabnzbdplus
$ sudo nano /etc/default/sabnzbdplus

Enter your username where it says USER=

Now you can reboot if you want to test that it automatically starts.

You may not be able to access the web interface the first time because it defaults to only allow access from the localhost. Here is how to fix it:

$ cd ~/.sabnzbd
$ nano sabnzbd.ini

Search for host (use CTRL+W to search). Change localhost to 0.0.0.0. Exit and restart sabnzbd.

$ /etc/init.d/sabnzbd restart

Note: DO NOT USE SUDO TO START ANY OF THESE SERVICES! Only start these services as the local user.

Installing SickBeard
We will install SickBeard and CouchPotato with git. First make sure it is installed.

$ sudo apt-get install git

Now lets download the source code.

$ cd ~
$ mkdir tmp
$ cd tmp
$ git clone https://github.com/midgetspy/Sick-Beard.git sickbeard

When it is finished it should look like this:

ryan@services:~/tmp$ git clone https://github.com/midgetspy/Sick-Beard.git sickbeard
Cloning into 'sickbeard'...
remote: Counting objects: 20879, done.
remote: Compressing objects: 100% (6847/6847), done.
remote: Total 20879 (delta 14226), reused 19584 (delta 13111)
Receiving objects: 100% (20879/20879), 7.73 MiB | 859 KiB/s, done.
Resolving deltas: 100% (14226/14226), done.

You can put it in your home folder if you want (mv sickbeard ../.sickbeard) which is where most people put it, but I like to put it in my /usr/share folder. Just remember where you put it.

Now we need to make it start on boot. This startup script and the one for CouchPotato are by daemox over at ainer.org.

$ sudo nano /etc/init.d/sickbeard

Enter the following code in the file:

#! /bin/sh
 
# Author: daemox
# Basis: Parts of the script based on and inspired by work from
#        tret (sabnzbd.org), beckstown (xbmc.org),
#        and midgetspy (sickbeard.com).
# Fixes: Alek (ainer.org), James (ainer.org), Tophicles (ainer.org),
#        croontje (sickbeard.com)
# Contact: http://www.ainer.org
# Version: 3.1
 
### BEGIN INIT INFO
# Provides:          sickbeard
# Required-Start:    $local_fs $network $remote_fs
# Required-Stop:     $local_fs $network $remote_fs
# Should-Start:      $NetworkManager
# Should-Stop:       $NetworkManager
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts and stops sick beard
# Description:       Sick Beard is an Usenet PVR. For more information see:
#            http://www.sickbeard.com
### END INIT INFO
 
#Required -- Must Be Changed!
USER="CHANGEME" #Set Linux Mint, Ubuntu, or Debian user name here.
 
#Required -- Defaults Provided (only change if you know you need to).
HOST="127.0.0.1" #Set Sick Beard address here.
PORT="8081" #Set Sick Beard port here.
 
#Optional -- Unneeded unless you have added a user name and password to Sick Beard.
SBUSR="" #Set Sick Beard user name (if you use one) here.
SBPWD="" #Set Sick Beard password (if you use one) here.
 
#Script -- No changes needed below.
case "$1" in
start)
#Start Sick Beard and send all messages to /dev/null.
cd /home/$USER/.sickbeard
echo "Starting Sick Beard"
sudo -u $USER -EH nohup python /home/$USER/.sickbeard/SickBeard.py -q > /dev/null 2>&1 &
;;
stop)
#Shutdown Sick Beard and delete the index.html files that wget generates.
echo "Stopping Sick Beard"
wget -q --user=$SBUSR --password=$SBPWD "http://$HOST:$PORT/home/shutdown/" --delete-after
sleep 6s
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
esac
 
exit 0

Change USER=”ChangeMe” to your username.

Make the file executable so it will actually run.

$ sudo chmod +x /etc/init.d/sickbeard
sudo update-rc.d sickbeard defaults

To start:

/etc/init.d/sickbeard start

or reboot

 sudo reboot

Installing CouchPotato

We are going to install from the source on GitHub and create an autorun.

cd ~/tmp
$ git clone https://github.com/RuudBurger/CouchPotatoServer.git
$ mv couchpotato ../.couchpotato
$ cd ~/.couchpotato
$ python CouchPotato.py to start
$ sudo cp CouchPotatoServer/init/ubuntu /etc/init.d/couchpotato
$ sudo nano /etc/init.d/couchpotato

Now make the auto run file.

$ sudo nano /etc/init.d/couchpotato

Change the path of couchpotato to:
/home/<your_username>/.couchpotato
Again, change USER=”ChangeMe” to your username.

Make the file executable.

$ sudo chmod +x /etc/init.d/couchpotato
$ sudo update-rc.d couchpotato defaults

Open your browser and go to: http://localhost:5050/

Sources:

 

 

SSH on Ubuntu 12.04

Very basic setup of SSH for Ubuntu

The ssh config file can by altered by the following command:

nano /etc/ssh/sshd_config

Change the port to something else than the standard 22.
Also change PermitRootLogin yes to no

After that allow the port number in the firewall

ufw allow  

Reload the networking interface to make sure ssh is loaded:

/etc/init.d/networking restart
 * Running /etc/init.d/networking restart is deprecated because it may not enable again some interfaces
 * Reconfiguring network interfaces...                                            ssh stop/waiting
ssh start/running, process 28730
net.ipv6.conf.eth0.accept_ra = 1
net.ipv6.conf.eth0.autoconf = 1
ssh stop/waiting
ssh start/running, process 28781
                                                                           [ OK ]

Static IP in Ubuntu 12.04 LTS

Setting up a static ip the easy way (via command line)

nano /etc/network/interfaces 
# 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 eth0
iface eth0 inet static
address 192.168.1.106
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1

dns-nameservers 192.168.1.1 8.8.8.8
/etc/init.d/networking restart

use the following command to check if the settings are correct:

ifconfig
eth0      Link encap:Ethernet  HWaddr 00:15:5d:02:64:08
          inet addr:192.168.1.106  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: 2001:980:1863:1:6c77:fd0e:4bc3:2ab0/64 Scope:Global
          inet6 addr: 2001:980:1863:1:215:5dff:fe02:6408/64 Scope:Global
          inet6 addr: fe80::215:5dff:fe02:6408/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:54401083 errors:0 dropped:36 overruns:0 frame:0
          TX packets:7607057 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:79228405238 (79.2 GB)  TX bytes:1349591196 (1.3 GB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:2586 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2586 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:198646 (198.6 KB)  TX bytes:198646 (198.6 KB)

Please note: Change the numbers to your own ip range.

WebDAV on Ubuntu 12.04 LTS x64 (for xbmc)

For you people who are interested in setting up webdav but having difficulties doing it. I have made a guide beneath which covers all the steps in setting it up.

Note: Im currently still figuring how to create various users with different rights. So this will only cover a basic installation with SSL and a user with all permissions.

I’m assuming you have already installed a basic version of Ubuntu with LAMP. if not, please google for a guide which covers this.

Don’t forget to open ports 80 en 443 (http and ssl) in your firewall

ufw enable
ufw allow 80
ufw allow 443

Step 1: Creating an SSL certificate (we’ll need it later on)

The first step is to create the SSL certificate and SSL key needed by your Apache server. These will be used to secure the transmission. The SSL certificate will have a .crt extension and the SSL key a .key extension.

To create these to files, you first need to create your local authority file by shooting these commands :

 mkdir /tmp/ssl_conf
 cd /tmp/ssl_conf
 openssl req -config /etc/ssl/openssl.cnf -new -out server.csr

You will be prompted for a passphrase. Then you need to answer few questions about your server.

It is very important that you define the Common Name (CN) with your server public URL (yourserver.dyndns.org).
As your Webdav share will be accessible from Internet, the CN should be set with your public IP address or better, with your public DNS name (DynDNS for example).
If you don’t do so, your site URL and your generated certificate won’t match.

Then, you have to create the certificate and the key file with these commands :

openssl rsa -in privkey.pem -out server.key
openssl x509 -in server.csr -out server.crt -req -signkey server.key -days 3650
openssl x509 -in server.crt -out server.der.crt -outform DER

Your certificate will be valid 3650 days (10 years).

Last step is to copy these 2 files in the Apache configuration folder :

mkdir /etc/apache2/sslkey
cp server.crt /etc/apache2/sslkey
cp server.key /etc/apache2/sslkey

Step 2: Create your WebDAV folder
First install the following module for apache:

apt-get -y install libapache2-mod-encoding

I suppose that your Apache web root is the standard /var/www.

We will create the WebDav root in /var/www/webdav and make the Apache user (www-data) the owner of that directory.

All your files accessible will be located under that WebDav root.

mkdir -p /var/www/webdav
chown www-data /var/www/webdav
chmod 770 /var/www/webdav

Step 3: Configure WebDav & enable the modules

root@www:~# nano /etc/apache2/conf.d/webdav.conf
Alias /webdav /var/www/webdav

   DAV On
   SSLRequireSSL
   Options None
   AuthType Basic
   AuthName WebDAV
   AuthUserFile /etc/apache2/conf.d/.htpasswd
   
       Order allow,deny
       Allow from 10.0.0.# IP address you allow (for testing you should change this to: Allow from all)
       Require valid-user
   

Next we will create the WebDAV password file for a test user.

For security reasons, the file should not be accessible from the webdav shared directory.
We will create it in the .htpasswd file of Apache2

root@www:~# htpasswd -c /etc/apache2/conf.d/.htpasswd pangolin 
New password: # set password
Re-type new password: # confirm
Adding password for user pangolin
root@www:~# service apache2 restart

Enabling the necessary modules:

a2enmod dav* encoding
a2enmod ssl

Step 4: Setup the SSL host

root@www:~# vi /etc/apache2/sites-available/default-ssl
# line 3: change to webmaster's email
ServerAdmin webmaster@server.world
# line 11,12: change
Options FollowSymLinks ExecCGI
AllowOverride All
# line 51,52: change
SSLCertificateFile /etc/apache2/sslkey/server.crt
SSLCertificateKeyFile /etc/apche2/sslkey/server.key
root@www:~# a2ensite default-ssl 
Enabling site default-ssl.
Run '/etc/init.d/apache2 reload' to activate new configuration!
root@www:~# a2enmod ssl 
Enabling module ssl.
See /usr/share/doc/apache2.2-common/README.Debian.gz on how to configure SSL and create self-signed certificates.
Run '/etc/init.d/apache2 restart' to activate new configuration!
root@www:~# service apache2 restart 
* Restarting web server apache2
...done.

And There you have it, a basic setup for WebDAV in ubuntu linux. For questions and suggestions please comment underneath!

Step 5: Testing

Download the DAV client from:

http://rei.to/carotdav_en.html

Resources: