DIY Home Media Server

Create a simple home server

Sometimes there is no Internet connection in my area and since there is not much you could do at that time, I love to watch a movie and listen to my all times favorite music.

All the code is mentioned using $ ...... and you can run it in terminal

Equipment

  1. Raspberry Pi
  2. USB hard drive

Hardware configuration

If you have a new raspberry pi you may wish to Download and install OS in it.Download OS from the official link
To install just flash the OS to a memory card and attach it to raspberry pi.

Make a network connection

  1. wifi
  2. ethernet

Here you may want to have a fixed Local Network IP since this is what you will connect to for ssh and Plex server

Updating and Upgrading

$ sudo apt update && sudo apt upgrade

Optional

If you intent to use GUI in raspberry pi you can skip this step.
As we are using it as a server we can use remote access tool

  • Install an open-ssh server.

To startup CLI as system Boots up.

  • $ sudo raspi-config
  • Boot option
  • Desktop / CLI
  • choose Console
  • $ sudo reboot

Connecting Hdd as Raspberry pi boots up

You may need to pump up your USB port output for hdd to work.
  1. sudo nano /boot/config.txt
  2. > set max_usb_current=1
Make a permanent location where HDD will Connect.
  • $ mkdir /media/hd (if using NTFS drive install ntfs-3g)
To mount, we will need UUID

Here we will use uuid or partuuid and mention it in /etc/fstab, and when raspberry pi will boot it will auto-mount it to our desired location.

  • $ sudo blkid

  • get the UUID of your device

  • finally, add the device in the /etc/fstab
    --> make sure you have a backup in case you mess-up or something went wrong.

  • $ sudo nano /etc/fstab

  • attach your device using UUID or partuuid

  • sample file

PARTUUID=06568f1  /media/hd/ auto nofail,uid=1000,git=1000,umask=000 0 0

Plex Installation and configuration.

  • Download plex directly from Website

  • You will download a .deb file

  • To excute it

    • $sudo dpkg -i ./plexserver....deb
  • When installation is completed you may wish to reboot.

  • Now open a browser and head over to IP/web/index.html of your raspberry pi (in my case IP is 192.168.1.100)

    --> 192.168.1.100:32400/web/index.html

  • You will need to log in to plex to continue.

  • Adding library

    • Alt Text
    • select the media type
    • select the folderAdd folder
    • When you are done it will sync the resources and you are good to go.

Important

since like me you may want to watch content from Plex even when there is no internet connection

This should be done before you encounter "No Internet"

  1. settings Alt Text
  2. Server
  3. Network Alt Text
  4. enable local network discovery
  5. Click on Advance Settings
  6. list of IP addresses and Networks allowed without Auth. You can add specific IP's or you may go with something like '192.168.0.0/24'

Well,for syncing I am currently using tools like rsync. Have better options comment down.

Reference

9