Thursday, June 7, 2012

HowTo: Install and setup MiniDLNA on FreeBSD

MiniDLNA is a server software with the aim of being fully compliant with DLNA/UPnP-AV clients. MiniDLNA is used to serve multimedia files such as music, videos and picture to clients on a given network.

MiniDLNA employs Universal Plug and Play (UPnP) thus you can have clients such as TVs, consoles and smartphones.

In this post I'll describe the steps needed to install and configure it to run on FreeBSD, though the steps were performed on 7.4-RELEASE they'll work on more recent FreeBSD branches such as 8.x and 9.x.

Let's start by installing the net/minidlna port:
  1. # cd /usr/ports/net/minidlna
  2. # make config-recursive
  3. # make install clean

Having installed the port, it's time to edit the configuration file. As an example, I'll leave my own as reference. Make sure that you edit network_interface, media_dir and friendly_name.
  1. # vim /usr/local/etc/minidlna.conf

    # port for HTTP (descriptions, SOAP, media transfer) traffic

    # network interfaces to serve, comma delimited

    # set this to the directory you want scanned.
    # * if have multiple directories, you can have multiple media_dir= lines
    # * if you want to restrict a media_dir to a specific content type, you
    #   can prepend the type, followed by a comma, to the directory:
    #   + "A" for audio  (eg. media_dir=A,/home/jmaggard/Music)
    #   + "V" for video  (eg. media_dir=V,/home/jmaggard/Videos)
    #   + "P" for images (eg. media_dir=P,/home/jmaggard/Pictures)

    # set this if you want to customize the name that shows up on your clients
    friendly_name=FreeBSD DLNA Server

    # set this if you would like to specify the directory where you want MiniDLNA to store its database and album art cache

    # set this if you would like to specify the directory where you want MiniDLNA to store its log file

    # set this to change the verbosity of the information that is logged
    # each section can use a different level: off, fatal, error, warn, info, or debug

    # this should be a list of file names to check for when searching for album art
    # note: names should be delimited with a forward slash ("/")

    # set this to no to disable inotify monitoring to automatically discover new files
    # note: the default is yes

    # set this to yes to enable support for streaming .jpg and .mp3 files to a TiVo supporting HMO

    # set this to strictly adhere to DLNA standards.
    # * This will allow server-side downscaling of very large JPEG images,
    #   which may hurt JPEG serving performance on (at least) Sony DLNA products.

    # default presentation url is http address on port 80

    # notify interval in seconds. default is 895 seconds.

    # serial and model number the daemon will report to clients
    # in its XML description

    # specify the path to the MiniSSDPd socket

    # use different container as root of the tree
    # possible values:
    #   + "." - use standard container (this is the default)
    #   + "B" - "Browse Directory"
    #   + "M" - "Music"
    #   + "V" - "Video"
    #   + "P" - "Pictures"
    # if you specify "B" and client device is audio-only then "Music/Folders" will be used as root

To have MiniDLNA working properly the dlna user must be made owner of the /var/db/minidlna directory:
  1. # mkdir -p /var/db/minidlna
  2. # chown dlna:dlna /var/db/minidlna

To start using MiniDLNA immediately issue the following command:
  1. # /usr/local/etc/rc.d/minidlna onestart

If you want to have it start up automatically whenever FreeBSD boots, add it to /etc/rc.conf like so:
  1. # echo 'minidlna_enable="YES"' >> /etc/rc.conf

Finally MiniDLNA's log file can be monitored for errors:
  1. # tail -f /var/db/minidlna/minidlna.log

MiniDLNA it's quite simple and lightweight however it is missing features that can be found in more complete UPnP servers. Those operating on old hardware might find it very useful.

Be advised that if you're planning on sharing multimedia files over a local network composed mainly of desktops and laptops, NFS and Samba are more flexible filesharing alternatives. On the other hand, if you want to stream to a TV, console or smartphone then by all means go for an UPnP server like MiniDLNA or MediaTomb.

If you're using an Android smartphone have a look at the MediaHouse app. From my experience it works just fine with MiniDLNA.


dualcells said...

Thanks for the tips! This was exactly what I was looking for to pair with the Samba 3.6.7 server I installed recently.

Whatever video I encode with DivX Pro is dropped onto my server via a Samba share then served upto my PS3.

Anonymous said...

Please, suggest me the settings for samba and the rights to the folder:


tangram said...


That line was meant has an example of the type of media_dir argument.

If you're seeking help setting up Samba shares that's outside the scope of this HowTo.


KS said...


Anonymous said...


tangram said...

No problem. Glad to help.

skiesis said...

Thank you!!

Unknown said...

Just used your tutorial to set up a DLNA server on FreeBSD 10. Works great. Thanks for taking the time to write this up.

Unknown said...

Thanks for taking the time to write up this tutorial. I just used it to set up a DLNA server on FreeBSD 10. Worked great.