Install SABnzbd from Source on CentOS 6

It's been a while since I've posted anything, and since I'm moving my Usenet applications to Linux I figured I could make a How-To post out of it. CentOS is still my Linux distro of choice, and the current minor release is 6.5 so that's what I'll be using. Just for informational purposes, I am install CentOS 6.5 in a Hyper-V VM, running Windows Server 2012 R2 on my Dell C1100 (dual Intel Xeon L5520 CPUs, 48GB of RAM, Tiered Storage Space with a 120GB SSD and a 2TB 7200RPM drive for storage). CentOS (along with RHEL) are now shipping the Hyper-V drivers in the kernel, which makes using it on Hyper-V a breeze. I've got a base install (using the text installer), and am not running a desktop interface. The VM I'm using has the following specs:

10GB is not much space to use for Usenet downloading but will be plenty fo the OS, Swap, and the Applications we are about to install. For the download directories, I will have a 150GB volume attached via iSCSI (I will not be covering the use of iSCSI in this post, nor will I elaborate how I have it mounted — all you need to know is I have it mounted as /usenet). I will be doing this install as root, and running the applications as root. Also note that for this demo I have selinux and iptables disabled, which is not recommended, but is outside of this post. So let's get to it!

Repositories

EPEL & Remi Repos
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm 
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm 
rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
yum -y update
SABnzbd Repo
vi /etc/yum.repos.d/SABnzbd.repo

And add this to SABnzbd.repo:

[SABnzbd]
name=SABnzbd for RHEL 6 and clones - $basearch - Base
baseurl=https://dl.dropboxusercontent.com/u/14500830/SABnzbd/RHEL-CentOS/6/
failovermethod=priority
enabled=1
gpgcheck=0
[rpmfusion-nonfree-updates-testing]
name=RPM Fusion for EL 6 - Nonfree - Test Updates
baseurl=http://download1.rpmfusion.org/nonfree/el/updates/testing/6/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-nonfree-el-6

Pre-requisites

yum -y install git python-configobj python-feedparser pyOpenSSL python-yenc python-setuptools par2cmdline
wget http://pkgs.repoforge.org/unrar/unrar-4.2.3-1.el6.rf.x86_64.rpm && rpm -Uvh unrar-4.2.3-1.el6.rf.x86_64.rpm
wget http://pypi.python.org/packages/source/C/Cheetah/Cheetah-2.4.4.tar.gz --no-check-certificate && tar -zxvf Cheetah-2.4.4.tar.gz && cd Cheetah-2.4.4 && python setup.py install

That's all of our pre-requisites! Now let's get started with installing SABnzbd.

SABnzbd

mkdir /apps && mkdir /apps/data && cd /apps
git clone git://github.com/sabnzbd/sabnzbd.git SABnzbd
mkdir /apps/data/.sabnzbd
cd SABnzbd

We now have the latest version of SABnzbd copied to our server, so now we create our init script.

vi /etc/init.d/SABnzbd

and add this to SABnzbd:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/sh
#
### BEGIN INIT INFO
# Provides:          SABnzbd
# Required-Start:    $all
# Required-Stop:     $all
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts SABnzbd
# Description:       starts SABnzbd
### END INIT INFO

# Source function library.
. /etc/init.d/functions

## Variables
prog=SABnzbd
lockfile=/var/lock/subsys/$prog
homedir=/apps/SABnzbd
configfile=/apps/data/.sabnzbd/sabnzbd.ini
pid=/var/run
pidfile=/var/run/sabnzbd*.pid
nice=
##

options=" --daemon --pid $pid --config-file $configfile -s 0.0.0.0"

start() {
        # Start daemon.
        echo -n $"Starting $prog: "
        daemon $nice python $homedir/SABnzbd.py $options
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch $lockfile
        return $RETVAL
}

stop() {
        echo -n $"Shutting down $prog: "
        killproc -p $pidfile python
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && rm -f $lockfile
        return $RETVAL
}

# See how we were called.
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  status)
        status $prog
        ;;
  restart|force-reload)
        stop
        start
        ;;
  try-restart|condrestart)
        if status $prog > /dev/null; then
            stop
            start
        fi
        ;;
  reload)
        exit 3
        ;;
  *)
        echo $"Usage: $0 {start|stop|status|restart|try-restart|force-reload}"
        exit 2
esac

All that's left is a little cleanup, and setting SABnzbd to start at boot. To do this, do the following:

chmod 755 /etc/init.d/SABnzbd
chkconfig SABnzbd on
/etc/init.d/SABnzbd start
rm -rf /root/*.rpm
rm -rf /root/Cheetah*

And that's it! You now have a fully installed and working SABnzbd server! To log in, browse to http://0.0.0.0:8080 (0.0.0.0 is the IP, or DNS name, of your SABnzbd server) and complete the simple wizard.

I hope you've enjoyed my walkthrough, and feel free to check out Part 2 of my Usenet guides which is a how-to for installing SickBeard.


Related Posts


Share on: Twitter | Facebook | Google+ | Email


comments powered by Disqus