User Tools

Site Tools


install_wd

This is an old revision of the document!


1) Go to http://mybooklive/UI/ssh (case sensitive) replace “mybooklive” if you have renamed it to something else, or replace it with its IP address. It's a hidden UI menu to enable SSH.
Then select Settings→Media→ and turn of Twonky
Under Settings→System→Updates→ Turn off Automatic Updates.

2) Log in to through SSH by the IP for the device, then Install Optware

wget http://mybookworld.wikidot.com/local--files/optware/setup-mybooklive.sh
sh setup-mybooklive.sh
echo "export PATH=$PATH:/opt/bin:/opt/sbin:." >> /root/.bashrc
echo "export PATH=$PATH:/opt/bin:/opt/sbin:." >> /etc/profile
logout

Log back into the SSH

3) Test Optware and install a simple text editor

ipkg update
ipkg install nano
nano

A basic editor opens, hit ctrl-x to close.

4) Install Core-Utils

ipkg install coreutils
ln -s /opt/bin/coreutils-dirname /usr/bin/dirname

5) Install Java

apt-get update
apt-get install --allow-unauthenticated debian-keyring
apt-get install --allow-unauthenticated debian-archive-keyring
apt-get install openjdk-6-jdk
java -version
export JAVA_HOME=/usr/lib/jvm/java-6-openjdk/jre
export PATH=$PATH:/usr/lib/jvm/java-6-openjdk/jre

6) Install Serviio and setup user account to run the program

useradd serviio
passwd serviio
usermod -a -G root serviio

mkdir /usr/local/serviio/
cd /usr/local/serviio/
wget http://download.serviio.org/releases/serviio-0.6.1-linux.tar.gz
tar -xf serviio-0.6.1-linux.tar.gz

7) Launch Serviio as a test

cd serviio-0.6.1/bin
serviio.sh
You will be at a blank line, it appears like nothing is happening, yet the server is starting. One way to confirm is to open another ssh window, log in and run 
tail -f /usr/local/serviio/serviio-0.6.1/log/serviio.log

This will show a live output of the serviio log file. When you are satisfied that it's launching, hit ctrl-c in both ssh windows.

8) Setup Daemon to launch serviio upon bootup of your MyBook Live.
8a) create serviiod

nano /etc/default/serviiod
Copy following code, the service account is the name of the account we created in step 6. Also, the Daemon is the path to the serviio.sh file, update if you use a different version/location.
#########################################################
#- Daemon Script Configuration for Serviio Media Server
#- By Ian Laird
#- /etc/default/serviiod
#########################################################

NAME="Serviio Media Server"
DAEMON="/usr/local/serviio/serviio-0.6.1/bin/serviio.sh"    ## Update this to point at serviio_root/bin/serviio.sh
SERVICE_ACCOUNT="serviio" ## DON'T RUN UNDER ROOT!

8b) create serviio

nano /etc/init.d/serviio

Paste the following code.

    #!/bin/sh
    #
    #########################################################
    #- Daemon script for Serviio media server
    #- By Ian Laird; converted for Debian by Jacob Lundberg
    #- /etc/init.d/serviio
    #########################################################
    #
    ### BEGIN INIT INFO
    # Provides:          serviio
    # Required-Start:    $local_fs $remote_fs $network $syslog
    # Required-Stop:     $local_fs $remote_fs $network $syslog
    # Default-Start:     2 3 4 5
    # Default-Stop:      0 1 6
    # X-Interactive:     true
    # Short-Description: Start/stop serviio media server
    # Description:       The Serviio media server makes your media available to
    #                    all kinds of networked devices.
    ### END INIT INFO


    . /lib/lsb/init-functions

    if [ -f /etc/default/rcS ]; then
            . /etc/default/rcS
    fi


    DAEMON_STOP=" -stop"
    NAME="$(basename $0)"
    PIDFILE="/var/run/serviiod.pid"
    TIMEOUT=10

    if [ -f /etc/default/serviiod ]; then
            . /etc/default/serviiod
    fi

    [ -x "$DAEMON" ] || exit 0


    running() {
            if [ "x$1" == "x" ]; then
                    echo 0
                    return 1
            fi

            PS=$(ps h -p $(echo $1 | sed -r 's/[\t \n]+/ -p /') | wc -l)
            echo $PS

            if [ $PS -gt 0 ]; then
                    return 0
            else
                    return 1
            fi
    }


    start() {
       # Set up correct LANG
          if [ -r /etc/default/locale ]; then
             . /etc/default/locale
             export LANG LANGUAGE LC_MESSAGES LC_ALL LC_CTYPE
          fi

            log_daemon_msg "Starting Serviio media server daemon" "$NAME"
            start-stop-daemon --start -q -b -p "$PIDFILE" -m -c "${SERVICE_ACCOUNT}" -x "${DAEMON}"
            log_end_msg $?
    }

    stop() {
            log_daemon_msg "Stopping Serviio media server daemon" "$NAME"
            if [ -r "$PIDFILE" ]; then
                    PIDS=$(pstree -p $(<"$PIDFILE") | awk -F'[\(\)]' '/^[A-Za-z0-9]/ { print $2" "$4; }')
                    if running "$PIDS" > /dev/null; then
                            "${DAEMON}" "${DAEMON_STOP}"
                            for PID in $PIDS; do
                                    if running $PID > /dev/null; then
                                            kill -TERM $PID
                                    fi
                            done
                    fi
                    COUNTDOWN=$TIMEOUT
                    while let COUNTDOWN--; do
                            if ! running "$PIDS" > /dev/null; then
                                    break
                            fi
                            if [ $COUNTDOWN -eq 0 ]; then
                                    for PID in $PIDS; do
                                            if running $PID > /dev/null; then
                                                    kill -KILL $PID
                                            fi
                                    done
                            else
                                    echo -n .
                                    sleep 1
                            fi
                    done
            fi

            if running "$PIDS" > /dev/null; then
                    log_end_msg 1
            else
                    rm -f "$PIDFILE"
                    log_end_msg $?
            fi
    }

    status() {
            echo -n "$NAME should be"
            if [ -r "$PIDFILE" ]; then
                    echo -n " up with primary PID $(<"$PIDFILE")"
                    PIDS=$(pstree -p $(<"$PIDFILE") | awk -F'[\(\)]' '/^[A-Za-z0-9]/ { print $2" "$4; }')
                    RUNNING=$(running "$PIDS")
                    if [[ $RUNNING && $RUNNING -gt 0 ]]; then
                            echo -n " and $RUNNING processes are running."
                    else
                            echo -n " but it is not running."
                    fi
            else
                    echo -n " stopped."
            fi
            echo
    }


    case "${1:-}" in
            start)
                    start
            ;;
            stop)
                    stop
            ;;
            restart)
                    stop
                    start
            ;;
            status)
                    status
            ;;
            *)
                    log_success_msg "Usage: /etc/init.d/$NAME {start|stop|restart|status}"
                    exit 1
            ;;
    esac

    exit 0

8c) Set files to launch on startup

chown serviio -R /usr/local/serviio
chmod 755 /etc/init.d/serviio
update-rc.d serviio defaults

Reboot MyBook Live. Check status when back up by using either the tail command above, or

/etc/init.d/serviio status

9) Install Updated version of FFMPEG
9a) Update sources.list to include a multimedia repository

nano /etc/apt/sources.list

Add the following line to the file and save.

deb http://www.debian-multimedia.org stable main

9b) Finish Installation

apt-get update
apt-get install --allow-unauthenticated debian-multimedia-keyring
apt-get remove ffmpeg x264 libx264-dev libvpx-dev librtmp0 librtmp-dev
apt-get install ffmpeg

10) Access server through the console, use http://www.serviio.org/component/content/article/21#q2 as a reference. With respect to Mac, when entering the property, I placed the tags within the 3rd <dict> section, the one located after the property key.

11) Two other commands to stop or start the service when signed into the ssh, though you could use the console to do the same.

/etc/init.d/serviio start
/etc/init.d/serviio stop
install_wd.1326357428.txt.gz · Last modified: 2012/01/12 08:37 by cerberus