Wednesday, February 17, 2016

Installing Serviio DLNA Media streaming onto a Linux box.

Check what you are installing at the Serviio site. Typically you will be installing an evaluated pro version that will automatically fall back to the free version after a certain period. I have found that in my case the free version is quite satisfactory for my needs.

So what's the point??? 


  • Helps greatly to avoid wasting valuable storage space being replicated on many devices and all over the place in your home. 
  • Media files such as video, music, pictures etc will all be available to be played directly from the server from multiple devices and initiated independent of other individuals accessing the content.
  • Move all your physical media such as DVD's CD's etc to a single drive and regain shelf space.
  • Still play your content without physically wearing out your physical devices. A simple scratch can easily render a DVD useless!
  • Backup physical media types. DVD's CD's etc
  • etc..

One of the reasons I choose Serviio is that it's able to transcode video formats on the fly to devices that can't ordinarily play them by default but in particular for me video files of type *.MTS.

I'm running Linux Mint Mate. Will probably work on many other distributions.

First thing I notice on the Serviio website is that it states that linux users will need to install Java 8. It's probably safe to say to just go get the latest Java version. By the time you read this the java version may well have progressed!

Since I have coded in Java several times before and needed Java, I'm going to go with a method I've used many times before regarding installing Java.

Often Linux comes bundled with OpenJdk. We're going to remove this and install the official release from Oracle.

Install Java first
NOTE: These steps are pasted from my own personal logs for Java 7update7. Change accordingly to satisfy Serviio installation. I'm going with the latest Java version. At time of writing I'm downloading jdk-8u73-linux-x64.tar.gz. You probably want the 32bit version if your OS is a 32bit installation.

For Serviio, the following probably sets you up for more than you actually need. If your using Java for other purposes especially building your own software for Android, Desktop etc etc then I'd just go with everything... At least you wont have a half-baked installation!

Get a terminal

Check your java version with
java -version

If your java version is OpenJDK then you need to remove it.
Remove OpenJDK with the following...
sudo apt-get purge openjdk-\*


Now if you check the version you're probably going to get an error. All good since it indicates that OpenJDK is now removed.

Download the latest jdk. In this example I downloaded jdk 7 update 17. Just save it any where at this point.
Now we create a folder to hold our new jdk with
sudo mkdir -p /usr/local/java

Extract your jdk by going to the downloaded file where you saved it, double clicking it and then extracting it with the GUI tool.
A folder with the extracted jdk will be created.
Move this folder to the folder you made earlier. Example, move it to /usr/local/java

You'll probably need admin privileges to move to this location.
Using the command line tool, cd to the folder /usr/local/java and do a listing with
ls -a
You should see the jdk folder listed.

Now edit your system path file with (you might get errors related to recently used data, just ignore that part). Use the GUI tools instead if you like as you might find that gedit is not installed.
sudo gedit /etc/profile
REMEMBER! CHANGE WHAT YOU NEED IN THE FOLLOWING STEPS TO ACCOMMODATE THE JAVA VERSION YOU DOWNLOADED!

Put the following at the end of this file and save it then close it. 
JAVA_HOME=/usr/local/java/jdk1.7.0_17
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export JAVA_HOME
export PATH

Inform your Ubuntu Linux system where your Oracle Java JDK/JRE is located. This will tell the system that the new Oracle Java version is available for use.
This command notifies the system that Oracle Java JRE is available for use
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jdk1.7.0_17/bin/java" 1

This command notifies the system that Oracle Java JDK compiler is available for use
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/java/jdk1.7.0_17/bin/javac" 1

This command notifies the system that Oracle Java Web start is available for use
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/local/java/jdk1.7.0_17/bin/javaws" 1

Inform your Ubuntu Linux system that Oracle Java JDK/JRE must be the default Java.
This command will set the java runtime environment for the system
sudo update-alternatives --set java /usr/local/java/jdk1.7.0_17/bin/java

This command will set the javac compiler for the system
sudo update-alternatives --set javac /usr/local/java/jdk1.7.0_17/bin/javac

This command will set Java Web start for the system
sudo update-alternatives --set javaws /usr/local/java/jdk1.7.0_17/bin/javaws

Now reload your system wide path with
. /etc/profile

Now test your java version with
java -version

You should see something like this on the screen....
java version "1.7.0_17"
Java(TM) SE Runtime Environment (build 1.7.0_17-b21)
Java HotSpot(TM) Server VM (build 23.1-b03, mixed mode)


For good measure, reboot system and check again with the following...
java -version


Next we install FFmpeg as indicated at Serviio's website

We're going to use the Software manager within linux. install libav-tools. Read the summary of this package and check it includes ffmpeg. In my case it does!

Follow this wiki. I discovered the above solution was not letting Serviio index video files.

http://wiki.serviio.org/doku.php?id=build_ffmpeg_linux
20th Feb 2016 I can confirm that following the wiki got my *.MTS video indexing!!!! Follow instructions carefully! If *.MTS video files are being indexed then I'm sure others that are more common will! 
I can't remember what it was but I remember there is something in that wiki that gave you two options to achieve essentially the same thing. The option I chose actually failed so I just carried on with the alternative and all was fine!

Next: Install Serviio
Head over to the Serviio website and download the linux application. File name should end in gz. Using the linux GUI tools, extract the files to a single folder. Then cut and paste the folder to somewhere like /home/yourUsername/apps/

For me it's home/myName/apps/serviio-1.6 Look for the readme file which should tell you how to run, stop and open in browser.

A couple of years back I use to see the Serviio icon but these days I'm not. My guess is they have done away with the desktop app and now you configure etc from the web portal.

Here's a screen shot of what my browser is looking like.




Have a play. You'll need to to tell Serviio where all your media content is so it can present them in your DLNA clients around your home.


Look on your devices and try to find your content. 

If you have lots of files it can take some time for the content to eventually show on other devices for the first time. Several hours can be typical depending!

At the time I compiled these notes I actually performed the install and all is running perfectly. 

What I have not mentioned is this is actually installed and running in a virtualbox virtual machine and I'm pleasantly pleased to see that playback of media on all devices around the home is performing perfectly!

Good luck and enjoy!





No comments:

Post a Comment

Kotlin (Programming language)

Todo