Changes

From SME Server
Jump to navigationJump to search
5,662 bytes added ,  16:47, 12 October 2012
First edition of this howTo
Introduction:
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.
<br>
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.

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

Now run this on shell:
<pre>
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
</pre>

And now the encoding tools:

<pre>
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
</pre>

And finally the Serviio :
<pre>
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
</pre>


cd /var/service/serviio


Now create a new file '''run'''
vi /var/service/serviio/run

containing

<pre>
#!/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 "$@"
</pre>

Now we'll create a new file named '''run'''
cd /var/service/serviio/log
vi /var/service/serviio/log/run

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

Now the configurations to make all those work:

<pre>
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
</pre>

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

and '''change''' the logfile location to<br>
<param name="File" value="/var/log/serviio/serviio.log" />

Make a masq template fragment to allow multicast on the internal interface
<pre>
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
</pre>

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

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

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
<pre>
# 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
</pre>
Expand the template and restart services
<pre>
expand-template /etc/rc.d/init.d/masq
service masq restart
service serviio start
</pre>
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. <br>
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
147

edits

Navigation menu