User Tools

Site Tools


wiki:user:deanox

This is an old revision of the document!


In order to run Serviio on the Zyxel NSA325 a number of steps are required. This hasn't been tested on other Zyxel models but the key enabler is the Fonz Fun Plug linux environment so the steps should be common for any NAS where FFP is available. You will need basic knowledge of linux to login via SSH and edit configuration files etc.

1) Install FFP 0.7 zyxel package

Follow the instructions to install the Fonz Fun Plug (FFP) Zyxel package.

Enable the package in the Zyxel admin pages and check you can SSH into the NAS.

2) Add the various FFP site definitions

Follow these instructions to add a number of extra FFP package locations.

3) Install ffmpeg/lame ffp packages

Add some additional ffp packages using the slacker installation utility:-

su
slacker -i ffmpeg-0.11.1-arm-1
slacker -i lame

The root (su) password should be the admin password you have setup your nas with.
Now verify that ffmpeg is working:-

ffmpeg -version

should give similair to:-

ffmpeg version 0.11.1
built on Jun 25 2012 20:34:06 with gcc 4.5.4 20111110 (prerelease)
configuration: --prefix=/ffp --disable-static --enable-shared --enable-gpl --enable-nonfree --enable-small --disable-encoder=aac --disable-decoder=aac --disable-armv6 --disable-armv6t2 --disable-armvfp
libavutil      51. 54.100 / 51. 54.100
libavcodec     54. 23.100 / 54. 23.100
libavformat    54.  6.100 / 54.  6.100
libavdevice    54.  0.100 / 54.  0.100
libavfilter     2. 77.100 /  2. 77.100
libswscale      2.  1.100 /  2.  1.100
libswresample   0. 15.100 /  0. 15.100
libpostproc    52.  0.100 / 52.  0.100

4) Install Java

Follow these instructions to install the headless (no GUI etc) version of Java for ARMv5

As the admin user (not root) verify java is working :-

java -version

should give similair to :-

java version "1.7.0_10"
Java(TM) SE Embedded Runtime Environment (build 1.7.0_10-b18, headless)
Java HotSpot(TM) Embedded Client VM (build 23.6-b04, mixed mode)

5) Install Serviio

As root (su) download the Linux serviio package to the nas:-

cd /ffp/opt
wget http://download.serviio.org/releases/serviio-1.1-linux.tar.gz
tar xfvz /i-data/md0/data/ZyxelNAS/serviio-1.1-linux.tar.gz

Set some permissions (Write for the library,log and plugin directories) :-

cd /ffp/opt/servio-1.1
chmod a+w library
mkdir log
chmod a+w log
chmod a+w plugins

Create a symbolic link to the version for easier upgrades later :-

cd /ffp/opt
ln -s /ffp/opt/servio-1.1 servio

Create a temporary directory for Serviio

mkdir /ffp/tmp

Create a FFP startup script

cd /ffp/start
touch serviiod.sh

Edit the file and paste the following

#!/ffp/bin/sh

# FFP Startup script for Serviio

EXEC=/ffp/opt/serviio/bin/serviio.sh
PIDFILE=/var/run/serviiod.pid
JAVA_HOME=/ffp/opt/java/jre
OPTS=

test -x $EXEC || exit 0

case "$1" in
  start)
	echo "Starting Serviio"
	
	# set required JAVA home environment variable	
	export JAVA_HOME
	
	# Use the normal serviio.sh script to ensure correct environment is set up
	if start-stop-daemon --start --quiet --oknodo --make-pidfile --background --pidfile $PIDFILE --exec $EXEC -- $OPTS; then
	    echo "OK"
	else
	    echo "Failed"
	fi
	;;
	
  stop)
	echo "Stopping Serviio"
	
	# Kill both serviio.sh script and Java process
	serv_kill=`ps aux | grep serviio.sh | grep -v grep | awk '{print $2}'`
    java_kill=`ps aux | grep org.serviio.MediaServer | grep -v grep | awk '{print $2}'`
            if [ "$serv_kill" = "" ]; then
                    echo "Serviio shell is not running"
                    RETVAL=1
            else
                    kill $serv_kill
                    RETVAL=0
            fi

            if [ "$java_kill" = "" ]; then
                    echo "Serviio Java is not running"
                    RETVAL=1
            else
                    kill -9 $java_kill
                    RETVAL=0
            fi
	
	echo "OK" 
	;;
	
	status) 
            
			serv_pid=`ps aux | grep serviio.sh | grep -v grep | awk '{print $2}'`
            java_pid=`ps aux | grep java | grep -v grep | awk '{print $2}'`
            if [ "$serv_pid" != "" ]; then
                    echo "Serviio shell (pid $serv_pid) is running"
                    RETVAL=0
            else
                    echo "Serviio shell is stopped"
                    RETVAL=1
            fi
			
			if [ "$java_pid" != "" ]; then
                    echo "Serviio Java (pid $java_pid) is running"
                    RETVAL=0
            else
                    echo "Serviio Java is stopped"
                    RETVAL=1
            fi
			
esac

exit 0

Once saved make the file executable

chmod a+x serviiod.sh

We need to make some changes to the serviio startup script and the Options passed to Serviio i.e. specify the ac3_fixed encoder (-Dserviio.fixedPointEncoders) and temp directory for transcoding (-Dserviio.defaultTranscodeFolder=/ffp/tmp).

Edit /opt/serviio/bin/serviio.sh and find the line beginning “JAVA_OPTS” and change to

JAVA_OPTS="-Djava.net.preferIPv4Stack=true -Djava.awt.headless=true -Dderby.system.home=$SERVIIO_HOME/library -Dserviio.fixedPointEncoders -Dserviio.defaultTranscodeFolder=/ffp/tmp -Dserviio.home=$SERVIIO_HOME"

Change the last line that executes the Java to decrease the memory to 384M :-

"$JAVA" -Xmx384M -Xms20M -XX:+UseParNewGC -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 $JAVA_OPTS -classpath "$SERVIIO_CLASS_PATH" org.serviio.MediaServer "$@"

6) Serviio should now start

sh /ffp/start/serviio.d start

Check the Java process is running

ps -ef | grep serviio

Should show both the serviio.sh and underlying Java process

root     27790     1  0 10:53 ?        00:00:00 /bin/sh /ffp/opt/serviio/bin/serviio.sh
root     27795 27790  4 10:53 ?        00:03:34 /ffp/opt/java/jre/bin/java -Xmx384M -Xms20M -XX:+UseParNewGC -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 -Djava.net.preferIPv4Stack=true -Djava.awt.headless=true -Dderby.system.home=/ffp/opt/serviio/library -Dserviio.fixedPointEncoders -Dserviio.defaultTranscodeFolder=/ffp/tmp -Dserviio.home=/ffp/opt/serviio -classpath /ffp/opt/serviio/lib/*:/ffp/opt/serviio/config org.serviio.MediaServer

Serviio can be stopped with

sh /ffp/start/serviio.d stop

7) Manage Serviio and add media

Install the Serviio console of your choice (e.g. Windows Serviio package and select console only) and configure to remotely manage the NAS instance of Serviio.
To add a folder you need to use the relevant linux path on the server. e.g. for a single mirrored pair of disks that would be:-

/i-data/md0/<SHARE NAME>/<MEDIA FOLDER>

e.g.

Picture

I wouldn't recommend the NAS is allowed to generate thumbnails as it drives the CPU quite hard. Initial loading of the library will also work Java and ffmpeg hard until fully scanned

wiki/user/deanox.1358253862.txt.gz · Last modified: 2013/01/15 12:44 by deanox