Skip to content

Instantly share code, notes, and snippets.

@franga2000
Created August 26, 2015 19:17
Show Gist options
  • Save franga2000/856f45ca918b3d708ce0 to your computer and use it in GitHub Desktop.
Save franga2000/856f45ca918b3d708ce0 to your computer and use it in GitHub Desktop.
Ultimate home server

Ultimate home server 2015

#Setup services It's best to run these commands in a folder you can later delete, since some of them generate temporary files. ##Samba Firts, you have to open the following ports:

  • netbios-ns - 137/tcp
  • netbios-dgm - 138/tcp
  • netbios-ssn - 139/tcp
  • microsoft-ds - 445/tcp

##ownCloud

# Add ownCloud repo and key
sudo sh -c "echo 'deb http://download.opensuse.org/repositories/isv:/ownCloud:/community/xUbuntu_14.04/ /' >> /etc/apt/sources.list.d/owncloud.list"
wget http://download.opensuse.org/repositories/isv:ownCloud:community/xUbuntu_12.04/Release.key
sudo apt-key add - < Release.key
sudo apt-get update
# Install ownCloud
sudo apt-get install owncloud

##Emby

##Sonarr

nzbdrone and Sonarr are the same thing!

# Add Sonarr repo and key
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys FDA5DFFC
echo "deb http://apt.sonarr.tv/ master main" | sudo tee /etc/apt/sources.list.d/sonarr.list
sudo apt-get update
# Install Sonarr
sudo apt-get install nzbdrone
# Create user
useradd -m -d /var/lib/nzbdrone --gid nogroup nzbdrone

Create a new file at /etc/init.d/nzbdrone and paste this in:

#! /bin/sh
### BEGIN INIT INFO
# Provides:          NzbDrone
# 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 instance of Sonarr
# Description:       starts instance of Sonarr using start-stop-daemon
### END INIT INFO

############### EDIT ME ##################
# path to app
APP_PATH=/opt/NzbDrone

# user
RUN_AS=nzbdrone

# path to mono bin
DAEMON=/usr/bin/mono

# options for mono
DAEMON_OPTS=""

# Path to store PID file
PID_PATH=/var/run/nzbdrone
############### END EDIT ME ##################
mkdir -p ${PID_PATH}
PID_FILE=${PID_PATH}/nzbdrone.pid
EXENAME=`basename ${APP_PATH}/NzbDrone.exe`
DESC=`basename ${APP_PATH}/NzbDrone.exe .exe`
NZBDRONE_PID=`ps auxf | grep $EXENAME | grep -v grep | awk '{print $2}'`

test -x $DAEMON || { echo "$DAEMON must be executable."; exit 1; }

set -e

echo $NZBDRONE_PID > $PID_FILE

case "$1" in
start)
    if [ -z "${NZBDRONE_PID}" ]; then
        echo "Starting $DESC"
        rm ${PID_FILE} || return 1
        install -d --mode=0755 -o $RUN_AS $PID_PATH || return 1
        start-stop-daemon -d $APP_PATH -c $RUN_AS --start --background --pidfile $PID_FILE --exec $DAEMON -- $DAEMON_OPTS $EXENAME
    else
        echo "${DESC} already running."
    fi
    ;;
stop)
    echo "Stopping $DESC"
    echo $NZBDRONE_PID > $PID_FILE
    start-stop-daemon --stop --pidfile $PID_FILE --retry 15
    ;;

restart|force-reload)
    echo "Restarting $DESC"
    start-stop-daemon --stop --pidfile $PID_FILE --retry 15
    start-stop-daemon -d $APP_PATH -c $RUN_AS --start --background --pidfile $PID_FILE --exec $DAEMON -- $DAEMON_OPTS $EXENAME
    ;;
*)
     echo "Usage: `basename $0` {start|stop|restart|force-reload}" >&2    
     exit 1
    ;;   

esac

exit 0

Then, run these commands:

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

Follow the official guide on how to set it up as a service.

#Deluge

sudo add-apt-repository ppa:deluge-team/ppa
sudo apt-get update
sudo apt-get install deluge

...

#CouchPotao /opt/couchpotato !!!!

sudo apt-get install git-core python
sudo git clone git://github.com/RuudBurger/CouchPotatoServer.git /opt/couchpotato
sudo ln -s /opt/couchpotato/init/ubuntu.default /etc/default/couchpotato
sudo chmod +x /etc/default/couchpotato

#Headphones

cd /opt
git clone https://github.com/rembo10/headphones.git
cd headphones
sudo chmod +x /opt/headphones/init-scripts/init.ubuntu
sudo ln -s /opt/headphones/init-scripts/init.ubuntu /etc/init.d/headphones
sudo update-rc.d headphones defaults
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment