How to install Serviio media server on Raspberry Pi


Install Serviio media service on Raspberry Pi


  • A Raspberry Pi with a working installation of Raspbian “Stretch”
  • Root privileges




  • # – requires given linux commands to be executed with root privileges either
    directly as a root user or by use of sudo command
  • $ – requires given linux commands to be executed as a regular non-privileged user


Serviio is media server written in java. It is available in two versions: the free one (unfortunately free as in beer), and the “pro” version, which comes with some additional features like remote access. In this tutorial we will cover the installation of Serviio on a Raspberry Pi running a minimal versions of Raspbian “Stretch”.

Installing dependencies

Serviio is written in java, therefore we must install the java development kit to be able to use it. There are two versions of the JDK in the Raspbian Stretch repositories: the open source version, released under the GPLv2 license, called OpenJDK, and the commercial, proprietary version from Oracle (the package is actually called oracle-java8-jdk). Both of them should work correctly, but in this tutorial we will use the former.

# apt-get update && apt-get install --no-install-recommends openjdk-8-jdk ffmpeg x264

Grab and install Serviio

Now that we have installed all the needed packages, we must grab the Serviio tarball: since we are working on a headless machine, we will used wget to accomplish the task. Therefore, we run:


After the download is finished, we can proceed to the actual Serviio installation. We are going to extract the content of the tarball inside the /opt directory: obviously you can choose another one, but /opt is conventionally used to host self-contained third party applications. Let’s proceed:

# tar -xvzf serviio-1.9-linux.tar.gz -C /opt

The -C option (short for --directory) instructs tar to change directory to the given one, before performing the operations.

Create the systemd service for Serviio

Now that Serviio is installed, you can observe that two scripts exists inside the /opt/serviio-1.9/bin directory: and The first one launches the server while the second the interface to control it.

At this point, we have all that we need to create the systemd service to launch serviio when the system boots. To accomplish this task, we must write a small service file. As you surely know, systemd is the new linux init system, now adopted by all the major distributions. It has been the source of many discussions in the open source community, but it has undoubtedly become the standard. To create the service, just fire up your favorite editor and create a file called serviio.service containing the text below:

Description=Serviio media Server

ExecStop=/opt/serviio-1.9/bin/ -stop


Describing the syntax of a systemd service file it’s not the purpose of this tutorial, but please notice the line containing the User=serviio instruction. What we want to obtain with it, is to specify that the daemon must run with the serviio user privileges and not as root, for security reasons. The serviio user doesn’t exist yet, so let’s create it and give it the ownership of the /opt/serviio-1.9 directory and all the files in it:

# useradd -r -U -s /sbin/nologin serviio && chown -R serviio:serviio /opt/serviio-1.9

You are probably familiar with the useradd command, but for the sake of clarity, let’s specify what the provided options are for. The -r option specifies that we want to create a system account. System accounts have no aging information and a uid with a value < 1000; for such accounts no home directory is created. The -U option will instruct the program to create also a group with the same name as the user, and automatically add the user to said group. Finally with -s, we specified the shell for the user. In this case we used /sbin/nologin which is a fake shell. We used it for security reasons: this way the user, the service is running as, will never be able to use an actual shell to run commands.

There we are: we have created the serviio user and written our service file. Now we must copy it into the /usr/systemd/system directory:

# cp serviio.service /etc/systemd/system

To enable the service we now run:

# systemctl enable serviio.service

Now, reboot the system: if all goes well, the serviio service will be already active when the boot process is completed. You can verify its status by running:

$ systemctl status serviio.service

Systemd will inform you about the status of the daemon, for example:

● serviio.service - Serviio media Server
   Loaded: loaded (/etc/systemd/system/serviio.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2017-09-28 21:29:18 CEST; 31s ago
 Main PID: 420 (java)
   CGroup: /system.slice/serviio.service
           └─420 java -Xmx512M -Xms20M -XX:+UseG1GC -XX:GCTimeRatio=1 -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20

As you can see the service is active and running, so all went as expected. If something goes wrong and there are problem launching the service, you can use the logs provided by the same command to resolve the issues.

If you are running a firewall on your machine you must also open ports 8895/tcp, 1900/udp, 23423/tcp and 23424/tcp. The last two ports are needed respectively to control the console and to access the mediabrowser

Control serviio

To control serviio, we have few options. Since we are running on a headless machine, we can’t access the graphical console, but we can access the web interface, by navigating to http://yourmachineip:23423/console/ from another machine in the same lan or use third party applications such as the android app “ServiiDroid”.

A complete list of possible options are available here:". If you are running the “pro” version of serviio you will also be able to explore your catalog by using the integrated mediabrowser accessible at http://yourmachineip:23424/mediabrowser/.