Running media server from Raspberry Pi

When you would like to use my Raspberry pi as much as possible instead of by special purpose devices then using it as file server combined with media server will be a great use case. Here I will explain how to setup your raspberry Pi as a media server in your network so that you can stream content from all your devices such as TV and mobile phone wirelessly. I am going to use miniDLNA server for this.

Why miniDLNA?

Raspberry Pi got less resources so it make sense to use a very lightweight media server as long as it satisfies all your requirement. For example if you run Plex then you cannot use the Raspberry Pi to run to different services at the same time. Indeed I tried to use Plex first then switched to miniDLNA as I am using the Pi for many services including my home hosted website. Fun fact: Yes you are reading this website also served from my home Raspberry Pi.

How to setup?

I am using debian based OS in my Pi, I hope most of you will be using the same and here goes the instructions.

#Update all the packages
sudo apt-get update
sudo apt-get upgrade --assume-yes
sudo apt-get autoremove
sudo apt-get autoclean

# Update configuration files for miniDLNA, 
# here is where you map the drives for Video, Audio and Photos. V for # Video, A for Audio/Music and P for Photos
sudo mkdir /var/log/minidlna
echo "friendly_name=My Media" | sudo tee -a /etc/minidlna.conf
echo "log_dir=/var/log/minidlna" | sudo tee -a /etc/minidlna.conf
echo "media_dir=V,/media/MySSD/Movies" | sudo tee -a /etc/minidlna.conf
echo "media_dir=A,/media/MySSD/Music" | sudo tee -a /etc/minidlna.conf
echo "media_dir=P,/media/MySSD/My Photos" | sudo tee -a /etc/minidlna.conf

# and Restart the media server
sudo systemctl restart minidlna.service

Now you can wait until the content is indexed then can view the medias from TV or from an app in mobile which supports media streaming. I use Hi-Fi Cast from my android phone.

miniDLNA automatically index all the contents. For some reason if the indexing is stopped you can use the following command to recreating a fresh index.

minidlna -R

Hope you enjoyed reading my post. Please comment or share if you like this post. Also I am happy to answer your questions in the comments.

Leave a Comment