User Tools

Site Tools


howto:linux:install:fedora

This is an old revision of the document!


Fedora Installation Guide

Prerequisites

  • Update your system
    yum update
  • Make sure you install rmpfusion packages free and non-free from: http://rpmfusion.org/Configuration/ Just click on Fedora x (your release) and install via Software manager.
  • Next up, check your java is installed by running
    yum install java-1.7.0-openjdk

    (newest release at time of writing this page)

  • Then install ffmpeg with
    yum install ffmpeg

1.Download Serviio

wget http://download.serviio.org/releases/serviio-1.2.1-linux.tar.gz

2.Extract Serviio

tar -C /opt -zxvf serviio-1.2.1-linux.tar.gz
mv /opt/serviio-1.2.1 /opt/serviio

3.Create Serviio's user

useradd -d /opt/serviio -r serviio
chown -R serviio:serviio /opt/serviio

4a.Fedora >= 15 - Systemd script

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
I used user “root” to run serviio, I found that when adding disks etc. later on, or migrating disks from other distro's that serviio does not update the library, because of the file permissions. So this is what I did, there are more than one way to handle those permissions.

4b.Fedora <= 14 - Init.d script

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

5a.Fedora >= 15 - Enable service

Reload systemd config to ensure changes are taken into account immediately

systemctl --system daemon-reload

Enable service

systemctl enable serviio.service

5b.Fedora <= 14 - Enable service

chmod +x /etc/init.d/serviio
chkconfig --add serviio
chkconfig serviio on

6a.Fedora >= 15 - Start Serviio

systemctl start serviio.service

6b.Fedora <= 14 - Start Serviio

service serviio start
howto/linux/install/fedora.1373882101.txt.gz · Last modified: 2013/07/15 09:55 by zip