Difference between revisions of "Serviio"

From SME Server
(First edition of this howTo)
 
m (creating headers.)
Line 1: Line 1:
Introduction:
+
==Introduction==
 
Serviio (http://serviio.org) is a DLNA server, allowing you to share media (Photos, Audio and Video) files to compatible devices. <br>
 
Serviio (http://serviio.org) is a DLNA server, allowing you to share media (Photos, Audio and Video) files to compatible devices. <br>
 
Serviio has a wide range of DLNA Profile support, including many TVs, Disc Players, PS3 and XBox360. It also allows transcoding and container changing.
 
Serviio has a wide range of DLNA Profile support, including many TVs, Disc Players, PS3 and XBox360. It also allows transcoding and container changing.
Line 6: Line 6:
 
Packages ffmpeg and mencoder are installed for transcoding.  
 
Packages ffmpeg and mencoder are installed for transcoding.  
  
 +
== Instalation ==
 
Start by make a serviio ibay - this creates a serviio user and somewhere for the web-based console.
 
Start by make a serviio ibay - this creates a serviio user and somewhere for the web-based console.
 
Set it for <br>
 
Set it for <br>
Line 165: Line 166:
 
service serviio start
 
service serviio start
 
</pre>
 
</pre>
 +
 +
==Final Configuration==
 
You can now browse to '''http://your_Server_ip/serviio''' to complete configuration.
 
You can now browse to '''http://your_Server_ip/serviio''' to complete configuration.
  

Revision as of 16:52, 12 October 2012

Introduction

Serviio (http://serviio.org) is a DLNA server, allowing you to share media (Photos, Audio and Video) files to compatible devices.
Serviio has a wide range of DLNA Profile support, including many TVs, Disc Players, PS3 and XBox360. It also allows transcoding and container changing.
It is written in Java - I have used . It works with Sun Java or Iced-Tea from rpmforge. Packages ffmpeg and mencoder are installed for transcoding.

Instalation

Start by make a serviio ibay - this creates a serviio user and somewhere for the web-based console. Set it for
local internet access only,
allow executable content

Now run this on shell:

wget https://github.com/downloads/mpemberton5/Web-UI-for-Serviio/WebUI%20v1.0.zip
unzip "WebUI v1.0.zip"
cp -Rf serviioweb/* /home/e-smith/files/ibays/serviio/html
rm -f /home/e-smith/files/ibays/serviio/html/index.html

And now the encoding tools:

db yum_repositories set rpmforge repository \
Name 'Dag - EL5' \
BaseURL 'http://apt.sw.be/redhat/el5/en/$basearch/dag' \
EnableGroups no \
GPGCheck yes \
GPGKey http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txt \
Visible no \
Exclude freetype,htop,iptraf,rsync,syslinux \
status disabled

signal-event yum-modify

yum install ffmpeg mplayer mencoder libdvdnav vobcopy java-1.7.0-icedtea --enablerepo=rpmforge

And finally the Serviio :

wget http://download.serviio.org/releases/serviio-0.6.2-linux.tar.gz
tar -xvf serviio-0.6.2-linux.tar.gz
mv serviio-0.6.2 /opt/serviio
chown -R serviio:serviio /opt/serviio/library
mkdir /opt/serviio/log
chown -R serviio:serviio /opt/serviio/log
mkdir -p /var/service/serviio
mkdir -p /var/service/serviio/log


cd /var/service/serviio


Now create a new file run

vi /var/service/serviio/run

containing

#!/bin/sh

# Set up correct LANG
LANG=en_US
export LANG

SERVIIO_HOME="/opt/serviio"
export SERVIIO_HOME

# Setup the JVM
if [ "x$JAVA" = "x" ]; then
    if [ "x$JAVA_HOME" != "x" ]; then
	JAVA="$JAVA_HOME/bin/java"
    else
	JAVA="java"
    fi
fi

# Setup the classpath
SERVIIO_CLASS_PATH="$SERVIIO_HOME/lib/*:$SERVIIO_HOME/config"

# Setup Serviio specific properties
JAVA_OPTS="-Djava.net.preferIPv4Stack=true -Djava.awt.headless=true -Dderby.system.home=$SERVIIO_HOME/library -Dserviio.home=$SERVIIO_HOME"

exec 2>&1
# Execute the JVM in the foreground
exec setuidgid serviio "$JAVA" -Xmx384M -Xms20M -XX:+UseParNewGC -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 $JAVA_OPTS -classpath "$SERVIIO_CLASS_PATH" org.serviio.MediaServer "$@"         

Now we'll create a new file named run

cd /var/service/serviio/log 
vi /var/service/serviio/log/run

containing

#!/bin/sh
exec                                    \
    /usr/local/bin/setuidgid smelog     \
    /usr/local/bin/multilog t s5000000  \
    /var/log/serviio

Now the configurations to make all those work:

mkdir -p /var/log/serviio
touch /var/service/serviio/down
db configuration set serviio service status enabled TCPPort 8895 UDPPort 1900 access private
ln -s /var/service/serviio /service/serviio
ln -s /etc/rc.d/init.d/daemontools /etc/rc.d/init.d/supervise/serviio
ln -s /etc/rc.d/init.d/e-smith-service /etc/rc7.d/S98serviio
chmod 755 /var/service/serviio/run
chmod 755 /var/service/serviio/log/run
chown smelog:smelog /var/log/serviio
chmod a+rw /var/log/serviio

db accounts setprop serviio PHPBaseDir /home/e-smith/files/ibays/serviio/html/:/tmp

edit /opt/serviio/config/logj4.xml using

vi /opt/serviio/config/logj4.xml

and change the logfile location to

<param name="File" value="/var/log/serviio/serviio.log" />

Make a masq template fragment to allow multicast on the internal interface

mkdir /etc/e-smith/templates-custom/etc
mkdir /etc/e-smith/templates-custom/etc/rc.d
mkdir /etc/e-smith/templates-custom/etc/rc.d/init.d
mkdir /etc/e-smith/templates-custom/etc/rc.d/init.d/masq
touch 39AddMulticastRoute
touch 40DenyMulticast

Then edit file /etc/e-smith/templates-custom/etc/rc.d/init.d/masq/39AddMulticastRoute

vi /etc/e-smith/templates-custom/etc/rc.d/init.d/masq/39AddMulticastRoute

to contain

# add a multicast route on the internal interface for DLNA
    /sbin/route add -net 239.0.0.0 netmask 255.0.0.0 $INTERNALIF

edit /etc/e-smith/templates-custom/etc/rc.d/init.d/masq/40DenyMulticast using

vi /etc/e-smith/templates-custom/etc/rc.d/init.d/masq/40DenyMulticast

and insert

    # Drop all multicast traffic. Note that anything on from a local network
    # will have already been accepted via the local_chk chain.
    /sbin/iptables --append INPUT -s 224.0.0.0/4    -j denylog
    /sbin/iptables --append INPUT -d 224.0.0.0/4    -j denylog
    
{
    $OUT .= "    /sbin/iptables --append OUTPUT -s 224.0.0.0/4 -d $LocalIP  -j ACCEPT\n"; 
    $OUT .= "    /sbin/iptables --append OUTPUT -d 224.0.0.0/4 -s $LocalIP  -j ACCEPT\n";
}
    /sbin/iptables --append OUTPUT -s 224.0.0.0/4 -d $OUTERNET  -j denylog
    /sbin/iptables --append OUTPUT -d 224.0.0.0/4 -s $OUTERNET -j denylog

Expand the template and restart services

expand-template /etc/rc.d/init.d/masq
service masq restart
service serviio start

Final Configuration

You can now browse to http://your_Server_ip/serviio to complete configuration.


Content directories you add must be readable by the Serviio user. Ibays readable by everyone are ok.
I have used the SharedFolders (http://http://wiki.contribs.org/SharedFolders)contrib for some media, so I had to set those to ManualPermissions and added a read ACL for serviio.

Source: http://forums.contribs.org/index.php/topic,48568.0