Plex Media Server on Edison -Weekend Hack

I wanted to be able to simply turn on my TV, console, or computer and connect to my local media library (music, TV, and movies) without hassle and without buying new equipment.

I had an Intel Edison (similar to a Raspberry Pi or Arduino) that I didn’t have a need for so I decided to see how well that would do as a home media server.

A great service that is stable, mature, and free for running a media server is Plex.

Replacing Edison’s OS with a Plex-compatible Version

To run Plex on Edison I needed to get Debian Linux running instead of Yocto (the OS the board comes with). Installing a new OS completely clears storage and formats the board. A Debian distribution that works well on Edison is Ubilinux, a Debian version of Linux. This Sparkfun tutorial makes it easy to install:

I set up Wifi on the box and ssh so that I could easily ssh in to manage the board.

Getting Plex onto Edison

Once Ubilinux was installed I installed Plex following these commands:

Restarting Plex after Reboot

Note: after Plex was installed from the commands in the link above, I tried restarting the board to see if Plex would start automatically. It didn’t so I manually added a bash script and registered it to run automatically to start Plex. Here’s a good post on how to do that:

Accessing Plex Web Interface

With Plex installed and running I was able to access the server from my web browser on my laptop. I ran ifconfig to get the local IP address of the Edison board (192.168.x.x), and then visited that IP with the following address on my laptop’s web browser: http://192.168.x.x:32400/web/. From there I followed the on-screen instructions to set up.

Mounting Storage with Media Files

With all of that done, I switched my Edison’s USB host switch so that the larger USB port started functioning and plugged in a 512GB flash drive containing my library. The flash drive is exFAT formatted, a format that Ubilinux can read and write to. Once plugged in I mounted the drive to a local folder. I added this mounting step as the first step of my startup script that starts Plex media server as well. This ensures that the drive will be there with the media and the server’s files (see note below) when Plex starts.

Important: It took me 2 tries to get my Edison working. The first time, after I had set everything up, Plex downloaded so much metadata to the Edison that it completely filled the small amount of storage space on the board. After clearing the metadata everything got messed up and reinstalling wasn’t enough so I had to flash the Ubilinux OS again before restarting. To avoid this happening to you: after you install and run Plex, shut it down completely (close any Plex processes so you’re sure it’s not running). Then move the Plex folder from /var/lib/plexmediaserver on the Edison to a folder on your flash drive. Then link the folder on the flash drive to where you moved it from: ln /mnt/e/plexmediaserver /var/lib/plexmediaserver. Now Plex will save all of its data to your flash drive instead of the Edison board and you won’t run out of space.

Add Media Libraries

With all of this done it was time for the home stretch: opening the Plex server web page on my laptop once more and adding the libraries from my flash drive (navigating to the locally mounted folder on the Edison to find them). As part of this process I re-organized my files so they fit Plex’s media structure better so metadata would be downloaded correctly.

Finally, Connecting and Watching Media

Now that the server was all set up all I had to do was enter the server’s IP address into my Plex apps on my laptops, phones, and consoles. There’s a bit of lag between when videos are selected to play and they start playing but other than that it operates just fine. The startup script makes it resilient to restarts and so far the IP address hasn’t changed so I haven’t had to redo any connections.

Bonus: Managing Media Library from Laptop

Lastly, as a bonus I wanted to be able to easily manage my flash drive’s library without unplugging it from the Edison or ssh’ing in or using scp. I found this post which introduced me to Samba:

With Samba I was able to mount the folder on my Edison where the media is mounted to my laptops and easily manage the folder just like normal. With that done, I could put the Edison into a box and stick it on a shelf.

I’ve been using the Edison-based server for a few weeks and only had to restart it once when it wasn’t responding. Very happy with how this hack ended up.