From SME Server
Revision as of 18:01, 12 October 2012 by Jader (talk | contribs) (Introduction)


Serviio ( 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 and it works with Sun Java or Iced-Tea from rpmforge. Packages ffmpeg and mencoder are installed for transcoding.


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:

unzip "WebUI"
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 '$basearch/dag' \
EnableGroups no \
GPGCheck yes \
GPGKey \
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 :

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



# Set up correct LANG
export LANG


# Setup the JVM
if [ "x$JAVA" = "x" ]; then
    if [ "x$JAVA_HOME" != "x" ]; then

# Setup the classpath

# Setup Serviio specific properties
JAVA_OPTS=" -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


exec                                    \
    /usr/local/bin/setuidgid smelog     \
    /usr/local/bin/multilog t s5000000  \

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 netmask $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    -j denylog
    /sbin/iptables --append INPUT -d    -j denylog
    $OUT .= "    /sbin/iptables --append OUTPUT -s -d $LocalIP  -j ACCEPT\n"; 
    $OUT .= "    /sbin/iptables --append OUTPUT -d -s $LocalIP  -j ACCEPT\n";
    /sbin/iptables --append OUTPUT -s -d $OUTERNET  -j denylog
    /sbin/iptables --append OUTPUT -d -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:// for some media, so I had to set those to ManualPermissions and added a read ACL for serviio.