Setup a media center using Raspberry Pi
Raspberry Pi is a nifty and inexpensive single board computer which can be used in a lot of different ways. Let us use Pi to set up a media center so that we can access our movie and music collection from every device connected to the same wifi!
Let us start with a fresh installation.
Installing raspbian on raspberry pi
Grab the latest raspbian image from the official website. The normal version gets you raspbian with all the GUI installed, the lite version does not come with any GUI components preinstalled. Get the lite version.
After download, extract the compressed file to get the .img file. Download etcher and use it to burn the .img file to your pen drive. Now, since we are going to setup pi in a complete headless mode, we need to set up SSH beforehand. Setting up ssh is easy with raspbian, just open the boot partition of the raspbian install in your file manager and create an empty file named
In the next install, ssh will be enabled by default. The default username is
pi and the default password is
raspberry. Since we set up everything needed,
let’s connect pi to your laptop/router using an ethernet cable.
Look up the Pi’s IP address in the routers active client list somewhere in your routers admin panel. Now, login to pi using ssh
ssh pi@<ip address>
You will be greeted with a prompt from raspberry pi. Update your pi before use
sudo apt update && sudo apt upgrade
Now that pi is setup, next is to set up our Hard disk.
Setting up Hard disk
By default, pi tries to mount all drives. Since mine was formatted in NTFS, I
needed extra packages. To mount NTFS drives, install
sudo apt install ntfs-3g
Check if the hard disk is mounted using
sudo blkid. Usually, external storages will be mounted on sda1. To mount the disk create a mount dir to mount the drive, change permissions of that folder and mount the drive so that pi can access it.
# create dir sudo mkdir /mnt/volume # change permissions sudo mkdir /mnt/volume # Mount! sudo mount /dev/sda1 /mnt/volume
Change to /mnt/volume and verify. If it all goes well, we will configure pi to mount the drive on every boot. For this, we need to edit the fstab file.
# Backup sudo cp /etc/fstab /etc/fstab.backup # Open file in nano sudo nano /etc/fstab
and add the following line
/dev/sda1 /mnt/volume ntfs defaults 0 0
now reboot using
sudo reboot and upon reboot, verify if all is well.
Media center set-up
We are almost done! To achieve this, we need to start a UPnP/DLNA server, so that all devices on the same network can access the media. There are multiple ways to set this up. Two of the most popular ways to set this up is by using either miniDLNA(Open source) or using plex(closed source). The advantage of using plex is that you will have a beautiful web client and plex is in active development. So, let us quickly set up plex media server!
# Some pre-requisites sudo apt-get install apt-transport-https # Setup the repo for plex wget -O - https://dev2day.de/pms/dev2day-pms.gpg.key | sudo apt-key add - echo "deb https://dev2day.de/pms/ jessie main" | sudo tee /etc/apt/sources.list.d/pms.list # Update sytem for new software! sudo apt-get update # Install! sudo apt-get install -t jessie plexmediaserver # Final permission setup # Make plex run under our pi user sudo nano /etc/default/plexmediaserver.prev
In this file, go to the bottom-most line, search for
replace plex with pi. So, the edited line shall look as such
Now start the Plex media server!
sudo service plexmediaserver restart # Reboot and login back to start using! sudo reboot
Adding files to the media server
After reboot, open your browser and open <Pi’s IP>::32400/web/ to open plex. Create a plex account and add all your music and media to plex. After some time it will auto update all metadata about your libraries!
Access in other devices
Basically, what plex does is that it starts up a UPnP server. On Android, BubbleuPnP is the best app to play content from your server. Just open BubbleuPnP and click on the browse button and select raspberry pi. Now, you can access all your media right on your android phone!
You can do many more awesome things using Pi, check out the awesome PiHole Project which will run a DNS on your pi, If you use those DNS settings on your router, it filters out all ads on your network! This means that no ads on your phone, laptop and any other devices connected to your network!
Keep hacking! Cheers!