Plex, the Docker & Ansible way! pt. 1 - Setting up Plex


Shortly before the holiday break, I was gifted an old Dell PowerEdge R210. I was told "It will make a great media server for your home!" I thought to myself, media servers are over done.. I should setup a test environment with it!

I brought the big guy home and broke it open to take a look. I found that the disk was 250GB... Not exactly big enough for a comfortable test environment, but it can do. However, it only had 4GB of RAM. My test idea was shot down!

You see, I had dreamed of it having enough RAM and free space to setup a hypervisor with a mixture of Windows and Linux VMs, as I deal with both at work. However, between there not enough RAM run more than 2 VMs at once and me not wanting to put some money into something that's not too powerful in the CPU realm, I installed Ubuntu on it.

Ubuntu to me is as good of a test as any, being a RHEL/CentOS guy (I started on Ubuntu, until they shoved Unity down my throat back in 2012...). Sure, I still played with Ubuntu/Debian based distros here and there, but I was not as fluent with it as I am CentOS.

My battle of Plex vs. Kodi

After getting Ubuntu installed, it sat there... my whole vacation. Now that I am off vacation, I have just started to pick back up on it -- to build a media server. Netflix is completely killing off Futurama, after they got rid of most of the seasons, and I cannot live without watching it all 4 or 5 times a year. So, I resolved to setup a media server and purchase the box set to play from the media server.

Another bonus from the media server is that I can take all of the DVDs that the kids got for Christmas and let the kids watch them -- as DVD players are all but gone out of this house.

Having some familiarity with Kodi, or enough to know that I can setup Samba and share out the videos easily, and that it was open source. But, as the title says, this is about Plex! Kodi did not work out as I could not find a Kodi app for Roku, which we have on two separate TVs in the house. This was a shame to find out after I had already set up Samba and tested it out with some videos that we had readily available.

I opted to keep Samba in place so that I can transfer videos from my PC to the server. The setup is as ever simple:

Samba Setup

# create the folders for sharing, including seperate folders for the kids
mkdir -p /srv/samba/tv
mkdir -p /srv/samba/movies
mkdir -p /srv/samba/videos
mkdir -p /srv/samba/kids/tv
mkdir -p /srv/samba/kids/movies
mkdir -p /srv/samba/kids/videos

# in case I use Kodi in the future:
sudo chown -R nobody:nogroup /srv/samba

# install samba and set it to start on boot
sudo apt-get install -y samba
sudo systemctl enable smbd.service nmbd.service

# being a vim snob, I will edit my samba file to share the above, but only the root "/srv/samba" for ease

vim /etc/samba/smb.conf

# Append to the end of /etc/samba/smb.conf
    comment = Files for Home Media Server
    path = /srv/samba
    browseable = yes
    guest ok = yes
    read only = no
    create mask = 0755

Plex Server Installation

After doing the above, a simple installation of Plex is in order:

# download and install the latest version of Plex server for Ubuntu as of 1/6/2018
sudo wget -O /tmp/plexserver.deb

sudo dpkg -i /tmp/plexserver.deb

# set plex to autostart and reboot
sudo systemctl enable plexmediaserver.service
shutdown -r now

Plex is pretty straight-forward to setup form here, so I won't go into too much detail other than you will need to hit the Plex web-interface to begin the initial setup. Simply navigate to http://server-name-or-ip-addres:32400

If you're not interested in running on Docker, you can stop here... But the title implies that it will run on Docker, right?

My Problem with Plex

If you could see from the above, I wanted to have my kids files separately. This isn't so that I don't have to sort through their content -- it's so that they can't see mine. You see, I am, legally anyways, an adult. I may not want my kidos to watch things like Futurama. With Kodi, this would have been easy... I just would have setup a different Samba share and only add that share for the Kids' devices.

It would seem that after some looking around (that was very brief), that you need to have a Plex subscription and use Plex Home to keep the content seperate... Yeah... I'm not looking for ANOTHER subscription to add to my bills.

While I am certain that there is another way, I decided to run TWO (yes, 2!) Plex servers on my ONE (yes, 1!) server!

A quick look at the Docker Hub revealed an office Plex Media Server image.

In the next part of this series, we will look at getting Plex up and going with Docker!

Show Comments