Guide to Plex Media Server on Ubuntu 16.04

NOTE: This Guide is OUTDATED for the updated version Go HERE

Soon: Installing and Configuring a reverse proxy with NGINX to use with or without a purchased domain.

Soon: Updated with Jackett Support

Around a year ago I found out about plex while initially it was just a cool way to watch and organize my movies it became an obsession soon after I built a NAS with around 15tb of usable storage I decided to make my plex server as automated as possible. So I began researching and constructing my media server and while this write-up might not apply to your setup exactly it should cover most of the configuration.

Okay so what are we going to be installing?

Plex Media Server – The key component that will be serving all of our media files.

Deluge – The bittorrent client we will be using in conjunction with CouchPotato and Sonarr.

PlexPy – Allows you to monitor users and viewing habits on your Plex Media Server.

CouchPotato – Automation for finding and downloading movies to use with Plex.

Sonarr – Automation for finding and downloading tv shows to use with Plex.

PlexRequests.NET – Allows your plex users to request movies and television shows with out bugging you.

Step 1: Prepping

While it seemed easy to just slap windows on it and have all these programs autostart it didn’t seem efficient and there are operating systems more equipped for this project. So I settled on Ubuntu Server 16.04, installation was fairly straight forward nothing fancy just follow the instruction while installing.

Once you have your new installation you’re going to want to install SSH with this command.

sudo apt install openssh-server

It is recommended you change the default port for security purposes the port setting is located in this file.

sudo nano /etc/ssh/sshd_config

The last thing we need to do is find the local ip address which can be done by simply typing

ifconfig

I suggest writing down the port and ip to connect later. Now reboot using this command

reboot

Now that we can SSH into the server we can leave the machine alone and get back to our main computer. Now SSH into the server using the user account you created when you installed Ubuntu.

Make sure your system is up-to-date with these commands

sudo apt-get update && sudo apt-get upgrade

sudo apt-get dist-upgrade

Next we will install these dependences so we don’t have any problems down the road and all of our programs run smoothly.

Dependences

sudo apt-get install python2.7 mono-complete git-core python-lxml python-pip unzip

Step 1a: Storage

This is the part I don’t really know how to write up as everybody has different storage setups. If you have a NAS you can set up and mount NFS or CIFS shares using the fstab config. Maybe you have hard drives directly connected to the machine. Anyway you put it you’re going to have to mount your media to be able to setup and server the files to plex.

I will comeback to this and try to write examples for the ways listed above but until then I’ll just assume you know how to configure your storage sorry.

Step 2: Plex Media Server

Installing Plex Media Server is simple we will be using a script called plexupdate

cd /opt

sudo git clone https://github.com/mrworf/plexupdate.git

Step 2a: PlexPass

If you have a plex pass account you need to follow the instruction below in order to make sure you get the latest version of plex. Note: if you don’t have plex pass go to step 2b below.

sudo nano /opt/plexupdate/plexupdate.sh

Inside this file find these lines and enter your plex credentials

EMAIL="example@email.com"
PASS='password'

Save the file and then run

sudo /opt/plexupdate/plexupdate.sh -a

Step 2b: Non Plex Pass Users

If you don’t subscribe to plex pass installing is very easy just run the command below
sudo /opt/plexupdate/plexupdate.sh -p -a

Step 2c: Auto Updates

We will now create a systemd timer that will run once a day to pull updates for plex.

Note: Remove -p if you are using plexpass

sudo nano /etc/systemd/system/plexupdate.service

sudo nano /etc/systemd/system/plexupdate.timer

Lastly enable the timer with

systemctl daemon-reload

systemctl enable plexupdate.timer

Plex Media Server should now be installed and maintained automatically  navigate to http://<serverip>:32400/ to ensure it is working and feel free to configure it now.

Step 3: Deluge

Deluge is a lightweight, Free Software, cross-platform BitTorrent client that we will be using as our main torrent client.

Installing Deluge is simple but first we need to create a user to run it.

sudo adduser --disabled-password --system --home /var/lib/deluge --gecos "Deluge service" --group deluge

sudo touch /var/log/deluged.log
sudo touch /var/log/deluge-web.log
sudo chown deluge:deluge /var/log/deluge*

sudo apt-get update && sudo apt-get install deluged deluge-webui

Now that we have Deluge on the server we just need to make it run on start which we will do with the code below.

In nano paste this code below then save.

sudo nano /lib/systemd/system/deluged.service

sudo nano /lib/systemd/system/deluge-web.service

In nano paste this  code below then save.

Lastly we need to start and enable the systemd script and then check to see if its working.
sudo systemctl start deluged
sudo systemctl enable deluged
sudo systemctl start deluge-web
sudo systemctl enable deluge-web

Now to ensure deluge is working go to http://<serverip>:8112/ in your browser connect to your daemon and login using the default password deluge you can then change your password once you login.

Enable the Extractor and Label plugin under Preferences > Plugins also make sure you are using Move completed to: for finished torrents

To get deluge to work with couchpotato directly we need to create a new user in the auth file

sudo nano /var/lib/deluge/.config/deluge/auth

Then add a new user on the second line using this format

user:pass:10

Step 4: PlexPy

PlexPy is python based web application for monitoring, analytics and notifications for Plex Media Server.

First we make a user to run the service.

sudo adduser --disabled-password --system --no-create-home --gecos "PlexPy Service"  --group plexpy

Installing PlexPy is simple with git.

cd /opt

sudo git clone https://github.com/drzoidberg33/plexpy.git

sudo chown -R plexpy:plexpy /opt/plexpy

Now that we have PlexPy on the server we just need to make it run on start which we will do with the code below

sudo nano /lib/systemd/system/plexpy.service

In nano paste this  code below then save.

Lastly we need to start and enable the systemd script and then check to see if its working.
sudo systemctl start plexpy
sudo systemctl enable plexpy

Now verify that PlexPy is working correctly by navigation http://<serverip>:8181/

Configuring PlexPy is easy just follow the straightforward instructions in the browser. Hint: Your server ip address is the same you use for SSH

Step 5: CouchPotato

CouchPotato allows you to request movies and pull the correct torrent to download/rename/organize.

First we make a user to run the service

sudo adduser --disabled-password --system --no-create-home --gecos "CouchPotato Service" --group couchpotato

Installing CouchPotato is also easy using git.

cd /opt

sudo git clone https://github.com/CouchPotato/CouchPotatoServer.git

sudo chown -R couchpotato:couchpotato /opt/CouchPotatoServer/

Now that we have CouchPotato on the server we just need to make it run on start which we will do with the code below.

sudo nano /lib/systemd/system/couchpotato.service

In nano paste this  code below then save.

Lastly we need to start and enable the systemd script and then check to see if its working.
sudo systemctl start couchpotato
sudo systemctl enable couchpotato

Check if Couchpotato is working by going to http://<serverip>:5050/

Configuration is straightforward just remember to enable the trackers you want to use

couchpotato-pg1

couchpotato-delugesettings

Note: Use the username and password you created in the deluge auth file.

couchpotato-renamerhint

That’s the main setup of couchpotato I suggest creating a new quality profile  in Settings > Searcher > Qualities but since its preference i’ll leave that up to you.

Step 6: Sonarr

Sonarr is a PVR for Usenet and BitTorrent users. It can monitor multiple RSS feeds for new episodes of your favorite shows and will grab, sort, and rename them.

First we make a user to run the service

sudo adduser --disabled-password --system --no-create-home --gecos "Sonarr Service" --group sonarr

Installing Sonarr is easy because they have their own repository so it makes it easy to install.

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys FDA5DFFC

echo "deb http://apt.sonarr.tv/ master main" | sudo tee /etc/apt/sources.list.d/sonarr.list

sudo apt-get update && sudo apt-get install nzbdrone

sudo chown -R sonarr:sonarr /opt/NzbDrone

Now that we have Sonarr on the server we just need to make it run on start which we will do with the code below.

sudo nano /lib/systemd/system/sonarr.service

In nano paste this  code below then save.

Lastly we need to start and enable the systemd script and then check to see if its working.
sudo systemctl start sonarr
sudo systemctl enable sonarr

Ensure sonarr is up at http://<serverip>:8989/

sonarr-rename

sonarr-deluge

Once again I let you decide what indexers you want to use.

Note: rarbg index seems to be broken with default settings change API URL to use HTTP instead.

Step 7: Plex Requests

Plex Requests allows you to host your own  request system. If you are sharing your Plex server with other users, allow them to request new content using an easy to manage interface.

First we need to make a user to run the Plex Requests service.

sudo adduser --disabled-password --system --no-create-home --gecos "PlexRequests Service" --group plexrequests

Installing Plex Request is a little tricky at first but just follow the instruction below.

sudo mkdir /opt/plexrequests

cd /opt/plexrequests

Now we need the latest version of PlexRequest.NET which can be found here .
At the time of this guide the latest version is 1.9.1 but replace that with the current version found above.

sudo wget https://github.com/tidusjar/PlexRequests.Net/releases/download/v1.9.1/PlexRequests.zip

sudo unzip PlexRequests.zip && sudo rm PlexRequests.zip

sudo chown -R plexrequests:plexrequests /opt/plexrequests

Now that we have PlexRequests on the server we just need to make it run on start which we will do with the code below.

sudo nano /lib/systemd/system/plexrequests.service

In nano paste this  code below then save using.

Lastly we need to start and enable the systemd script and then check to see if its working.
sudo systemctl start plexrequests
sudo systemctl enable plexrequests

Verify that plexrequest is now working now by going to http://<serverip>:3579/ in your browser

Setup of Plex Request is also straightforward just follow the wizard then login to the admin setting and do the following

Note: Couchpotato API key is found in CouchPotato under Setting > General > Advanced be sure Show advanced is checked in Couchpotato

request-couchpotato

Note: Sonarr API key is found in Sonarr under Setting > General > Security

request-sonarr

So Whats Next?

 

Setting up SSL support with NGINX using LetsEncrypt