Do you want to host your own Netflix? Plex has you covered!
I’ve always been a huge fan of XBMC/Kodi and have been running it on my media center for as long as I can remember. While it’s probably the best open-source media player around, it doesn’t support transcoding or streaming content to another device. This is where Plex comes in and trust me it’s amazing at that!
Preparing the server
Even though Plex is available as a NAS package for quite a few systems (including Synology), I highly recommend to install it on a standalone Ubuntu Server instead. While using the Synology DSM package on XPenology I encountered a lot of issues with the performance, especially while transcoding HD content.
In this tutorial I’ll use a Ubuntu Server 14.04.3 (64-bits) virtual machine running on ESXi 6.0. According to the recommended requirements for transcoding HD content I’ve assigned 2GB of memory and 2 cores per socket, leaving all other parameters at their default values. The installation of Ubuntu Server should be straight forward so I won’t cover that here. Just accept the defaults and login when prompted.
Installing or updating Plex
Most guides will instruct you to install a non-official repository, but there’s really no point in doing that. Just head over to the Plex website and copy the URL to the latest installer for Ubuntu (Linux). Once you have the URL in your clipboard you can use Putty to login to your server and run the following command in sequence:
wget -O plex.deb <url to .deb file>
sudo dpkg -i plex.deb && rm plex.deb
Now Plex should be installed and available from
If you want to access Plex from outside your network you’ll want to assign a static IP address to your Ubuntu Server and port forward port 32400 to your static IP.
Configure a static IP address
In order to configure a static IP address (recommended), you’ll need to edit your interfaces file similar to this (change the values to match your network).
sudo nano /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
iface lo inet loopback
# The primary network interface
iface eth0 inet static
In this case my routers IP address is 192.168.1.1 and Plex will be using 192.168.1.150. Now the only thing you’ll have to do is adding a port forwarding rule on your router. This step differs quite a lot depending on your router, so if you have any issues please let me know.
Accessing your media
The easiest way of accessing your media is by sharing it using the windows file service (SMB protocol). Create a new user with a random password and use that to mount this share on the Plex server. This is done in two steps. Create a directory and mount the share using fstab.
sudo mkdir /mnt/media && sudo nano /etc/fstab
Add the following to the end of the file and remember to replace all the uppercase placeholders.
//IP-OF-SERVER/MEDIASHARE /mnt/media cifs username=USERNAME,password=PASSWORD,iocharset=utf8,sec=ntlm 0 0
Plex offers a lot of features, but unfortunately it doesn’t offer any useful usage statistics. Fortunately there is an awesome open-source solution for that on GitHub. In this chapter I’ll show you how to install both PlexWatch (for generating statistics) and PlexWatchWeb (graphical representation of the statistics). First we need to install and configure PlexWatch in order to generate the necessary statistics.
Install the requirements.
sudo apt-get install libwww-perl libxml-simple-perl libtime-duration-perl libtime-modules-perl libdbd-sqlite3-perl perl-doc libjson-perl
Download PlexWatch, update the permissions and create the config file.
sudo wget -P /opt/plexWatch/ https://raw.github.com/ljunkie/plexWatch/master/plexWatch.pl
sudo wget -P /opt/plexWatch/ https://raw.github.com/ljunkie/plexWatch/master/config.pl-dist
sudo chmod 777 /opt/plexWatch && sudo chmod 755 /opt/plexWatch/plexWatch.pl
sudo cp /opt/plexWatch/config.pl-dist /opt/plexWatch/config.pl
Verify the installation by issuing the follow command. You shouldn’t see any output from it.
Finally add the script to cron so it’s executed every minute.
* * * * * /opt/plexWatch/plexWatch.pl
While PlexWatch creates the statistics, it doesn’t provide a user interface. Next we’re installing PlexWatchWeb.
Install the requirements.
sudo apt-get install apache2 unzip php5 php5-sqlite php5-curl php5-json
Download PlexWatchWeb and move it to your webserver root directory.
wget -O plexwatchweb.zip https://github.com/ecleese/plexWatchWeb/archive/dev.zip
unzip plexwatchweb.zip && cd plexWatchWeb-master/
mv * /var/www/html/
Now you should be able to navigate to http://ip-of-server/plexWatch and enjoy your stats.