Koozali.org: home of the SME Server

Serviio DLNA server

Offline si_blakely

  • *
  • 57
  • +0/-0
Serviio DLNA server
« on: April 25, 2012, 02:24:34 PM »
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 Iced-Tea from rpmforge. It works just as well with Sun Java. ffmpeg and mencoder are installed for transcoding.

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
Code: [Select]
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

Code: [Select]
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

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

Code: [Select]
cd /var/service/serviio

make a file run containing
Code: [Select]
#!/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 "$@"         

Code: [Select]
cd /var/service/serviio/log

make a file run containing
Code: [Select]
#!/bin/sh
exec                                    \
    /usr/local/bin/setuidgid smelog     \
    /usr/local/bin/multilog t s5000000  \
    /var/log/serviio

Code: [Select]
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

edit /opt/serviio/config/logj4.xml and change the logfile location
Code: [Select]
<param name="File" value="/var/log/serviio/serviio.log" />
Make a masq template fragment to allow multicast on the internal interface
Code: [Select]
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

edit 39AddMulticastRoute to contain
Code: [Select]
# 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 40DenyMulticast and insert
Code: [Select]
    # 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
Code: [Select]
expand-template /etc/rc.d/init.d/masq
service masq restart
service serviio start

You can now browse to http://Server/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.

Have fun


Offline Franco

  • *
  • 1,171
  • +0/-0
    • http://contribs.org
Re: Serviio DLNA server
« Reply #1 on: April 30, 2012, 03:57:32 AM »
Really nice!
I'm almost done getting it to run, but still a few problems left.
There's a openbasedir on /tmp which can fixed with:
Code: [Select]
db accounts setprop serviio PHPBaseDir /home/e-smith/files/ibays/serviio/html/:/tmp
Also there's this error, which does not allow me to enter online sources:
Code: [Select]
Apr 29 22:47:12 sme8 httpd: PHP Warning:  scandir() [<a href='function.scandir'>function.scandir</a>]: (errno 13): Permission denied in /home/e-smith/files/ibays/serviio/html/tree/jquery_folder_tree/jquery.foldertree.php on line 40Any hints on how to fix it?

Thanks,

Offline si_blakely

  • *
  • 57
  • +0/-0
Re: Serviio DLNA server
« Reply #2 on: April 30, 2012, 08:58:49 AM »
Franco,

I had only used the WebUI to add folders and start/stop the services. Having just tried to set the Presentation options and add online feeds, I discovered that that did not work too well, either. It has been a bit disappointing from that point of view, and ServiiDroid (an Android management client) has been much better.

I may have a crack at the Java html interface - I still want all the web management capability. I just want it to work with a minimum of hassle.

Simon

Offline gajol

  • *
  • 23
  • +0/-0
Re: Serviio DLNA server
« Reply #3 on: October 08, 2012, 11:41:28 PM »
hi,

thx for the how to. i have this problem: i've got in the web interface:

WARNING: There is a version mismatch between Serviio and Web UI. There may be a loss of functionality.

In About no Serviio Version is shown ; WebUi Vers. 1.0

I updated the WebUI to 1.2 - The Error Message now wasn't shown, but every input in the webinterface show a "parsererror"

I found this some workarounds at the web, but nothing worked for me.

What could the problem?

Offline si_blakely

  • *
  • 57
  • +0/-0
Re: Serviio DLNA server
« Reply #4 on: October 09, 2012, 10:19:57 AM »
I have not tried the latest PHP web-UI - I started using ServiiDroid - an Android app that controls serviio.

Sorry I cannot help

Simon

Offline nicolatiana

  • *
  • 721
  • +0/-0
Re: Serviio DLNA server
« Reply #5 on: October 12, 2012, 01:21:53 PM »
1) Many thanks to si_blakely for your guide; maybe you could transform it in "Howto" ?
2) I suspect that chown -R serviio:serviio /opt/serviio/config is necessary too.
3) Investigating php error posted by Franco; I'm using Serviio 1.0.1; I'll post futher news.
4) UI: I've installed with succes the Ajax UI from http://kairoh.bitbucket.org/serviio-webui/: you can start it simply by putting an entry in /etc/rc.local (Installation instruction inside the .tar file)
5) UI: the php ui (1.2) seems having problem (at least on SME): I was not able to browse folders nor save Presentation Settings (while I was able with (4) ).
6) At the present time I've tested only on VLC client waiting to test on Sony Bravia TV and/or LG SmartTv.
 
Bye
 
Nicola
Consulente di Smeserver.it -  Soluzioni e supporto su Sme server in Italia.

Offline Jáder

  • *
  • 1,099
  • +0/-0
    • LinuxFacil
Re: Serviio DLNA server
« Reply #6 on: October 12, 2012, 04:49:51 PM »
I have created an Howto about this... but I do not follow it (:$) so I'm not sure if it's working.
I'm unable to do this right now...could someone else try it and report:

http://wiki.contribs.org/Serviio

Any tips and fixes can be done directly on Wiki or report here and I'll try to make them quickly (I'm off town in training for next days!)
...

Offline nicolatiana

  • *
  • 721
  • +0/-0
Re: Serviio DLNA server
« Reply #7 on: October 12, 2012, 06:30:26 PM »
I'm currently testing; I'll add other tips if necessary.
 
Nicola
Consulente di Smeserver.it -  Soluzioni e supporto su Sme server in Italia.

Offline nicolatiana

  • *
  • 721
  • +0/-0
Re: Serviio DLNA server
« Reply #8 on: October 19, 2012, 08:26:05 AM »
At the present time (19/10/2012) the working solution is Serviio 1.0.1 with Ajax UI 0.6.2-f from http://kairoh.bitbucket.org/serviio-webui -> https://bitbucket.org/kairoh/serviio-webui/wiki/History
 
Bye
 
Nicola
 
Consulente di Smeserver.it -  Soluzioni e supporto su Sme server in Italia.

Offline si_blakely

  • *
  • 57
  • +0/-0
Re: Serviio DLNA server
« Reply #9 on: October 22, 2012, 11:53:59 AM »
Thanks for that, Jader - I had intended to turn this into a How-To, but wanted some more feedback before doing so.

I try to write some notes on the Ajax UI 0.6.2-f

Si

Offline nicolatiana

  • *
  • 721
  • +0/-0
Re: Serviio DLNA server
« Reply #10 on: October 22, 2012, 12:00:58 PM »
Pay attention: the developer has released a new release of Java-Ajax Web-Ui (1.0.1-a) but i've found it not working (Unable to add folders; error saving preferences).
I'll try to contact the developer to post a bug on his site.
The Webui is simply configured by putting 2 jar files in the plugins folder of Servio and two sh script in the bin folder.
The autostart must be investigated.
 
Nicola
Consulente di Smeserver.it -  Soluzioni e supporto su Sme server in Italia.

Offline gajol

  • *
  • 23
  • +0/-0
Re: Serviio DLNA server
« Reply #11 on: December 12, 2012, 02:34:19 PM »
hi,

i can´t get it to install serviio correct. Maybe you know help.

i use:
serviio 1.0.1 - http://download.serviio.org/releases/serviio-1.0.1-linux.tar.gz
servio web ui 1.0.1 - https://github.com/downloads/mpemberton5/Web-UI-for-Serviio/WebUI%20v1.0.1.zip
ajax web ui 0.6.2-f - http://kairoh.bitbucket.org/serviio-webui/dist/serviio-webui-unix-0.6.2-f.tar.gz
java-1.6.0-openjdk-1.6.0.0-1.28.1.10.10.el5_8.x86_64 already installed and latest version


on sme 8 with all current updates in 64 bit.

If i install the serviio like the howto, the server runs and i can see it from other devices. but the webui dont work. and i can´t make my preferences. i got a lot of php error in the messages:

Code: [Select]
Dec 12 10:46:18 sme8 esmith::event[3512]: Processing event: local 
Dec 12 10:46:18 sme8 esmith::event[3512]: Running event handler: /etc/e-smith/events/actions/generic_template_expand
Dec 12 10:46:18 sme8 esmith::event[3512]: expanding /etc/sysconfig/kernel 
Dec 12 10:46:19 sme8 esmith::event[3512]: expanding /boot/grub/grub.conf 
Dec 12 10:46:19 sme8 esmith::event[3512]: generic_template_expand=action|Event|local|Action|generic_template_expand|Start|1355305578 848921|End|1355305579 907289|Elapsed|1.058368
Dec 12 10:46:19 sme8 esmith::event[3512]: Running event handler: /etc/e-smith/events/local/S50clear-pptp-interfaces
Dec 12 10:46:19 sme8 esmith::event[3512]: S50clear-pptp-interfaces=action|Event|local|Action|S50clear-pptp-interfaces|Start|1355305579 907670|End|1355305579 977130|Elapsed|0.06946
Dec 12 10:46:19 sme8 esmith::event[3512]: Running event handler: /etc/e-smith/events/actions/adjust-services
Dec 12 10:46:20 sme8 esmith::event[3512]: adjusting supervised yum (once) 
Dec 12 10:46:20 sme8 esmith::event[3512]: adjust-services=action|Event|local|Action|adjust-services|Start|1355305579 977499|End|1355305580 101767|Elapsed|0.124268
Dec 12 10:54:23 sme8 httpd: PHP Fatal error:  Unsupported operand types in /home/e-smith/files/ibays/serviio/html/lib/serviio.php on line 88
Dec 12 10:54:23 sme8 httpd: PHP Warning:  Invalid argument supplied for foreach() in /home/e-smith/files/ibays/serviio/html/view/status.php on line 37
Dec 12 10:54:23 sme8 httpd: PHP Warning:  Invalid argument supplied for foreach() in /home/e-smith/files/ibays/serviio/html/view/status.php on line 64
Dec 12 10:54:28 sme8 httpd: PHP Fatal error:  Unsupported operand types in /home/e-smith/files/ibays/serviio/html/lib/serviio.php on line 88
Dec 12 10:54:33 sme8 httpd: PHP Fatal error:  Unsupported operand types in /home/e-smith/files/ibays/serviio/html/lib/serviio.php on line 88
Dec 12 10:54:36 sme8 httpd: PHP Warning:  Invalid argument supplied for foreach() in /home/e-smith/files/ibays/serviio/html/view/presentation.php on line 10
Dec 12 10:54:36 sme8 httpd: PHP Warning:  Invalid argument supplied for foreach() in /home/e-smith/files/ibays/serviio/html/view/presentation.php on line 53
Dec 12 10:54:37 sme8 httpd: PHP Warning:  file_exists() [<a href='function.file-exists'>function.file-exists</a>]: open_basedir restriction in effect. File(/) is not within the allowed path(s): (/home/e-smith/files/ibays/serviio/html/:/tmp) in /home/e-smith/files/ibays/serviio/html/tree/jquery_folder_tree/jquery.foldertree.php on line 18
Dec 12 10:54:38 sme8 httpd: PHP Fatal error:  Unsupported operand types in /home/e-smith/files/ibays/serviio/html/lib/serviio.php on line 88
Dec 12 10:54:38 sme8 httpd: PHP Warning:  Invalid argument supplied for foreach() in /home/e-smith/files/ibays/serviio/html/view/metadata.php on line 27
Dec 12 10:54:38 sme8 httpd: PHP Warning:  Invalid argument supplied for foreach() in /home/e-smith/files/ibays/serviio/html/view/metadata.php on line 37
Dec 12 10:54:38 sme8 httpd: PHP Warning:  Invalid argument supplied for foreach() in /home/e-smith/files/ibays/serviio/html/view/library.php on line 28
Dec 12 10:54:38 sme8 httpd: PHP Warning:  Invalid argument supplied for foreach() in /home/e-smith/files/ibays/serviio/html/view/library.php on line 75
Dec 12 10:54:38 sme8 httpd: PHP Warning:  file_exists() [<a href='function.file-exists'>function.file-exists</a>]: open_basedir restriction in effect. File(/) is not within the allowed path(s): (/home/e-smith/files/ibays/serviio/html/:/tmp) in /home/e-smith/files/ibays/serviio/html/tree/jquery_folder_tree/jquery.foldertree.php on line 18
Dec 12 10:54:39 sme8 httpd: PHP Warning:  Invalid argument supplied for foreach() in /home/e-smith/files/ibays/serviio/html/view/status.php on line 37
Dec 12 10:54:39 sme8 httpd: PHP Warning:  Invalid argument supplied for foreach() in /home/e-smith/files/ibays/serviio/html/view/status.php on line 64
Dec 12 10:54:43 sme8 httpd: PHP Fatal error:  Unsupported operand types in /home/e-smith/files/ibays/serviio/html/lib/serviio.php on line 88
Dec 12 10:55:18 sme8 last message repeated 7 times
Dec 12 10:56:23 sme8 last message repeated 13 times
Dec 12 10:57:28 sme8 last message repeated 13 times
Dec 12 10:57:34 sme8 httpd: PHP Warning:  Invalid argument supplied for foreach() in /home/e-smith/files/ibays/serviio/html/lib/serviio.php on line 73
Dec 12 10:58:26 sme8 httpd: PHP Warning:  file_exists() [<a href='function.file-exists'>function.file-exists</a>]: open_basedir restriction in effect. File(/) is not within the allowed path(s): (/home/e-smith/files/ibays/serviio/html/:/tmp) in /home/e-smith/files/ibays/serviio/html/tree/jquery_folder_tree/jquery.foldertree.php on line 18
Dec 12 10:59:55 sme8 httpd: PHP Fatal error:  Unsupported operand types in /home/e-smith/files/ibays/serviio/html/lib/serviio.php on line 88
Dec 12 11:00:30 sme8 last message repeated 7 times
Dec 12 11:01:16 sme8 last message repeated 8 times

if i start the the "serviio-wrapper.sh" the webui works i can save my preferences. media files are added and i´ve got an status server running. BUT i can´t see the server on my devices.

if i start regular the script stops, i didn´t come back to the console, but the webui works.

with
Code: [Select]
bash -vf serviio-wrapper.sh i got an error an the script stops:

Code: [Select]
bash -vf /opt/serviio/bin/serviio-wrapper.sh
#!/bin/sh
### ======================================================================
##
##  Serviio WebUI start Script.
##
### ======================================================================
DIRNAME=`dirname $0`
dirname $0
PROGNAME=`basename $0`
basename $0

# OS specific support (must be 'true' or 'false').
cygwin=false; darwin=false; linux=false;
case "`uname`" in
    CYGWIN*) cygwin=false ;;
    Darwin*) darwin=false ;;
    Linux)   linux=true ;;
esac
uname

# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
    [ -n "$SERVIIO_HOME" ] &&
        SERVIIO_HOME=`cygpath --unix "$SERVIIO_HOME"`
    [ -n "$JAVA_HOME" ] &&
        JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi

# Setup SERVIIO_HOME
if [ "x$SERVIIO_HOME" = "x" ]; then
    # get the full path (without any relative bits)
    SERVIIO_HOME=`cd $DIRNAME/..; pwd`
fi
cd $DIRNAME/..; pwd
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_CLASSPATH="$SERVIIO_HOME/config"
LIB=${SERVIIO_HOME}/plugins
for jar in `ls -1 ${LIB}/*.jar`; do SERVIIO_CLASSPATH="${SERVIIO_CLASSPATH}:${ja                                                                                                                                                             r}"; done
ls -1 ${LIB}/*.jar
ls: /opt/serviio/plugins/*.jar: Datei oder Verzeichnis nicht gefunden
LIB=${SERVIIO_HOME}/lib
for jar in `ls -1 ${LIB}/*.jar`; do SERVIIO_CLASSPATH="${SERVIIO_CLASSPATH}:${ja                                                                                                                                                             r}"; done
ls -1 ${LIB}/*.jar
ls: /opt/serviio/lib/*.jar: Datei oder Verzeichnis nicht gefunden

# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
    SERVIIO_HOME=`cygpath --path --windows "$SERVIIO_HOME"`
    JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
    SERVIIO_CLASSPATH=`cygpath --path --windows "$SERVIIO_CLASSPATH"`
fi

# Find best max heap size (from Patters' http://pcloadletter.co.uk/2012/01/25/se                                                                                                                                                             rviio-syno-package/)
JAVA_MAX_HEAP=384M
RAM=$(grep "MemTotal" /proc/meminfo | awk '{print $2/1024}')
grep "MemTotal" /proc/meminfo | awk '{print $2/1024}'
if [ $RAM -le 128 ]; then
    JAVA_MAX_HEAP=80M
elif [ $RAM -le 256 ]; then
    JAVA_MAX_HEAP=192M
fi
/opt/serviio/bin/serviio-wrapper.sh: line 59: [: 2009,33: integer expression exp                                                                                                                                                             ected
/opt/serviio/bin/serviio-wrapper.sh: line 61: [: 2009,33: integer expression exp                                                                                                                                                             ected

# Execute the JVM in the foreground
JAVA_OPTS="-Djava.net.preferIPv4Stack=true -Djava.awt.headless=true -Dfile.encod                                                                                                                                                             ing=UTF-8 -Dserviio.home=$SERVIIO_HOME -Dderby.system.home=$SERVIIO_HOME/library                                                                                                                                                             "
JVM_OPTS="-Xms20M -Xmx${JAVA_MAX_HEAP} -XX:+UseParNewGC -XX:MinHeapFreeRatio=10                                                                                                                                                              -XX:MaxHeapFreeRatio=20"
"$JAVA" $JVM_OPTS $JAVA_OPTS -classpath "$SERVIIO_CLASSPATH" org.serviio.restui.                                                                                                                                                             ServiioWrapper "$@"
Exception in thread "main" java.lang.NoClassDefFoundError: org/serviio/restui/Se                                                                                                                                                             rviioWrapper
Caused by: java.lang.ClassNotFoundException: org.serviio.restui.ServiioWrapper
        at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: org.serviio.restui.ServiioWrapper. Program will e                                                                                                                                                             xit.

wich things have to be changed from the howto by using the ajax webUI?
ps: i don´t have an android phone, then i need the webinterface.

thank you very much.


Offline go_jesse

  • *
  • 2
  • +0/-0
Re: Serviio DLNA server
« Reply #12 on: January 03, 2013, 04:27:32 AM »
the howto worked great for me. Thanks!!!

As a followup, I upgraded to 1.1 servio and it works fine with original webui (but complains about mismatch)

I am investigating webui update.

Offline WayneJVM

  • *
  • 22
  • +0/-0
Re: Serviio DLNA server
« Reply #13 on: January 27, 2013, 01:24:50 AM »
I have tried upgrading to 1.1 and found that my DLNA players would no longer work and neither would the Flowplayer. Was there anything different about the install?

Offline Drifting

  • ****
  • 431
  • +0/-0
Re: Serviio DLNA server
« Reply #14 on: February 11, 2013, 11:58:01 AM »
I feel all rather confused by this installation.

I have followed the howto, but have the porblems discussed in the forum with parser and missmatch in the webui. So what versions do I need to get this working? The link at the bottom of the forum tread just goes to the webui version.

Regards P
Infamy, Infamy, they all have it in for me!