Serviio DLAN Server on Debian

Posted by Kaya Kupferschmidt • Wednesday, December 28. 2011 • Category: Hardware

If you want to share your media collection (that is music, videos and pictures) in your LAN on multimedia devices like tablets, smartphones, TVs and consoles, you end up using either DLNA or UPnP. Because my devices support DLNA, I decided to give it a try to install a DLNA service on a Debian server. Googling around, I found some different implementations of which Serviio media server looked most primising. Implemented in Java it surely uses some more resources than some native C/C++ implementation, but it offers some nice features like plugins and device profiles. And it offers a pure server implementation without a GUI, which was very important to me for running it on a headless server.

First you need a properly configured debian system with Java installed. For accessing an optional web ui for administrating the server you'll also need an apache2 with php5 installed on your box. You can ensure that both are installed by running apt-get.

$ apt-get install openjdk-6-jre-headless apache2 libapache2-mod-php5 php5-xmlrpc php5-curl 
Then you need to download the latest version from, which comes as a .tar.gz file for linux. Unzip it into your /opt folder: $ cd /opt $ tar xvzf serviio- $ mv serviio- serviio Because I do not want to run the service as root, I create a special linux user for running saviio $ useradd -r -d /opt/serviio -U serviio $ chown -R serviio:serviio serviio Then we need some init script for starting serviio, so we'll create the file /etc/init.d/serviio with our favorite editor (for example nano)

! /bin/sh



# #


Provides: serviio

Required-Start: $network

Required-Stop: $network

Default-Start: 3 5

Default-Stop: 0 1 2 6

Description: Start the serviio DLNA server in headless mode



Source function library.

. /lib/lsb/init-functions


check() {         # Check that we're a privileged user         [ $(id -u) = 0 ] || exit 4

        # Check if SERVIIOHOME exists         test -d "$SERVIIOHOME" || exit 5

        # Check if SERVIIOBIN is executable         test -x "$SERVIIOBIN" || exit 5 }

start() {         check

        echo -n "Starting Serviio DLNA server: "         /usr/bin/sudo -u $SERVIIOUSER -H $SERVIIOBIN -headless &

        RETVAL=$?         if [ $RETVAL -eq 0 ]; then             touch /var/lock/serviio             logendmsg 0         else             logendmsg 1         fi         echo         return $RETVAL }

stop() {         check

        echo -n "Shutting down Serviio DLNA daemon: "         killproc "$SERVIIO_BIN"         RETVAL=$?         [ $RETVAL -eq 0 ] && rm -f /var/lock/serviio         echo         return $RETVAL }

restart() {         stop         start }

case "$1" in start)         start         ;; stop)         stop         ;; force-reload)         restart         ;; restart)         restart         ;; condrestart)         if [ -f /var/lock/serviio ]; then             restart         fi         ;; status)         status         ;; *)         echo $"Usage: $0 {start|stop|status|restart|condrestart|force-reload}"         RETVAL=2 esac

exit $RETVAL

Now we can install and start the service: $ chmod a+rx /etc/init.d/serviio $ chkconfig --add serviio $ service serviio start


Display comments as (Linear | Threaded)
  1. No comments

Add Comment

Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
Standard emoticons like :-) and ;-) are converted to images.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.

Markdown format allowed

A Simple Sidebar