Sunday, February 4, 2018

The Mobile Plex Media Server - Local Streaming on the Go

The mobile Plex Server powered by Pi! The best mobile media streaming solution for those long family road trips. Who cares if your kids have the capacity-starved 16GB hand-me-down phones and tablets from 2012 - this untethered setup allows you to broadcast your Plex Library from literally anywhere.

Purpose
To wirelessly stream movies to devices while on the road, mitigating the need for high storage-capacity endpoints

Components
Raspberry Pi 3 Model B
160GB 2.5” USB HDD
8000mAh Lithium Ion Battery



How to build it
  1. Get yourself a RaspberryPi unit. Here I’m using the rPi 3 Model B. I also got an enclosure that has a CPU fan - figured this would be handy during those hot summer road trips.
  2. Install Raspbian. Here I’m using Raspbian Stretch Lite (2017-11-29 build) 
  3. Ensure the Pi is connected to the network via Ethernet for the next several steps
  4. Configure a static IP. For the Stretch build, you need to configure this using dhcpcd.conf, not /etc/network/interfaces as mentioned here 
  5. Install Plex Media Server. These instructions are for an older Raspberry Pi build (Jessie) but it is still relevant for the Stretch build used in this post
  6. Ensure you can connect to Plex using the static IP you configured, I.e., 192.168.x.x:32400/web/ Don’t mess with adding your Libraries - we’ll do that later
  7. Configure hostapd and dnsmasq. This is what allows you to have the Pi broadcast a wireless signal, authenticate your endpoints, and hand out DHCP addresses. The best option I’ve found for getting this done is this fantastic little script. As of this writing, the script states to use the 2017 August Stretch Pi image, but I can confirm it works great with my November Stretch build. Huge shoutout to GitHub user Lewiscowles1986.
    1. See the owner’s process for running the script in his github comment here
  8. After rebooting, UNplug your Ethernet cable and give the Pi another reboot - from a wireless device, ensure you see the SSID you configured using the script. Connect to it
  9. Once connected, launch the Plex Client app and ensure it connects to the media server. 
  10. If you successfully connect to the server, all you need to do is load your external storage device with content, then add the Libraries to Plex (The Plex Install guide from above walks you through this). If at all possible, format your external drive to EXT4 for maximum compatibility with the Raspbian.
  11. Once the drive is loaded with content, plug the drive into the Pi
    1. Type sudo blkid and find your drive. Most likely, it will be /dev/sda1 or /dev/sda2
    2. Create a mount point for the drive: sudo mkdir /mnt/library
    3. Change permissions: sudo chmod 755 /mnt/library 
    4. Mount the drive to your configured location: sudo mount -t ext4 /dev/sda1 /mnt/library
    5. Update fstab so the drive always mounts to this location: sudo vi /etc/fstab
      1. Add the following to the bottom of the file:  /dev/sda1 /mnt/library ext4 defaults 0 0
    6. Reboot
At this point, you should have a fully functional Plex Media Server on your Raspberry Pi. Here are some additional tips:

  • Remember your Pi must be unplugged from Ethernet in order for the Plex Media Server to function properly over your configured wlan0
  • This setup allows you to take your PMS with you anywhere, but if you intend to use a portable battery source, ensure it puts out enough power. Pi Documentation recommends 2.5 Amps - the one pictured in this post is 2.4 and works just fine
Share: