Easily installing Plex with Docker - easiest home media server

By: (plus.google.com) +David Herron; Date: October 14, 2017

Tags: Plex

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 (www.docker.com) 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: (hub.docker.com) 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 (hub.docker.com) 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 \

Take a look at the documentation page, and follow along as I describe each part of this.

The --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.

The --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.

The PUID and 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.

The TZ parameter is becuase I live in the Pacific USA timezone.

The -v options map various directories from the NUC into the container. This way the Plex service can store or access files.

The /config directory inside the container is where Plex stores its configuration data. I've mapped that to /home/david/plex/config. Likewise /transcode is where Plex manages the transcoding of data, and it's mapped to /home/david/plex/transcode.

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.

With --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 http://IP-OF-SERVER:32400

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.

Configuring Plex

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: (support.plex.tv) https://support.plex.tv/hc/en-us/categories/200028098-Media-Preparation

Updating Plex

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.

« Why doesn't Amazon's Kindle allow reading EPUB files? Google starting to purge free Google Apps for Domain accounts? »
2016 Election Acer C720 Ad block AkashaCMS Amazon Amazon Kindle Amazon Web Services America Amiga and Jon Pertwee Android Anti-Fascism AntiVirus Software Apple Apple Hardware History Apple iPhone Apple iPhone Hardware April 1st Arduino ARM Compilation Artificial Intelligence Astronomy Astrophotography Asynchronous Programming Authoritarianism Automated Social Posting AWS DynamoDB AWS Lambda Ayo.JS Bells Law Big Brother Big Data Big Finish Big Science Bitcoin Mining Black Holes Blade Runner Blockchain Blogger Blogging Books Botnets Cassette Tapes Cellphones China China Manufacturing Christopher Eccleston Chrome Chrome Apps Chromebook Chromebox ChromeOS CIA CitiCards Citizen Journalism Civil Liberties Clinton Cluster Computing Command Line Tools Comment Systems Computer Accessories Computer Hardware Computer Repair Computers Conservatives Cross Compilation Crouton Cryptocurrency Curiosity Rover Currencies Cyber Security Cybermen Cybersecurity Daleks Darth Vader Data backup Data Formats Data Storage Database Database Backup Databases David Tenant DDoS Botnet Department of Defense Department of Justice Detect Adblocker Developers Editors Digital Photography Diskless Booting Disqus DIY DIY Repair DNP3 Do it yourself Docker Docker MAMP Docker Swarm Doctor Who Doctor Who Paradox Doctor Who Review Drobo Drupal Drupal Themes DVD E-Books E-Readers Early Computers Election Hacks Electric Bicycles Electric Vehicles Electron Eliminating Jobs for Human Emdebian Encabulators Energy Efficiency Enterprise Node EPUB ESP8266 Ethical Curation Eurovision Event Driven Asynchronous Express Face Recognition Facebook Fake News Fedora VirtualBox Fifth Doctor File transfer without iTunes FireFly Flash Flickr Fraud Freedom of Speech Front-end Development G Suite Gallifrey git Github GitKraken Gitlab GMAIL Google Google Chrome Google Gnome Google+ Government Spying Great Britain Green Transportation Hate Speech Heat Loss Hibernate Hoax Science Home Automation HTTP Security HTTPS Human ID I2C Protocol Image Analysis Image Conversion Image Processing ImageMagick In-memory Computing InfluxDB Infrared Thermometers Insulation Internet Internet Advertising Internet Law Internet of Things Internet Policy Internet Privacy iOS Devices iPad iPhone iPhone hacking Iron Man iShowU Audio Capture iTunes Janet Fielding Java JavaFX JavaScript JavaScript Injection JDBC John Simms Journalism Joyent Kaspersky Labs Kext Kindle Kindle Marketplace Large Hadron Collider Lets Encrypt LibreOffice Linux Linux Hints Linux Single Board Computers Logging Mac Mini Mac OS Mac OS X Machine Learning Machine Readable ID macOS macOS High Sierra macOS Kext MacOS X setup Make Money Online March For Our Lives MariaDB Mars Mass Violence Matt Lucas MEADS Anti-Missile Mercurial MERN Stack Michele Gomez Micro Apartments Microsoft Military AI Military Hardware Minification Minimized CSS Minimized HTML Minimized JavaScript Missy Mobile Applications Mobile Computers MODBUS Mondas Monetary System MongoDB Mongoose Monty Python MQTT Music Player Music Streaming MySQL NanoPi Nardole NASA Net Neutrality Network Attached Storage Node Web Development Node.js Node.js Database Node.js Performance Node.js Testing Node.JS Web Development Node.x North Korea npm NVIDIA NY Times Online advertising Online Community Online Fraud Online Journalism Online Photography Online Video Open Media Vault Open Source Open Source and Patents Open Source Governance Open Source Licenses Open Source Software OpenAPI OpenJDK OpenVPN Palmtop PDA Patrick Troughton Paywalls Personal Flight Peter Capaldi Peter Davison Phishing Photography PHP Plex Plex Media Server Political Protest Politics Postal Service Power Control President Trump Privacy Production use Public Violence Raspberry Pi Raspberry Pi 3 Raspberry Pi Zero ReactJS Recaptcha Recycling Refurbished Computers Remote Desktop Removable Storage Republicans Retro Computing Retro-Technology Reviews RFID Rich Internet Applications Right to Repair River Song Robotics Robots Rocket Ships RSS News Readers rsync Russia Russia Troll Factory Russian Hacking Rust SCADA Scheme Science Fiction SD Cards Search Engine Ranking Season 1 Season 10 Season 11 Security Security Cameras Server-side JavaScript Serverless Framework Servers Shell Scripts Silence Simsimi Skype SmugMug Social Media Social Media Networks Social Media Warfare Social Network Management Social Networks Software Development Software Patents Space Flight Space Ship Reuse Space Ships SpaceX Spear Phishing Spring Spring Boot Spy Satellites SQLite3 SSD Drives SSD upgrade SSH SSH Key SSL Stand For Truth Strange Parts Swagger Synchronizing Files Tegan Jovanka Telescopes Terrorism The Cybermen The Daleks The Master Time-Series Database Tom Baker Torchwood Total Information Awareness Trump Trump Administration Trump Campaign Twitter Ubuntu Udemy UDOO US Department of Defense Virtual Private Networks VirtualBox VLC VNC VOIP Vue.js Walmart Weapons Systems Web Applications Web Developer Resources Web Development Web Development Tools Web Marketing Webpack Website Advertising Weeping Angels WhatsApp William Hartnell Window Insulation Windows Windows Alternatives Wordpress World Wide Web Yahoo YouTube YouTube Monetization