Raspberry Pi is a capable mini-device for learning and in my case, it also works as a media server.
Setting up a media server is simple, the more complex part of the process is arranging your media files in a way that makes sense to you. This was the case for me. It took me about more than 3 hours to arrange the media files, when it only took me about 30 minutes to get minidlna up and running.
Get the media drive ready.
So first things first, make sure that you have your media storage mounted and ready to use. I have a 1 TB Seagate GoFlex FreeAgent Desk storage connected and mounted on my Raspberry Pi. Even though the drive is already powered by a separate power supply, I plugged its USB on a powered USB hub. It just helps me sleep at night.
To get started, you need the UUID of your device:
$ sudo blkid
In the output of the command above, look for your storage device and take note of the value of UUID.
RPi does not come with NTFS support pre-installed, so we need apt-get to install NTFS support for my drive:
$ sudo apt-get install ntfs-3g
And create the mount point:
$ sudo mkdir /mnt/GoFlex
After you have the UUID of your device and the ntfs-3g package installed, you can edit your fstab. My GoFlex drive is configured to mount at boot time so I have the following line in my fstab:
UUID=76AE49F1-D79D-6FAF-B2FC-B806785F5721A /mnt/GoFlex ntfs-3g defaults 0 0
Run mount command to test:
$ sudo mount -a
If all goes well, you should have your media drive accessible by doing:
$ ls -l /mnt/GoFlex
This part is so easy. Just run the apt-get command. That’s it.
sudo apt-get install minidlna
Answer yes if it asks. Done.
Your minidlna installation includes a config file named /etc/minidlna.conf. I want you to back the original file in case you need it.
$ sudo cp /etc/minidlna.conf /etc/minidlna.conf.$(date +%F)
After the backup, configure the minidlna.conf file:
$ sudo vi /etc/minidlna.conf
… and change the following lines:
# Change the Media Dir's to point to the external hard drive, obviously change these to match your directory layout
# Change db_dir so that the database is saved across reboots
# Uncomment log_dir for now in case we hit problems
Almost there. Start the minidlna service:
$ sudo /etc/init.d/minidlna start
Tada! You now have a DLNA service ready for use with your DLNA-capable device, such as a Samsung SMART TV UA40EH5300.
Don’t forget to enable minidlna at startup:
$ sudo update-rc.d minidlna defaults
Although minidlna is a super lightweight and capable DLNA media server, it annoys me when it comes to updating the database. First, you need to to force-reload the service to update the database; and second, minidlna disconnects every time it detects a new media in any of the media directories defined in minidlna.conf.
I have no known way (yet) to address the first issue, but for the constant disconnection every time minidlna tries to update the media database when new media is found, I have disabled the inotify option in minidlna.conf:
The bad aftertaste of this is I have to force-reload minidlna after adding new media:
$ sudo /etc/init.d/minidlna force-reload
Aside from that, minidlna works for me.
Let me know if you run into an issue or a bug or something, and I will try to help you out.