Results 1 to 10 of 53

Thread: Guide to Installing and Running MiniDLNA on an Ubuntu Server

Hybrid View

  1. #1
    Join Date
    Aug 2008
    Beans
    108

    Guide to Installing and Running MiniDLNA on an Ubuntu Server

    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.

  2. #2
    Join Date
    Oct 2007
    Location
    Lancashire, UK
    Beans
    41
    Distro
    Xubuntu 12.10 Quantal Quetzal

    Re: Guide to Installing and Running MiniDLNA on an Ubuntu Server

    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.
    To view the server on a Linux desktop, you can use Totem (IIRC it's the default media player on Ubuntu) with the Coherence plugin enabled.
    Coherence is a UPnP/DLNA controller which allows Totem to play the content served by miniDLNA.
    It's pretty easy to use - available UPnP and DLNA servers are displayed in the sidebar and media is browseable via the tree.

    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
    The problem of files not being added to the database without a rescan is due to Samba shares not creating an inotify event. The issue does not exist when other methods are used (e.g. NFS shares or local access). To save yourself a rescan for an individual file you can 'touch' the file from a terminal on the server (e.g. an ssh/putty session or your webmin terminal) which inotify will pick up, and therefore so will miniDLNA.

    e.g.
    Code:
    touch /media/server/server/films/S-T/Three_Musketeers.mpg
    Obviously, for a lot of files this can be more hassle than a rescan.
    I'm not certain, but to remove files from the DB it may be a case of 'touching' the parent folder.

    /Craig
    Last edited by craigchambers; October 24th, 2011 at 09:57 AM.

  3. #3
    Join Date
    Aug 2008
    Beans
    108

    Re: Guide to Installing and Running MiniDLNA on an Ubuntu Server

    Hi Craig,

    For some reason my version of Totem (which does indeed come as standard on Ubuntu 11.10 32 Bit) will not see the Coherence plugin. When I used the Ubuntu Software Centre and searched for Coherence, I was shown two options: the extra plugins for totem and UPnP Inspector. When they did not work, I removed both and tried to install Coherence using the command:
    Code:
    sudo apt-get install python-coherence
    This seemed to install coherence with the latest version but it still does not show up in Totem.

    The extras plugin appears to have other plugins but there is no mention of Coherence. I tried activating all of the plugins but this did not show me a DLNA option in the drop-down. There is a “Python Console” plugin. When this plugin is activated, there is a new menu item of “Python” which opens a console which appears to be very similar to a text editor. As I do not know anything about Python, I stayed well clear of that one.

    UPnP inspector will see the MiniDLNA server but I cannot find any way to get it to play the files it finds.

    Thanks for your advice. I tried to add a file using the "touch" command. Unfortunately this did not work. I think it may have something to do with the there being a space in the name. I tried the commands:

    touch /media/server/server/films/S-T/New Film.mpg
    and
    touch "/media/server/server/films/S-T/New Film.mpg"

    but neither worked.

    Thanks for the thought though.

    Damian

  4. #4
    Join Date
    May 2011
    Beans
    6

    Re: Guide to Installing and Running MiniDLNA on an Ubuntu Server

    Don't get caught out with minidlna apparently not starting automatically.........

    When you use apt-get to install minidlna on Ubuntu Server it installs the start and stop scripts in the /etc/rcN.d folders with the minidlna server starting almost immediately in the boot process. This is too early! Things like RAID partitions might not be ready to be probed by minidlna at this point, so you need to delay it to later..... read on.....

    I'm running 11.10 (oneiric) and got minidlna to start automatically upon booting, with the following instructions:

    sudo apt-get minidlna install
    edit minidlna.conf to point towards the path for your video/audio etc.

    sudo update-rc.d -f minidlna remove
    this removes the incorrectly numbered start up scripts.

    sudo update-rc.d minidna defaults 99 01
    creates new start up scripts which will start near the end of the boot process

    All is now good in the world......

  5. #5
    Join Date
    Sep 2009
    Beans
    9

    Unhappy Re: Guide to Installing and Running MiniDLNA on an Ubuntu Server

    Thank you for your very concise guide to minidlna.
    I needed a dlna server to connect my Raidsonic MB3011 to my Philips TV.
    So I mounted the NAS to my Ubuntu Box and stream it with minidlna.
    As the MB3011 is not always on I disabled autostart and everything works fine.
    A strange thing I noticed is that the default database location is in /tmp and not in /var/cache as the config file suggests.
    Thus I uncommented the database line to get the database into the place where it should go.
    Strange enough the server log file gets then into that location too.
    As minidlna does not install a logrotate script it might be necessary to add it manually to /etc/logrotate.d if log files grow large.
    BTW: I have app. 500 videos and no music on my NAS and building the database takes about 2 hours so I do not regard this as fast ;-( I guess this has to do with the Wifi connection I have to my NAS and I further guess that the file size matters at scanning.
    As a result to my setup it can be very annoying to get new movies into the database if the auto recognition of new movies does not work properly.
    Update:
    After re-starting the service I found that the database was going to be rebuilt from scratch.
    This means that whenever I start minidlna to stream something I need to wait for 2 hours before the database gets ready.
    This is a no go, so I uninstalled minidlna.as it seems to be useless to me in its current state
    Last edited by latimerio; November 17th, 2011 at 03:19 PM. Reason: formatting issue

  6. #6
    Join Date
    Oct 2008
    Location
    Indiana
    Beans
    27

    Lightbulb Re: Guide to Installing and Running MiniDLNA on an Ubuntu Server

    Quote Originally Posted by latimerio View Post
    Thank you for your very concise guide to minidlna.
    I needed a dlna server to connect my Raidsonic MB3011 to my Philips TV.
    So I mounted the NAS to my Ubuntu Box and stream it with minidlna.
    As the MB3011 is not always on I disabled autostart and everything works fine.
    A strange thing I noticed is that the default database location is in /tmp and not in /var/cache as the config file suggests.
    Thus I uncommented the database line to get the database into the place where it should go.
    Strange enough the server log file gets then into that location too.
    As minidlna does not install a logrotate script it might be necessary to add it manually to /etc/logrotate.d if log files grow large.
    BTW: I have app. 500 videos and no music on my NAS and building the database takes about 2 hours so I do not regard this as fast ;-( I guess this has to do with the Wifi connection I have to my NAS and I further guess that the file size matters at scanning.
    As a result to my setup it can be very annoying to get new movies into the database if the auto recognition of new movies does not work properly.
    Update:
    After re-starting the service I found that the database was going to be rebuilt from scratch.
    This means that whenever I start minidlna to stream something I need to wait for 2 hours before the database gets ready.
    This is a no go, so I uninstalled minidlna.as it seems to be useless to me in its current state
    FUPPES is quite a bit faster (from most other streamers), and the documentation has improved tremendously. I haven't had any issues downloading and compiling the latest version (691 IIRC) from the repos.

    http://fuppes.ulrich-voelkel.de/wiki...itle=Main_Page

  7. #7
    Join Date
    Sep 2013
    Beans
    2

    Re: Guide to Installing and Running MiniDLNA on an Ubuntu Server

    Quote Originally Posted by sloopjonb View Post
    Don't get caught out with minidlna apparently not starting automatically.........

    When you use apt-get to install minidlna on Ubuntu Server it installs the start and stop scripts in the /etc/rcN.d folders with the minidlna server starting almost immediately in the boot process. This is too early! Things like RAID partitions might not be ready to be probed by minidlna at this point, so you need to delay it to later..... read on.....

    I'm running 11.10 (oneiric) and got minidlna to start automatically upon booting, with the following instructions:



    edit minidlna.conf to point towards the path for your video/audio etc.


    this removes the incorrectly numbered start up scripts.


    creates new start up scripts which will start near the end of the boot process

    All is now good in the world......

    All would be good if there wasn't a tiny, tiny typo in your code...

    The last code snippet should read
    Code:
    sudo update-rc.d minidlna defaults 99 01

    Great guide, by the way. Just need to fix my CRON jobs to re-run the scan at midnight and I'll be done.

    Savcom

  8. #8
    Join Date
    Sep 2013
    Beans
    2

    Re: Guide to Installing and Running MiniDLNA on an Ubuntu Server

    Quote Originally Posted by Martin_Davies View Post
    Just need to fix my CRON jobs to re-run the scan at midnight and I'll be done.
    Well it took a while, but if you want to automatically re-scan the media on your system then you should:

    • Choose or set up a user with a valid login account (don't use minidlna as it does not have a shell in which to run Cron tasks)
    • Under that user's Crontab enter the Cron task

    Code:
    #
    # Sudo command at 04:00 and 16:00 every day to re-scan the media directories for miniDLNA
    0 04,16 * * * minidlna -R -f /etc/minidlna.conf > /dev/null
    #
    • Make sure that /etc/default/minidlna is set up with that username and group too.

    Code:
    # User and group the daemon should run as
    USER="martin"
    GROUP="martin"

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •