; Date: October 14, 2017
Among video/media servers for the home, Plex is perhaps the most popular. It is supplied using a Freemium model, where the basic service is free, and you pay for extended features. Client apps for mobile computers are available, as well. The idea is to store a video archive on one computer, accessing the videos from anywhere on your home network either via a web browser or a mobile device app. With a little extra work you can additionally access your video library from anywhere, so long as your home network is available 24/7 on a relatively fast Internet connection.
The simplest way to install Plex is by using Docker. A few simple commands, assuming your computer already has Docker, and Plex is up and running with no muss, no fuss.
Docker is a cross-platform (runs on Windows, Mac OS X, Linux, and even on Raspberry Pi) system for containerizing applications. What that means is anyone can create a "container" for a given application, using it for themselves, or distributing it for others to use. See https://www.docker.com/ for more information. For example, installing the Apache and MySQL containers lets you easily set up a LAMP stack for PHP/MySQL application development.
For the following we'll assume you already have Docker installed. If not, perhaps the following will give you a taste of Docker's usefulness, and you'll be encouraged to use it yourself. While Docker was designed for huge scale cloud computing systems, it can also be used on a single computer on a home network, and can even be used on tiny single-board Linux computers like Raspberry Pi's.
Why not use Docker at home to simplify your home media library management?
Plex on a home NAS (Drobo) isn't quite satisfying
My first stab at running Plex at home was the bundled Plex instance available for Drobo. I have a Drobo 5N, the Network-Attached-Storage (NAS) version of the Drobo. Drobo's are highly reliable file servers. The Drobo 5N supports running "DroboApps" which are packaged server applications that can run ON the Drobo. Drobo supports various open source applications, such as the OwnCloud file server. The list includes Plex, and I have a large video library I'd like to have better organized.
I installed Plex, and at first was happy having my videos available via web browser. Then I started playing some of the videos and found many that could not be played from the Drobo. It turns out that when Plex transcodes video on the server it requires a hefty CPU, and the Drobo's CPU is pretty weak.
Plex on Intel NUC is pretty okay
I already had an Intel NUC which I'm using to run a Github-like service (using GOGS), a Jenkins build server, and a couple other services. Intel NUC's are low-power-consumption computers available as a small box that can be easily tucked into a corner. Despite being small, Intel NUC's package a lot of capability in a small box. I installed Ubuntu, and can do in my home anything for which I'd rent a virtual server from an internet hosting provider. I already had Docker installed on the NUC, and most of those services are installed/managed using Docker.
Now that it's set up, the results are pretty good. Most of my videos now play on every device. It seems that some videos do not play onto a Chromebook, but that may be due to Chromebook limitations.
Installing Plex using Docker
If you want to do so, first run this:
sudo docker pull linuxserver/plex
This pulls down the named Plex image. Information on this image is here: https://hub.docker.com/r/linuxserver/plex/
If you search the Docker Hub you'll find the Plex organization has an official Plex container (see
https://hub.docker.com/r/plexinc/pms-docker/). I found the documentation for their container to be confusing, while the documentation for
linuxserver/plex was straight-forward.
Here's what I did:
docker create \ --name=plex \ --net=host \ -e VERSION=latest \ -e PUID=1000 -e PGID=1000 \ -e TZ=America/Los_Angeles \ -v /home/david/plex/config:/config \ -v /home/drobo-david/Video/Movies:/data/Movies \ -v '/home/drobo-david/Video/Climate Change:/data/Climate Change' \ -v '/home/drobo-david/Video/Energy Systems:/data/Energy Systems' \ -v /home/drobo-david/Video/Politics:/data/Politics \ -v /home/drobo-david/Video/Terrorism:/data/Terrorism \ -v '/home/drobo-david/Video/TV Shows:/data/TV Shows' \ -v /home/david/plex/transcode:/transcode \ --restart=always \ linuxserver/plex
Take a look at the documentation page, and follow along as I describe each part of this.
--name option gives a useful name to the container. Otherwise Docker invents a screwball name for the container. With it named correctly you type
sudo docker start plex or
sudo docker stop plex to start or shut down the container.
--net=host option makes the container TCP ports automatically exposed as host ports. Another option is instead to use
-P 32400:32400 to expose the Plex port from the host computer. There is a wide range of options for configuring networking for a Docker image. This mode is the simplest and gets the job done quickly. If you want to be more precise about the network configuration of your Plex service, you might prefer the official build since it supports more options.
PGID settings help by running the Plex server with user ID and group ID values compatible with directory permissions on the host computer. In this case
1000 is the UID and GID of the
david account on the NUC.
TZ parameter is becuase I live in the Pacific USA timezone.
-v options map various directories from the NUC into the container. This way the Plex service can store or access files.
/config directory inside the container is where Plex stores its configuration data. I've mapped that to
/transcode is where Plex manages the transcoding of data, and it's mapped to
The other directories, under
/data, is where Plex looks to find video libraries. As the pathname implies (
/home/drobo-david), my video archive is on my Drobo. I've arranged for the NUC to have an always-on mount of the Drobo every time the NUC starts. I did that by installing the
nfs DroboApp, and then configuring it to export a couple of the Drobo share's as NFS partitions, and then configuring Ubuntu on the NUC to automount those NFS partitions. Trying to instead automount the default SMB/CIFS share from the Drobo was not reliable.
--restart=always this container will automatically restart everytime the host computer restarts.
The final option says which container to use.
Once the container is created, start it with:
sudo drobo start plex
Once started, give it a minute to get on its feet, then visit
Because this used
--net=host a web browser ON that host computer will be unable to access the service. But web browsers on other computers will have access.
The next step is setting up a Plex account. Pay careful attention as you do to avoid unwittingly being charged for their premium services -- unless, that is, you want to pay for those services. It's quite possible to make it through registering an account while paying nothing to the Plex corporation.
It is necessary to point out that using the Plex server requires having a Plex account. I find that a little troubling. I'm not entirely happy being required to register with Plex in order to use the software. I'd prefer a fully open source service where I just install it, and have no requirement to register with anyone else.
I haven't explored what all Plex offers, and there may be enough value to having registered with them that it's worthwhile.
The Plex Account is used from any mobile device and connects you to the Plex server you just set up.
After setting up the account, and logging into your Plex server, the next step is to set up video libraries. You already declared the location of those directories, but you haven't set them up in Plex.
In the main dashboard area of the Plex account, hover your mouse over the "Libraries" link in the left hand sidebar. A "+" indicator will show up, and you click that to start the process of setting up a Library. It's a Wizard-like interface where you first say what kind of media is stored in each library - Movies, TV Shows, etc. That seems to connect with automatically discovering metadata from online services, since Plex automatically pulls down information about video's you store in the library.
After you've added a directory, Plex will scan it to automatically discover and index the video files. Their online documentation has guidance on the directory hierarchy: https://support.plex.tv/hc/en-us/categories/200028098-Media-Preparation
Because the configuration, video, and transcoding data is stored outside the container, you can kill and recreate the container at any time. Suppose a new version of Plex comes out. Updating to the latest version is a matter of
sudo docker stop plex sudo docker rm plex
That much deletes the old container.
sudo docker pull linuxserver/plex docker create ...
Re-run the commands to recreate the container.
docker start plex
And then start the newly built container.