I have recently been experimenting with running MiniDLNA on a headless Ubuntu Server and have hit a few snags. After a lot of search and a few pointers from this and other forums I have finally managed to get it running fine. In case anyone else has this problem I have written this guide to hopefully take some of the pain out of installing and configuring an amazing program.


The Hardware

My server is a headless HP Microserver running Ubuntu 10.04.3 LTS 64 bit edition accessed through Putty and Webmin (www.webmin.com). I have also tried this using a virtual setup using Virtual Box and that also worked fine.

As a receiver, I am using an LG HX806SH Blu-ray player connected to my LAN by a Homeplug adapter. I have also tried using Windows Media Player and they both work fine. I would like to try this with VLC to test it on a Linux desktop but configuring VLC to receive streaming media from a server is beyond me right now.


The Server Setup

The server has a standard headless setup including Samba installed (a combination of Windows and Linux machines share files stored on it). If you need any help installing and using Webmin, I suggest you have a look at the excellent guide at http://www.kelvinwong.ca/2010/05/22/...-04-lts-lucid/.


Installing and Configuring MiniDLNA

For some reason, when I tried to install MiniDLNA, through Putty I received error messages. From reading around, it turns out that this is a common problem as some repositories are missing.

In the end, these commands installed the package:

Code:
sudo apt-get install --reinstall python-software-properties && sudo dpkg-reconfigure python-software-properties

sudo add-apt-repository ppa:stedy6/stedy-minidna
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install minidlna
I would also recommend installing the Webmin MiniDLNA module from https://sourceforge.net/projects/minidlnawebmin/

If you are accessing the server through Webmin and are not sure how to install the module, save it to a local location (such as your desktop on your computer). Select the "Webmin Configuration" module which is under the "Webmin" tab. Select the "Webmin Modules" and choose to load the module “From uploaded file". Once the module has been installed it will be automatically be configured and it will be available under the "Servers" tab.

Once this is installed, you need to configure the MiniDLNA conf file located at /etc/minidlna.conf.

You can use your favourite text editor or if you are accessing this through Webmin, you can use the "Edit" option in "File Manager". If you have installed the Webmin module, you can also change all of the settings from there.

My minidlna.conf file reads as follows:

Code:
# port for HTTP (descriptions, SOAP, media transfer) traffic
port=8200

# network interface to bind to (this is the only interface that will serve files)
#network_interface=eth0

# 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)

media_dir=V,/media/server/server/Media/Films
media_dir=V,/media/server/server/Media/TV
media_dir=V,/media/server/server/Media/Commedy
media_dir=V,/media/server/server/Music/Videos
media_dir=A,/media/server/server/Music/Music
media_dir=P,/media/server/server/Stuff/Pictures

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

# set this if you would like to specify the directory where you want MiniDLNA to store its database and album art cache
db_dir=/media/server/server/Backup/Server/MiniDLNA

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

# 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 ("/")
album_art_names=Front.jpg/front.jpg/Cover.jpg/cover.jpg/AlbumArtSmall.jpg/albumartsmall.jpg/AlbumArt.jpg/albumart.jpg/Album.jpg/album.jpg/Folder.jpg/folder.jpg/Thumb.jpg/thumb.jpg

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

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

# 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.
strict_dlna=no

# default presentation url is http address on port 80
presentation_url=http://minidlna/index.php

# notify interval in seconds. default is 895 seconds.
notify_interval=895

# serial and model number the daemon will report to clients
# in its XML description
serial=12345678
model_number=1
As you can see, I've made a few changes to the standard file:

  • I have added various sources of videos
  • I have changed the name of the server so I can recognise it easily on the network
  • I have moved the location of the database to a location that I backup each day and is shared by Samba (this is for my personal benefit only)
  • I have added extra filenames to the "AlbulmArt" section as I usually call the front cover of an album "Front"

Despite the line “# default presentation url is http address on port 80” MiniDLNA does not have a webpage that it can be controlled from. From what I can gather, this was going to be a future feature that was not completed for whatever reason. However, the Webmin module takes care of everything that you need.

From the "Command Shell" in Webmin or through an SSH session using Putty, you can control MiniDLNA using the commands:

Code:
sudo /etc/init.d/minidlna stop
sudo /etc/init.d/minidlna start
At first run, MiniDLNA will scan all of the folders (and their sub-folders) it has been pointed at and make all of these files available. The scan is extremely quick (less than 10 minutes to scan about 12,000 files).

The Webmin module has a "Restart" button but for some reason (on my set-ups) it does not work properly. It will stop MiniDLNA but when it tries to restart it, it fails. Trying to manually start it using the command "sudo /etc/init.d/minidlna start" after using this "Restart" does not seem to work and the only way I have found to resolve this is to restart the whole server.


Adding or Removing Files of Folders from the Database

In my experience, MiniDLNA tends not to notice if a file has been added or removed from the folders so the database does not update and new files are not shown on your device and old files are still shown even though they have been removed. This seems to be a problem with MiniDLNA and not the receiving soft/hardware. If you change the name of the server, the soft/hardware picks that up fine.

Some people have had success with the command:

Code:
minidlna -R
or by removing the file /tmp/minidlna/files.db and restarting the server using the command:

Code:
rm -rf /tmp/minidlna
Someone else suggested using the command:

Code:
minidlna -R -f /tmp/minidlna.conf
However, I have found the easiest and most successful method is to use the "Rescan" button in the Webmin interface. This button deletes the MiniDLNA database and rescans from scratch. On my system, this new scan took less than 10 minutes to scan about 12,000 files. After the scan, any new files appear in the database and any deleted files are removed.


Outstanding Problems

The only thing I have not been able to get MiniDLNA to do so far is display my photos properly on the Blu-ray player even though they display fine on Windows Media Player. On the Blu-ray, it shows all of the folders where my pictures are stored and even gives me the option to search by camera but when I try to view the pictures or look into the folders, the folders are all empty. This suggests it is something to do with the Blu-ray player and not MiniDLNA however, to be honest this is not an issue for me as my main aim was to stream videos and music and it works perfectly for that.

If anyone can point me to a walkthrough of how to receive streamed videos and music on VLC I would be grateful so I can test this set-up on that and add it to this guide.

I hope you find this guide useful and it takes away some of the headaches I've had with setting up this excellent program.