From ArchWiki
Revision as of 20:40, 5 June 2012 by Gen2ly (talk | contribs) (Configuration)
Jump to: navigation, search

This template has only maintenance purposes. For linking to local translations please use interlanguage links, see Help:i18n#Interlanguage links.

Local languages: Català – Dansk – English – Español – Esperanto – Hrvatski – Indonesia – Italiano – Lietuviškai – Magyar – Nederlands – Norsk Bokmål – Polski – Português – Slovenský – Česky – Ελληνικά – Български – Русский – Српски – Українська – עברית – العربية – ไทย – 日本語 – 正體中文 – 简体中文 – 한국어

External languages (all articles in these languages should be moved to the external wiki): Deutsch – Français – Română – Suomi – Svenska – Tiếng Việt – Türkçe – فارسی

MiniDLNA is server software with the aim of being fully compliant with DLNA/UPnP clients. The MiniDNLA daemon serves media files (music, pictures, and video) to clients on a network. Example clients include applications such as totem and xbmc, and devices such as portable media players, Smartphones, Televisions, and gaming systems.

MiniDLNA is a simple, lightweight alternative to MediaTomb, but has fewer features. It does not have a web interface for administration and must be configured by editing a text file.


Install minidlna from the official repositories.


The MiniDLNA daemon can be run as either a global (config:/etc/minidlna.conf) or per-user instance (config:user-defined), these are the necessary common settings:

#network_interface=eth0         # Self-discovers if commented (at times necessary to set)
media_dir=A,/home/user/Music    # Use A, P, and V to restrict media 'type' in directory
friendly_name=Media Server      # Optional
db_dir=/var/cache/minidlna      # Needs to be un-commented
log_dir=/var/log                # Needs to be un-commented
inotify=yes                     # 'no' for less resources, restart required for new media


While not necessary, it is a good idea to also enable MiniDLNA's cache (so the database and album art cache do not need to be re-created on every restart) and logging capabilities. MiniDLNA runs as the nobody user, so any directory you include will need to be readable by this user. To do so, create the necessary directories and chown them to nobody:nobody.

# mkdir /var/{cache,log}/minidlna
# chown nobody:nobody /var/{cache,log}/minidlna

MiniDLNA includes an initscript to start it as a global daemon. Be sure to add it to rc.conf to have it loaded at boot.


Create the necessary files and directories locally and edit the configuration:

# mkdir -p ~/.minidlna/cache
# cd ~/.minidlna
# cp /etc/minidlna.conf ~
# $EDITOR minidlna.conf

Configure as you would globally above but these definitions need to be defined locally:


This is a local daemon script to start and stop MiniDLNA as a regular user:

# Start and stop the MiniDLNA daemon


# Required program(s)
for p in ${req_progs[@]}; do
  hash "$p" 2>&- || \
  { echo >&2 " Required program \"$p\" not installed."; exit 1; }

dmn_strt () {
  # -R will rebuild file database on start (inotify only works when monitoring)
  minidlna -R -f "$cnf" -P "$pid" > $log 2>&1 &

dmn_stop  () {
  if [ "$(pidof minidlna)" ]; then
    killall -9 minidlna && sleep 2 && \
    echo " Stopped MiniDLNA daemon"
    echo " MiniDLNA is not running"

case $1 in
  start   ) # Start daemon
            dmn_strt || { echo " Failure in starting daemon"; exit; }
            echo " Started MiniDLNA daemon" ;;
  stop    ) # Stop daemon
            dmn_stop ;;
  *       ) # Display usage if no parameters given
            echo " ${0##*/} <start|stop> - start and stop the MiniDLNA daemon"

Load daemon on Login

A .desktop file in ~/.config/autostart will do this:

[Desktop Entry]
Comment=Server to stream media over network
Exec=/home/$USER/.scripts/minidlna-daemon start

Make the file executable:

# chmod +x ~/.config/autostart/minidlna.desktop

inotify limits

When MiniDLNA is run as a regular user it does not have the ability to change the kernel's inotify settings these settings will need to added manually. The default number of inotify watches is non-sufficient to have MiniDLNA monitor media file properly, to increase inotify watches do it through sysctl (100000 should be enough for most uses):

# sudo sysctl fs.inotify.max_user_watches=100000

To have it permanently added add to /etc/sysctl.conf

# Increase inotify max watchs per user for local minidlna
fs.inotify.max_user_watches = 100000"

Other details

Additional details that may need to be considered.


If using a firewall the the ssdp (1900/udp) and trivnet1 (8200/tcp) ports will need to be opened. For example, this can be done with arno's iptables firewall by editing firewall.conf and opening the ports by doing:


DLNA device file recognition

Some devices do not probe or rescan on a consistent basis or at all. If files get add/subtracted to monitored media directories they may not be noticed until the device DLNA client is restarted.