Raspberry Pi Media Server – MiniDLNA

Before post, I wrote to you about how I tried to install Gerbera on a Raspberry pi. Now let’s try to install minidlna. Let’s do it.

First, I recommend updating and upgrading your raspberry pi. You can do this by using the following commands:

sudo apt update 
sudo apt upgrade

Once this is finished we can install the media server software. Use the next command to do this.

sudo apt install minidlna

After you enter this command you will probably be asking if you want to continue. Just press y and then enter. Once that has finished installing it is time for the next step.

To start configuring MiniDLNA we need to edit the config file. This can be done by using this command:

sudo nano /etc/minidlna.conf

Once you have that file open we are going to need to change that part that looks like this:

# * “A” for audio (eg. media_dir=A,/var/lib/minidlna/music)
# * “P” for pictures (eg. media_dir=P,/var/lib/minidlna/pictures)
# * “V” for video (eg. media_dir=V,/var/lib/minidlna/videos)

to this:

media_dir=A,/media/HDD/Music
media_dir=P,/media/HDD/Pictures
media_dir=V,/media/HDD/Movies

and this:

# Name that the DLNA server presents to clients.
#friendly_name=

to this:

# Name that the DLNA server presents to clients.
friendly_name=RASPI MINIDLNA

and or modify this:

# Change db_dir so that the database is saved across reboots

db_dir=/home/pi/.minidlna

# Uncomment log_dir for now in case we hit problems

log_dir=/var/log

Now that we have configured MiniDLNA we have to refresh it. To do this you can run the following commands:

sudo service minidlna restart

Optional:
I want to mount external usb storage, need to install several pkg :

sudo apt install usbmount
sudo apt install ntfs-3g

If you having issues on raspberry pi with buster and USBMOUNT. If it’s not working by default. You need, create a configuration container directory /etc/systemd/system/systemd-udevd.service.d.

sudo mkdir /etc/systemd/system/systemd-udevd.service.d

Create an own confugration file (that will overwrite the package configuration). Change 00-my-custom-mountflags as you wish.

sudo nano -w /etc/systemd/system/systemd-udevd.service.d/00-my-custom-mountflags.conf

Enter the following configuration, which disables private mounts.

[Service]
PrivateMounts=no

Restart systemd and udev subprocesses (or simply reboot).

sudo systemctl daemon-reexec
sudo service systemd-udevd restart

This way usbmount will work again like expected, your configuration file is persisted and not silently replaced by an apt upgrade

Now if you hop back onto a windows computer or any Upnp compatible device you should be able to see your server. On window if you click on start then computer then on the left hand side click on network you should be able to see your raspberry pi Minidlna server under the media devices section.