FreeNAS: Manual Install and Update of Plex Media Server

Install Plex in FreeNAS
Installing Plex Media Server on your FreeNas server is an absolute essential. Plex is a digital media player and organizational tool that allows you to access the music, pictures, and videos stored on one computer with any other computer, set top device or compatible mobile device. The Plex Media Server is the core of your PVR setup here and will provide all the media that you are ripping, downloading, etc to all of your clients. It will serve, and transcode as necessary based on the client devices requirements, all your movies, TV shows, music personal videos and more.

This article will show you how to install Plex Media Server on your FreeNAS system, without using the standard FreeNAS plugin interface and will instruct you on how to update your install your Plex Media Server to the latest version. You may want to setup Plex after you have setup some of your automated downloading agents which you can read about how to setup in my Sonarr, Radarr, Jackett, Qbittorrent, OpenVPN and other FreeNAS articles on this site.

Install Plex Media Server

There are two versions of Plex to install – the PlexPass version and thebasic version if you don’t have a PlexPass. Go to the command line interface for the jail in which you want to install Plex and enter one of the two following commands.

If you don’t have a PlexPass, use this command to install:
pkg install plexmediaserver

If you do have a PlexPass, use this command to install

pkg install plexmediaserver-plexpass

Automatic Start

We will need to set Plex to start automatically. It’s pretty simple, all you need to do is run the following command:

sysrc "plexmediaserver-plexpass_enable=YES" ro
sysrc "plexmediaserver_enable=YES"

I have my Plex server being run by the root user so that I can be sure that there is access to files and I am able to delete files from my Plex interface. So I edit the /usr/local/etc/rc.d/plexmediaserverfile and change:

from

: ${plexmediaserver_user=”plex”}
: ${plexmediaserver_group=”plex”}

to:

: ${plexmediaserver_user=”root”}
: ${plexmediaserver_group=”wheel”}

Now you can restart your jail or start Plex with one of the following commands:

service plexmediaserver-plexpass start or
service plexmediaserver start

Access Web Interface

Now you are ready to access the web interface, point Plex to your media files and start playing all your movies and TV shows! You can access the web interface at:

http://yourlocalipaddress:32400/web/index.html

Install PMS Updater

You have probably noticed that you Plex Media Server is not the latest version and is asking for an update. And you probably also notice that you are unable to update it from the web browser. So we need to install a little program called PMS Updater. So lets go ahead and get that installed.

From the shell within your Plex jail, we will first need to install some of the dependencies with the following commands:

pkg install wget
pkg install ca_root_nss
pkg install perl5

Now we can download the PMS Updater with the following commands:

mkdir /usr/local/PMS_Updater
cd /usr/local/PMS_Updater
wget https://raw.githubusercontent.com/mstinaff/PMS_Updater/master/PMS_Updater.sh

Now we can run the updater to get the latest Plex update and the syntax is as follows:

sh PMS_Updater.sh -u [user] -p [password] -v -a

So that should have you updated to the latest version and you’re good to go!

Automate PMS Updater and Setup as a Cron job

So dropping to command line to update your Plex Server every time is a bit of a pain. So we can work towards automating this a little bit. First we will need to store your login and password in a file. Go back to the /usr/local/PMS_Updater directory and create a password file with the following command:

nano auth.txt

Enter the following within the file:

user=email@address.com
password=password

Save the file and exit using Ctrl-X.

Now using the following command will perform the Plex update.

sh PMS_Updater.sh -c auth.txt -v -a

Now we can use this command as a Cron job. In the FreeNAS web interface go to Tasks -> Cron Jobs and add a new job. Enter the following into the command field.

/usr/local/bin/iocage exec [jailname] /bin/sh /usr/local/PMS_Updater/PMS_Updater.sh -c /usr/local/PMS_Updater/auth.txt -v -a

You can set it up to run automatically at a specified time, daily, monthly or whatever you’d like. I have un-ticked the ‘enabled’ option which means it does not run automatically on a schedule, however I have the option to run this job whenever I need to from the web interface.

Configure Tips

This article is not meant to lead you through the setup of your Plex Server. However here are a couple of tips, I found I needed:

If you have an issue with movies and TV showing up with dots in their names (i.e. with their file names, and not the name which should be scraped from the web, follow these instructions (source):

In the web interface for your plex server, go to Settings -> Server -> Agents -> Shows -> TheTVDB. In there, grab the line ‘Local Media Assets’ with your mouse and drag it downwards, so it ends up being at the bottom of the stack of active agents. Repeat the same under Settings -> Server -> Agents -> Shows -> TheMovieDatabase and Settings -> Server -> Agents -> Movies -> Plex Movie and Settings -> Server -> Agents -> Movies -> TheMovieDatabase

Check and make sure this is working by refreshing the metadata on one movie and wait a couple minutes. Plex should scrape the right data and update the movie title for you.
Wait 1 or 2 minutes.

Alright! So with this you should be up and running and experiencing Plex Media Server! Happy Plexing!

~Raze42

Sources:
Install Instructions: https://www.myrandomtips.com/linux/freenas/how-to-install-plex-media-server-on-freenas-11-2/
Updater Source Code: https://github.com/mstinaff/PMS_Updater
Updater Instructions: https://www.ceos3c.com/freenas/manually-update-plex-freenas/
Alternate Method (not tried): https://www.simontaplin.net/how-to-update-the-plex-plugin-and-others-on-freenas-11-2/


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s