The following tutorial will show you how to install and configure miniDLNA server on your ESPRESSObin, followed by how to connect to that server via DLNA client (in this tutorial we used Kodi).
Installing miniDLNA
Firstly we must install miniDLNA. Edit /etc/apt/sources.list and uncomment the following source:
root@localhost:~# vim /etc/apt/sources.list # once in editor, uncomment the following deb http://httpredir.debian.org/debian jessie main contrib non-free
after which update sources and install minidlna package:
root@localhost:~# apt-get update root@localhost:~# apt-get install minidlna
After minidlna package has been installed, you can comment above source again so it will not cause conflicts when following other tutorials.
Configuring miniDLNA
miniDLNA configuration is located in /etc/minidlna.conf configuration file. You can make a backup of the default configuration with:
root@localhost:~# mv /etc/minidlna.conf /etc/minidlna.conf.bak
and create a new configuration file with:
root@localhost:~# vim /etc/minidlna.conf
In this file we add the necessary configuration:
#Network interface to be used (bridge interface in our case) network_interface=br0 #Directory where your media is located. miniDLNA enables you to restrict media #'type' by directories (A - audio, P - pictures, V - video) so we will make #directories for each media type later on media_dir=A,/media/minidlna/Music media_dir=P,/media/minidlna/Pictures media_dir=V,/media/minidlna/Videos #Name under which name your DLNA server will show to clients. This is optional. friendly_name=ESPRESSObin_dlna #Also insert (or uncomment) the following two lines db_dir=/var/cache/minidlna log_dir=/var/log #Set to 'no' to consume less resources and require a restart for new media inotify=yes # Set IP of the device presentation_url=http://192.168.22.1:8200
What we need to do now is to make the afore-defined directories which will contain the files we want to stream. Note that you can make those directories anywhere on your machine, but you have to make the appropriate changes in /etc/minidlna.conf and, depending where you have made those directories, change folder permissions. So, create the directories with:
root@localhost:~# mkdir /media/minidlna root@localhost:~# mkdir /media/minidlna/Pictures root@localhost:~# mkdir /media/minidlna/Videos root@localhost:~# mkdir /media/minidlna/Music
and transfer files you want to stream into their respective folders (images to Pictures/, music to Music/, video files to Videos/) otherwise they will not be read since we have configured miniDLNA to restrict media type by directories. Of course, you can leave out those options and just have everything in one folder if you want.
Now restart miniDLNA with (issue this restart on every config change):
root@localhost:~# service minidlna restart
and reload the database with:
root@localhost:~# service minidlna force-reload
On your local laptop/computer you can now open the browser and enter the URL you have defined in miniDLNA config before. We enter the IP address of our bridged interface (br0 in our case): http://192.168.22.1 followed by the 8200 port we have defined before in /etc/minidlna.conf). You should get a screen displaying miniDLNA status:
If all went well, the screen will show the contents of your library and connected clients, which means your miniDLNA server is up and running.
DLNA client
The only thing left to do is to launch your favourite DLNA client, connect to your ESPRESSObin DLNA server and start streaming. For example, we will show how to connect with Kodi.
When Kodi is started, make sure to head to Settings -> Services -> UPnP/DLNA and enable UPnP/DLNA client:
Now to connect to our miniDLNA streaming server we select, say, Music -> Files and there we select Add music:
In the popup we select Add music again and select Browse and then UPnP devices:
There you should find the ESPRESSObin DLNA server (depending on how you named it in /etc/minidlna.conf):
Run miniDLNA at startup
For miniDLNA to automatically start when ESPRESSObin reboots, simply issue:
root@localhost:~# update-rc.d minidlna defaults
or if this gives you the following error:
root@localhost:~# update-rc.d minidlna defaults System start/stop links for /etc/init.d/minidlna already exist.
you must use the enable option:
root@localhost:~# update-rc.d minidlna enable ... Enabling system startup links for /etc/init.d/minidlna ... Removing any system startup links for /etc/init.d/minidlna ... /etc/rc0.d/K20minidlna /etc/rc1.d/K20minidlna /etc/rc2.d/S20minidlna /etc/rc3.d/S20minidlna /etc/rc4.d/S20minidlna /etc/rc5.d/S20minidlna /etc/rc6.d/K20minidlna Adding system startup for /etc/init.d/minidlna ... /etc/rc0.d/K20minidlna -> ../init.d/minidlna /etc/rc1.d/K20minidlna -> ../init.d/minidlna /etc/rc6.d/K20minidlna -> ../init.d/minidlna /etc/rc2.d/S20minidlna -> ../init.d/minidlna /etc/rc3.d/S20minidlna -> ../init.d/minidlna /etc/rc4.d/S20minidlna -> ../init.d/minidlna /etc/rc5.d/S20minidlna -> ../init.d/minidlna
That is it, miniDLNA should now start automatically on every reboot.