Table des matières

Mettre en place une dlbox dans un container VZ:

Page non terminée - en cours de rédaction

Petit projet perso d'un serveur virtuel permettant d'automatiser quelques tâches sur les newsgroups :)

Installation de Sabnzbd

echo "deb http://ppa.launchpad.net/jcfp/ppa/ubuntu precise main" | sudo tee -a /etc/apt/sources.list && sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:11371 --recv-keys 0x98703123E0F52B2BE16D586EF13930B14BB9F05F
aptitude update ; aptitude install sabnzbdplus

Editer le fichier de configuration de daemon pour pouvoir l'activer

root@dl:~# cat /etc/default/sabnzbdplus 
# This file is sourced by /etc/init.d/sabnzbdplus
#
# When SABnzbd+ is started using the init script, the
# --daemon option is always used, and the program is
# started under the account of $USER, as set below.
#
# Each setting is marked either "required" or "optional";
# leaving any required setting unconfigured will cause
# the service to not start.

# [required] user or uid of account to run the program as:
USER=vincentp

# [optional] full path to the configuration file of your choice;
#            otherwise, the default location (in $USER's home
#            directory) is used:
CONFIG=

# [optional] hostname/ip and port number to listen on:
**HOST=192.168.32.100
PORT=9090**

# [optional] extra command line options, if any:
EXTRAOPTS=

Installation de Sickbeard

useradd --system --user-group --no-create-home sickbear
git clone git://github.com/midgetspy/Sick-Beard.git
mv Sick-Beard /usr/local/sickbeard
chown -R sickbeard:nzb /usr/local/sickbeard
chmod ug+rw /usr/local/sickbeard/autoProcessTV/
mkdir /var/sickbeard
chown sickbeard:nzb /var/sickbeard

Installation du service dans /etc/init.d/sickbeard :

#!/bin/sh
### BEGIN INIT INFO
# Provides:          SickBeard
# Required-Start:    $network $remote_fs $syslog
# Required-Stop:     $network $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start SickBeard at boot time
# Description:       Start SickBeard.
### END INIT INFO

case "$1" in
start)
  echo "Starting SickBeard."
  /usr/bin/sudo -u sickbeard -H /usr/local/sickbeard/SickBeard.py -d —datadir /var/sickbeard —config /var/sickbeard/sickbeard.ini
;;
stop)
  echo "Shutting down SickBeard."
  p=`ps aux | grep -v grep | grep SickBeard.py | tr -s \ | cut -d ’ ’ -f 2`
  if [ -n “$p” ]; then
    sb_api_key=`grep -m 1 api_key ${sb_config} | cut -d ’ ’ -f 3`;
    sb_port=`grep -m 1 web_port ${sb_config} | cut -d ’ ’ -f 3`;
    wget -q —delete-after http://localhost:${sb_port}/api/${sb_api_key}/\?cmd=sb.shutdown
    while ps -p $p > /dev/null; do sleep 1; done
  fi
;;
*)
  echo "Usage: $0 {start|stop}"
  exit 1
esac

exit 0
chmod 755 /etc/init.d/sickbeard
update-rc.d sickbeard defaults
/etc/init.d/sickbeard start

Installation de couchpatatoes

useradd --system --user-group --no-create-home couchpotato
git clone git://github.com/RuudBurger/CouchPotatoServer.git
mv CouchPotatoServer /usr/local/couchpotato
chown -R couchpotato:couchpotato /usr/local/couchpotato
mkdir /var/couchpotato
chown -R couchpotato:couchpotato /var/couchpotato

Installation du service dans /etc/init.d/couchpotato :

#!/bin/sh
### BEGIN INIT INFO
# Provides: CouchPotato
# Required-Start: $network $remote_fs $syslog
# Required-Stop: $network $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start CouchPotato at boot time
# Description: Start CouchPotato.
### END INIT INFO
case "$1" in
start)
echo "Starting CouchPotato."
/usr/bin/sudo -u couchpotato -H /usr/local/couchpotato/CouchPotato.py --daemon --data_dir=/var/couchpotato --config_file=/var/couchpotato/couchpotato.ini
;;
stop)
echo "Shutting down CouchPotato."
  p=`ps aux | grep -v grep | grep CouchPotato.py | tr -s \ | cut -d ’ ’ -f 2`
  couch_api_key=`grep -m 1 api_key /var/couchpotato/couchpotato.ini | cut -d ’ ’ -f 3`;
  couch_port=`grep -m 1 port /var/couchpotato/couchpotato.ini | cut -d ’ ’ -f 3`;
wget -q —delete-after http://localhost:${couch_port}/api/${couch_api_key}/app.shutdown
while ps -p $p > /dev/null; do sleep 1; done
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
esac
exit 0
chmod 755 /etc/init.d/couchpotato
update-rc.d couchpotato defaults
/etc/init.d/couchpotato start

Installation de Headphone

useradd --system --user-group --no-create-home headphones
git clone git://github.com/rembo10/headphones.git
mv headphones /usr/local/headphones
chown -R headphones:headphones /usr/local/headphones
chmod ug+x /usr/local/headphones/Headphones.py
mkdir /var/headphones
chown -R headphones:headphones /var/headphones

Installation du service dans /etc/init.d/heaphones :

#!/bin/sh
#
## Don't edit this file
## Edit user configuation in /etc/default/headphones to change
##
## Make sure init script is executable
## sudo chmod +x /opt/headphones/init.ubuntu
##
## Install the init script
## sudo ln -s /opt/headphones/init.ubuntu /etc/init.d/headphones
##
## Create the headphones daemon user:
## sudo adduser --system --no-create-home headphones
##
## Make sure /opt/headphones is owned by the headphones user
## sudo chown headphones:nogroup -R /opt/headphones
##
## Touch the default file to stop the warning message when starting
## sudo touch /etc/default/headphones
##
## To start Headphones automatically
## sudo  update-rc.d headphones defaults
##
## To start/stop/restart Headphones
## sudo service headphones start
## sudo service headphones stop
## sudo service headphones restart
##
## HP_USER=         #$RUN_AS, username to run headphones under, the default is headphones
## HP_HOME=         #$APP_PATH, the location of Headphones.py, the default is /opt/headphones
## HP_DATA=         #$DATA_DIR, the location of headphones.db, cache, logs, the default is /opt/headphones
## HP_PIDFILE=      #$PID_FILE, the location of headphones.pid, the default is /var/run/headphones/headphones.pid
## PYTHON_BIN=      #$DAEMON, the location of the python binary, the default is /usr/bin/python
## HP_OPTS=         #$EXTRA_DAEMON_OPTS, extra cli option for headphones, i.e. " --config=/home/headphones/config.ini"
## SSD_OPTS=        #$EXTRA_SSD_OPTS, extra start-stop-daemon option like " --group=users"
## HP_PORT=         #$PORT_OPTS, hardcoded port for the webserver, overrides value in config.ini
##
## EXAMPLE if want to run as different user
## add HP_USER=username to /etc/default/headphones
## otherwise default headphones is used
#
### BEGIN INIT INFO
# Provides:          headphones
# 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 Headphones
# Description:       starts instance of Headphones using start-stop-daemon
### END INIT INFO

# Script name
NAME=headphones

# App name
DESC=Headphones

SETTINGS_LOADED=FALSE

. /lib/lsb/init-functions

# Source Headphones configuration
if [ -f /usr/local/headphones ]; then
    SETTINGS=/usr/local/headphones
else
    log_warning_msg "/etc/default/headphones not found using default settings.";
fi

check_retval() {
    if [ $? -eq 0 ]; then
        log_end_msg 0
        return 0
    else
        log_end_msg 1
        exit 1
    fi
}

load_settings() {
    if [ $SETTINGS_LOADED != "TRUE" ]; then
        . $SETTINGS

        ## The defaults
        # Run as username
        RUN_AS=${HP_USER-headphones}

        # Path to app HP_HOME=path_to_app_Headphones.py
        APP_PATH=${HP_HOME-/usr/local/headphones/}

        # Data directory where headphones.db, cache and logs are stored
        DATA_DIR=${HP_DATA-/var/headphones}

        # Path to store PID file
        PID_FILE=${HP_PIDFILE-/var/run/headphones/headphones.pid}

        # Path to python bin
        DAEMON=${PYTHON_BIN-/usr/bin/python}

        # Extra daemon option like: HP_OPTS=" --config=/var/headphones/headphones.ini"
        EXTRA_DAEMON_OPTS=${HP_OPTS-}

        # Extra start-stop-daemon option like START_OPTS=" --group=users"
        EXTRA_SSD_OPTS=${SSD_OPTS-}

        # Hardcoded port to run on, overrides config.ini settings
        [ -n "$HP_PORT" ] && {
            PORT_OPTS=" --port=${HP_PORT} "
        }

        DAEMON_OPTS=" Headphones.py --quiet --daemon --nolaunch --pidfile=${PID_FILE} --datadir=${DATA_DIR} ${PORT_OPTS}${EXTRA_DAEMON_OPTS}"

        SETTINGS_LOADED=TRUE
    fi

    [ -x $DAEMON ] || {
        log_warning_msg "$DESC: Can't execute daemon, aborting. See $DAEMON";
        return 1;}

    return 0
}

load_settings || exit 0

is_running () {
    # returns 1 when running, else 0.
    if [ -e $PID_FILE ]; then
      PID=`cat $PID_FILE`

      RET=$?
      [ $RET -gt 1 ] && exit 1 || return $RET
    else
      return 1
    fi
}

handle_pid () {
    PID_PATH=`dirname $PID_FILE`
    [ -d $PID_PATH ] || mkdir -p $PID_PATH && chown -R $RUN_AS $PID_PATH > /dev/null || {
        log_warning_msg "$DESC: Could not create $PID_FILE, See $SETTINGS, aborting.";
        return 1;}

    if [ -e $PID_FILE ]; then
        PID=`cat $PID_FILE`
        if ! kill -0 $PID > /dev/null 2>&1; then
            log_warning_msg "Removing stale $PID_FILE"
            rm $PID_FILE
        fi
    fi
}

handle_datadir () {
    [ -d $DATA_DIR ] || mkdir -p $DATA_DIR && chown -R $RUN_AS $DATA_DIR > /dev/null || {
        log_warning_msg "$DESC: Could not create $DATA_DIR, See $SETTINGS, aborting.";
        return 1;}
}

handle_updates () {
    chown -R $RUN_AS $APP_PATH > /dev/null || {
        log_warning_msg "$DESC: $APP_PATH not writable by $RUN_AS for web-updates";
        return 0; }
}

start_headphones () {
    handle_pid
    handle_datadir
    handle_updates
    if ! is_running; then
        log_daemon_msg "Starting $DESC"
        start-stop-daemon -o -d $APP_PATH -c $RUN_AS --start $EXTRA_SSD_OPTS --pidfile $PID_FILE --exec $DAEMON -- $DAEMON_OPTS
        check_retval
    else
        log_success_msg "$DESC: already running (pid $PID)"
    fi
}

stop_headphones () {
    if is_running; then
        log_daemon_msg "Stopping $DESC"
        start-stop-daemon -o --stop --pidfile $PID_FILE --retry 15
        check_retval
    else
        log_success_msg "$DESC: not running"
    fi
}

case "$1" in
    start)
        start_headphones
        ;;
    stop)
        stop_headphones
        ;;
    restart|force-reload)
        stop_headphones
        start_headphones
        ;;
    *)
        N=/etc/init.d/$NAME
        echo "Usage: $N {start|stop|restart|force-reload}" >&2
        exit 1
        ;;
esac

exit 0
chmod 755 /etc/init.d/headphones
update-rc.d headphones defaults
/etc/init.d/headphones start

Installation de Pyload

Télécharger le paquet Debian sur le site de pyload et l'installer:

wget http://download.pyload.org/pyload-v0.4.9-all.deb
dpkg -i pyload-v0.4.9-all.deb
rm pyload-v0.4.9-all.deb -Rf

On lance le logiciel puis on passe donc à la configuration de celui-ci :

cd /usr/share/pyload/
./pyLoadCore.py

Une fois l'ensemble des variables de l'assistant renseignées, nous pouvons redémarrer le service:

service pyload restart

Installation de Transmission