Skip to content

Instantly share code, notes, and snippets.

@plembo
Last active August 4, 2018 16:25
Show Gist options
  • Save plembo/10912b5eb324afdbb55480319c7bd12a to your computer and use it in GitHub Desktop.
Save plembo/10912b5eb324afdbb55480319c7bd12a to your computer and use it in GitHub Desktop.
Serviio Setup on Linux

Setting up Serviio on Linux

Serviio is a cross-platform media server written in Java.

Binaries are available for many platforms, including Linux.

Follow the Getting Started guide to get things set up and configured.

The following describes my own practical application of the instructions given in the above guide. The installation was done on Ubuntu Server 16.04 LTS.

Prerequisites

The server needs the latest OpenJDK (on Linux) or Oracle Java (on Windows) to run.

Installation

On Linux, extract the tarball to where the server will run:

tar xzf -C /d1/app/

The resulting folder will be "serviio-[version]", like "serviio-1.9.1".

Rename or symlink to "/d1/app/serviio" to simplify creation of startup script.

Startup Script

Following is the supplied Linux startup script to be created as /etc/init.d/serviio:

#!/bin/sh
#
# chkconfig: 345 95 5
# description: Control the Serviio Media Server
### BEGIN INIT INFO
# Provides:          serviio
# Required-Start:    $remote_fs $network $syslog $named
# Required-Stop:     $remote_fs $network $syslog $named
# Should-Start:      $network $time
# Should-Stop:       $network $time
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start and stop the serviio media server daemon
# Description:       Controls the main serviio media server daemon
### END INIT INFO


# Set the path to the Serviio instance to manage
SERVIIO_HOME="/d1/app/serviio"
export SERVIIO_HOME

cd ${SERVIIO_HOME}

# Specify the path to the Java installation to use
JAVA_HOME="/usr/lib/jvm/java-1.8.0-openjdk-amd64"
export JAVA_HOME

# Determine what action should be performed on the server
case "${1}" in
start)
  /bin/su serviio -c "${SERVIIO_HOME}/bin/serviio.sh &"
  exit ${?}
  ;;
stop)
  /bin/su serviio -c "${SERVIIO_HOME}/bin/serviio.sh -stop"
  exit ${?}
  ;;
*)
  echo "Usage:  $0 { start | stop }"
  exit 1
  ;;
esac

In the above file I set JAVA_HOME and SERVIIO_HOME explicitly to ensure the server used the correct values for these paths.

Enable start on reboot with "systemctl enable serviio".

Configuration

To avoid requiring home network users to supply a password, add the following option to the list of JAVA_OPTS in "d1/app/serviio/bin/serviio.sh" (only do this if you're not planning on making your media server available over the Internet):

-Dserviio.cdsAnonymousAccess=true

In context:

# Setup Serviio specific properties
JAVA_OPTS="-Djava.net.preferIPv4Stack=true -Djava.awt.headless=true
-Dorg.restlet.engine.loggerFacadeClass=org.restlet.ext.slf4j.Slf4jLoggerFacade
-Dderby.system.home=$SERVIIO_HOME/library -Dserviio.home=$SERVIIO_HOME
-Dffmpeg.location=ffmpeg -Ddcraw.location=dcraw
-Dserviio.cdsAnonymousAccess=true"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment