Raspberry Pi Home Server: Part 8, MiniDLNA Media Server

Article Obsolete

A new version of this series has been published. Please refer to the new index for updated articles and ordering. This article is kept for historical reference, but should be considered out of date.

Note: This article is part of a series. See the Index for more information.

Self-promotion: I’ve recorded this series as a screencast for Pluralsight:
If you have a Pluralsight subscription, please consider watching it. Thanks!

Updates: Substitute “jessie” for “wheezy” when adding apt-get sources. Other than that, everything remains the same under the Jessie release of Raspbian.

Now that the Raspberry Pi is on the network, and sitting on top of a (hopefully) massive pile of your media on its external drive, it would be nice to have it share that media in a form other than simple file shares. File shares are great for a lot of things, but Media can be done a little better.

DLNA (Digital Living Network Alliance… what a horrible acronym) is the technology standard that lets you play songs from your phone and have them come out of the stereo in your living room. It’s not ubiquitous yet, but it’s catching on. It also lets programs like Windows Media Player play music and video “libraries” that are being shared by other computers on the network.

The Raspberry Pi is about to become one of those libraries.

Installing MiniDLNA

This installation will be done from the command line, and involves a bit more configuration than some of the other features in this series. Get yourself logged in to a command line as “pi”, and start by installing MiniDLNA.

sudo apt-get install minidlna

As installs go, this one’s pretty quick, but there is a bit of configuration to be done before it’s ready to go. Start by editing the MiniDLNA defaults:

sudo nano /etc/default/minidlna

Find the line that says “#USER=”minidlna””, and remove the pound sign / hash mark from the beginning, so that if just says “USER=”minidlna””. Do the same for the “GROUP=” line right below it. Close and save the file (ctrl-x,y,enter).

Next, edit the main MiniDLNA configuration file.

sudo nano /etc/minidlna.conf

There are several things to be done here. The first is to set up the folders that will hold the various kinds of media you want shared. A little way down the file, find the first line that isn’t a comment. It should say something like “media_dir=/var/lib/minidlna”. On my drive, there are separate folders for Music, Pictures, and Videos, so I’ll add multiple media_dir lines, one for each kind of media. The comments in the file do a pretty good job explaining the syntax, but for reference, here’s what mine says:


The letters A, P, and V indicate what kind of content each folder contains (audio, pictures, or video). Next, change the database and log folders to go to the data partition as well. This will conserve space on the relatively small OS partition. The lines to configure this are just below the media_dir lines modified above. Remove the pound signs, and change the folder paths:


The result should look something like this:


Further down the file, uncomment the two settings “inotify” and “notify_interval”. This will allow MiniDLNA to update its database approximately every fifteen minutes with new or updated files.

Close and save the file (ctrl-x,y,enter). Next, you need to set up MiniDLNA to run automatically at boot time.

sudo update-rc.d minidlna defaults

And finally, manually start the MiniDLNA service.

sudo service minidlna start

MiniDLNA Web Administration

A Webmin module exists for MiniDLNA that will make it easier to manage things remotely in the future. It is available at http://sourceforge.net/projects/minidlnawebmin/files. Pick the latest version, and download the .wbm file to somewhere convenient. You could download this through a browser directly on the Raspberry Pi if you want, but I’ll write the directions for downloading it from your primary computer.

Once the .wbm file is downloaded, go to Webmin –> Webmin Configuration, and click on “Webmin Modules”. Pick “From uploaded file”, click the “Choose File” button, and browse to find the file you just saved. Click “Install Module”, and the MiniDLNA module will be installed.

You should now have an entry under Servers called “MiniDLNA server”. This module is pretty simple, and does little more than show you the settings from its configuration file. Down at the bottom of the page, though, are two buttons that you can use to restart the server, or force it to rescan its folders immediately.

Click on “Rescan” to force MiniDLNA to start indexing the files on the hard drive.

Warning: Depending on the size of your media collection, it may take the poor little Raspberry Pi quite a while to index everything (mine took almost two days). If you look at your CPU usage, you’ll see that it stays pretty much pegged for as long as it takes. Don’t worry, you haven’t reached the Pi’s limit, at least not permanently. When it has finished indexing, you’ll see its usage drop back to almost nothing.

You should now be able to open something like Windows Media Player, and see an entry for “RPHS: minidlna” in the list on the left. Drilling down into this entry will show you the media that has been indexed so far.


I am not a MiniDLNA expert, by any means, so you might want to look elsewhere for more configuration information. Also, MiniDLNA has recently changed names to become “ReadyMedia”, but a new release does not seem to be ready for use on the Raspberry Pi at the time I’m writing this.

What’s next?

In the next post, we’ll add a BitTorrent server for downloading things from the internet.

This entry was posted in Computers and Internet, Home Server, Raspberry Pi and tagged . Bookmark the permalink.

22 Responses to Raspberry Pi Home Server: Part 8, MiniDLNA Media Server

  1. Pingback: Raspberry Pi Home Server: Index | MelGrubb.ToBlog()

  2. Pingback: Raspberry Pi Home Server: Part 7, Sharing Files With Samba | MelGrubb.ToBlog()

  3. Paul says:

    Well, after a couple of evenings I have reached this page without any issues at all. As I have never touched code, I would just like to say thank you for making my first experience a delight. I have learnt a little, and grasped the basic concept enough to want to learn more.

  4. Pingback: Now this is what i really want!! | Dictator Dad's Words of Wisdom

  5. Success here also! (After a bit of tweaking file paths for my setup.)
    Assuming that the Pi Media Server is connected to my TV, and the Pi Hard disk (external) is connected to the Media Server, what best way to control the Media Server with a remote ? An app on my Android or Apple phone? A special remote? A wireless keyboard (I have one working, BTW)?

    • Mel Grubb says:

      I don’t have my media server hooked up to the TV. Mine lives screwed to a rafter in the basement near the cable modem and networking gear. I watch my stuff through my Blu-ray player which turns my TV into a kind of ersatz smart-tv. When I HAVE hooked up a Pi to the TV, mostly for running RetroPie, I just use a wireless keyboard. There are IR remote solutions out there, mostly involving some kind of USB “dongle”, but I haven’t personally tried any of them.

  6. First I would like to thankyou very much for these tutorials, its been awesome to put my Raspberry to work as never before. And see that it does a good job!
    But I had a little problem with minidlna scaning subfolders. For now I just tried with pictures. Anyway, this is what happens, if I have subfolders they are not shown at all, but if I move some pictures to the main pictures folder it is showed without any problem.
    I have been googling around but could no find a good answer. Only things like “I kept trying and it worked”…
    Any lead on what could it be?
    And Thanks again!

    • Mel Grubb says:

      The only thing that springs to mind is perhaps permissions? Did you build the server following the blog, using ntfs as the file system, etc? Using ext4 brings Linux permissions into the mix, and perhaps the permissions didn’t get applied recursively to the sub folders. ________________________________

      • Yes, the file system is ntfs and I’m using almost everything from this blog, the only difference is that I kept the OS on the card.
        I’will keep on trying because minidlna seems to be really good and would be perfect for my home. If you have any ideas I would be glad for the help.
        Anyway, thank you already.

      • Ok, this was a little unsettling. I found a blog last week, when I started with this problem, saying to delete the database and restart minidlna. I didn’t try it then, but today I did and it just started working.
        And that is it.
        Ok, thank you again, and lets go for the transmission configuration.

      • Mel Grubb says:

        That IS weird. Not something I probably would have tried, certainly. I’m hoping to get Plex Media Server set up and documented as an alternative for those with Pi2s. ________________________________

  7. Hi! Would you be so kind as to provide the original minidlna.conf ? I believe I messed mine up. I’ve uninstalled it, and reinstalled minidlna, but it doesn’t put a new conf file! 😦 Thank 🙂

    • Mel Grubb says:

      I can, but I can’t exactly put it in the comments. Is there an email address that’s good? Also, try uninstalling with the purge option, that’s supposed to clear out any configs so you can start over.

  8. zacchaeus says:

    In case it would be of help to anyone following the guides in future, I managed to take this one a step further by making my music collection available externally over the internet.

    My understanding (which may well be wrong) is that dlna/upnp won’t work through a vpn connection, so an alternative approach was needed. I found the solution of installing bubbleupnp server on the Pi and the accompanying (and modestly paid-for) Bubbleupnp app on my Android devices. Instructions are easily found via Google. (There may be alternative, possibly free, solutions to this, but this works for me.)

    Now I can impose my musical tastes on all my friends in their own homes!

    (NB, the bubbleupnp server requires java jdk to be installed on the Pi – follow the instructions on the Crashplan page of this series to get it up and running.)

    • Mel Grubb says:

      I tried OwnCloud for this, but was unhappy with the performance, so I never added it to the blog. I may try again with a Pi2 and see if it’s any better. ________________________________

  9. Rick H says:

    Starting to use the MiniDLNA as a media server on my home network. Setup/install works fine, thanks to your great instructions.
    I have noticed that the media server seems to time out (sleep?) during movie playback. The Roku box (which I use to view movies via the Roku media player) seems to lose connection to the MiniDLNA. Not sure if it is a timeout on the wi-fi adapter, or a sleep mode on the video output (I am aware that the Pi itself doesn’t have a ‘sleep’ mode).
    Could it be a ‘sleep’ mode on the WiFi adapter? Is there a way to to disable that?

    • Mel Grubb says:

      That would depend on the adapter, in suppose. I use mine primarily for sharing music, so I haven’t run into this problem before. It could also be the drive falling asleep, but usually they wake back up when needed, but I wouldn’t expect that to happen in the middle of streaming something since its being actively used at that time. Remote in to your server, run the “top” command, and see whether any one particular process has “run away” on you. That might provide a clue. (Q to quit)

  10. Rick H says:

    WiFi adapter is Edimax, commonly used, as far as I know. I suspect that the same issue might affect other brands, though.

  11. Sam A. says:

    Hello! I’ve used your tutorials and works like a charm on my RPi 2B except minidlna. It works actually like boots up and shows up on my tv but the folders are not there. It shows some made up folders and subfolders rather than showing my actual ones. I’ve tried uninstalling and installing with different folder structures but the outcome is still the same. Do you have any idea why that happens or better tried Plex if it works flawlessly?

    • Mel Grubb says:

      That’s just how DLNA servers work. They want to know where your media is, and the folder structure CAN be important (especially to Plex), but they are not going to simply reproduce that file structure on the output side. If you want to see your folders exactly how you created them, then you’re just looking for a simple file share, which is handled by Samba. DLNA is meant to support other media devices, most of which may have seriously constrained user interfaces. A DLNA server catalogs your stuff and presents it in a way that is appropriate for these kinds of devices to consume. As for Plex; yes it works on the Raspberry Pi, but it’s going to behave exactly the same way as MiniDLNA does in this case. It’s going to present the media in the same digested format.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s