Based on Clear Foundation's Howto
yum update
yum install java-1.7.0-openjdk
(newest release at time of writing this page) Java 8 required now
yum install ffmpeg
For ffmpeg on Fedora 20
rpm -Uvh http://rpm.livna.org/livna-release.rpm
yum install gstreamer-plugins-bad gstreamer-plugins-bad-free-extras gstreamer-plugins-bad-nonfree gstreamer-plugins-ugly gstreamer-ffmpeg ffmpeg mencoder ffmpeg2theora mplayer libdvdcss
wget http://download.serviio.org/releases/serviio-1.2.1-linux.tar.gz
tar -C /opt -zxvf serviio-1.2.1-linux.tar.gz mv /opt/serviio-1.2.1 /opt/serviio
useradd -d /opt/serviio -r serviio chown -R serviio:serviio /opt/serviio
Create the systemd script /lib/systemd/system/serviio.service with the following code: (If content library is available via nfs or cifs, add remote-fs.target in After=)
[Unit] Description=Start the serviio DLNA server in headless mode After=local-fs.target network.target [Service] Type=simple User=root ExecStart=/opt/serviio/bin/serviio.sh ExecStop=/opt/serviio/bin/serviio.sh -stop Restart=on-abort [Install] WantedBy=multi-user.target
Create the initscript /etc/init.d/serviio with the following code:
#! /bin/sh # # chkconfig 35 85 15 # description: Start the serviio DLNA server in headless mode ### BEGIN INIT INFO # 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 ### END INIT INFO SERVIIO_HOME="/opt/serviio" SERVIIO_DAEMON="serviio.sh" SERVIIO_BIN="$SERVIIO_HOME/bin/$SERVIIO_DAEMON" SERVIIO_USER="serviio" # Source function library. . /etc/rc.d/init.d/functions RETVAL=0 check() { # Check that we're a privileged user [ $(id -u) = 0 ] || exit 4 # Check if SERVIIO_HOME exists test -d "$SERVIIO_HOME" || exit 5 # Check if SERVIIO_BIN is executable test -x "$SERVIIO_BIN" || exit 5 } start() { check echo -n "Starting Serviio DLNA server: " /bin/su --session-command="$SERVIIO_BIN -headless" $SERVIIO_USER & RETVAL=$? if [ $RETVAL -eq 0 ]; then touch /var/lock/subsys/serviio.sh echo_success else echo_failure fi echo return $RETVAL } stop() { check echo -n "Shutting down Serviio DLNA daemon: " # Retrieve JAVA Serviio process ID PIDDAEMON=`pgrep $SERVIIO_DAEMON` [ -z "$PIDDAEMON" ] || PIDJAVA=`ps -o pid= --ppid $PIDDAEMON` # Kill the daemon killproc "$SERVIIO_BIN" RETVAL=$? [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/serviio.sh echo # Kill the JAVA Serviio process if exists [ -z "$PIDJAVA" ] || kill -9 $PIDJAVA return $RETVAL } restart() { stop start } case "$1" in start) start ;; stop) stop ;; force-reload) restart ;; restart) restart ;; condrestart) if [ -f /var/lock/subsys/serviio.sh ]; then restart fi ;; status) status serviio.sh ;; *) echo $"Usage: $0 {start|stop|status|restart|condrestart|force-reload}" RETVAL=2 esac exit $RETVAL
Reload systemd config to ensure changes are taken into account immediately
systemctl --system daemon-reload
Enable service
systemctl enable serviio.service
chmod +x /etc/init.d/serviio chkconfig --add serviio chkconfig serviio on
systemctl start serviio.service
service serviio start