[HOW-TO] DLNA home server with Linux

[HOW-TO] DLNA home server with Linux

December 19, 2012 10:59 4 comments
92 Kudos

A quick disclaimer: This guide contains references on how to install and configure miniDLNA in the Gentoo/Linux environment. Still, the majority of the suggestions and all the settings are meant to be distro-agnostic.

We just bought the Samsung UE46ES8000 LED TV and I wanted to share all the music and videos I have on my home server with the TV.
I spent a whole day to figure out what program should I’ve been using and I tried a couple of alternatives. I came up with the conclusion that MiniDLNA is probably the best solution for me.

I tried other DLNA servers, as said, such as MediaTomb and uShare (which is now unmaintained) but both of them weren’t working as I expected.

I had few problems with MiniDLNA, that is why I decided to write this quick how-to.
First step is to install (or rather, compile and install) miniDLNA and all its dependencies. I decided to go and unmask the latest version of the ebuild on the Gentoo system (currently, version 1.0.25-r1) since I found that some bugs have been fixed in this release.

Once installed, the configuration is pretty straightforward. There are two files: /etc/conf.d/minidlna and /etc/minidlna.conf.
The former deals only with the settings for the init file. Make sure you use the correct username/group. This is very important since the daemon will be launched as it was executed by this user, therefore all the files you want to share must be readable by that user/group. My suggestion is to use the user/group combination that the ebuild creates for you (minidlna/minidlna). Make sure you check the permission and the ownership of all the files you want to share.

The latter file deals with the settings of the application itself. My advices are:

  • media_dir: I don’t think there is nothing to say about this attribute. If you want to share two different folders, then create two media_dir entries. These are going to be the folder that miniDLNA will expose to the network;
  • db_dir and log_dir: the same “privileges reasoning” applies for these two entries. The application must be able to read and write in these paths. For what concerns the log_dir, I would suggest you to create the file as root (touch /var/log/minidlna.log) and then to change its attributes;
  • log_level: by default this should be set to warn. If you are running miniDLNA for the first time, I strongly encourage you to use debug so to have a more verbose log file to investigate if something goes wrong;
  • notify_interval: this is rather tricky. This interval deals with the multicast of miniDLNA of its presence over the network. By default this is set to 15 minutes (60*15=900). What happens is the following: suppose you turn on your TV and you want to watch a movie. If the broadcasting frequency is set to 15 minutes, your TV won’t present to you the server until a SSDP notify is sent to the network. The same applies if some error occurs. Suppose you want to watch a movie but your permissions are wrong. miniDLNA won’t be able to access it and, therefore, the TV will say “oh sorry but something bad has happened”. Since the Samsung firmware sucks, the DLNA server entry will be removed from the list but the server (miniDLNA) will still be kept running! What happens is that you have to wait the 15 minutes loop cycle to hit. I changed this setting to 60 seconds: it won’t flood the network and you will still be able to access your server within a reasonable time.

Some formats are not available (I guess flac audio files, mkv video format, …) since miniDLNA is not capable of transcoding at the time being.

  • Ben

    for your information, I use both ps3mediaserver and serviio on my Linux box. Both function fine. But I find serviio is quicker listing folders  so i stick with it 

    • Do you also have a Samsung TV? Because sometimes it does not work with me. AllShare Play cannot open the file but if I turn off and back on the TV, it starts working again.

      I can’t figure out what the problem is!

      • I managed to solve the problem by updating the Samsung TV firmware to the latest release. It seemed to be a TV-software issue; nothing to do with Serviio/miniDLNA :)

  • You’re so awesome! I do not believe I’ve truly read anything like this before.
    So good to find another person with some unique thoughts on this topic.
    Seriously.. thank you for starting this up.
    This site is one thing that is needed on the
    web, someone with a bit of originality!