DEPLOYMENT AND CONFIGURATION OF AN

Ubuntu Plex

SERVER

Ubuntu Plex Server

Project

In this project I have set out to build a client-server media player system; choosing Plex to do this. This project covers the complete build of a Plex Media Server on a headless Ubuntu server (best compatibility).

Prerequisites

The Server

An already deployed Ubuntu server must be configured and connected to the internet.

System Requirements

The server must be ready to perform under relatively high loads especially with the more users on it and the amount of transcoding done on it. I recommend the following for average use:

Minimum

Intel Core i3 (or equivalent) or faster
2GB RAM

More details to help choose can be found on Plex’s article here.

DOWNLOAD PLEX

Navigate in your web browser to https://www.plex.tv/downloads/ and find the Linux download and copy the link ready for deployment.

Via your SSH session use this copied download link to download the installation files using wget.

The syntax will look similar to: wget https://downloads.plex.tv/plex-media-server/0.9.12.6.1347-54c2e56/plexmediaserver_0.9.12.6.1347-54c2xx_amd64.deb

 

Deployment

INSTALL PLEX

Unpackage your download using the following:

sudo dpkg -i plexmediaserver_0.9.12.6.1347-54c2xx_amd64.deb

You will then be prompted for your password
[sudo] password for username_here:

Then the package will be installed and you should see similar to the below:
Selecting previously unselected package plexmediaserver.
(Reading database … 55709 files and directories currently installed.)
Preparing to unpack plexmediaserver_0.9.12.6.1347-54c2e56_amd64.deb …
Unpacking plexmediaserver (0.9.12.6.1347-54c2e56) …
Setting up plexmediaserver (0.9.12.6.1347-54c2e56) …
OK
plexmediaserver start/running, process 1208
Processing triggers for ureadahead (0.100.0-16) …
ureadahead will be reprofiled on next reboot
Processing triggers for mime-support (3.54ubuntu1.1) …

If dpkg reports an error about dependency problems, run sudo apt-get install -f to download the missing dependencies and configure everything, but this is likely not necessary for most installations.

MOUNT AND PASSWORD PROTECT THE NETWORK DRIVES

The quickest way to auto-mounting a password-protected share is to edit /etc/fstab (with root privileges), to add this line:

//servername/sharename /media/windowsshare cifs username=msusername,password=mspassword,iocharset=utf8,sec=ntlm 0 0

This is not a good idea however: /etc/fstab is readable by everyone and so is your Windows password in it. The way around this is to use a credentials file. This is a file that contains just the username and password.

Using a text editor, create a file for your remote servers logon credential:

gedit ~/.smbcredentials

Enter your Windows username and password in the file:

username=msusername
password=mspassword

Save the file, exit the editor.

Change the permissions of the file to prevent unwanted access to your credentials:

chmod 600 ~/.smbcredentials

Then edit your /etc/fstab file (with root privileges) to add this line (replacing the insecure line in the example above, if you added it):

//servername/sharename /media/windowsshare cifs credentials=/home/ubuntuusername/.smbcredentials,iocharset=utf8,sec=ntlm 0 0

Note: If there are spaces within the mount point path you can use “/040″ instead of a space ” ” in the config file.

Save the file, exit the editor.

Finally, test the fstab entry by issuing:

sudo mount -a

If there are no errors, you should test how it works after a reboot. Your remote share should mount automatically.

If there are errors you are most likely missing a dependency that must be installed. Download and install the below if this is the case:

apt-get install nfs-common

sudo apt-get install cifs-utils

Configure Plex

CONFIGURE PLEX TO SEE THE NEW LIBRARY IN THE NEW LINUX MOUNT POINTS YOU JUST CREATED

Login to your plex installation through your web browser

In your web browser, go to: http://192.168.1.1:32400/web/index.html

Hover over the Movies (or whatever part you’re trying to migrate) with your mouse. A pencil icon will show up,click on this.

Choose the Add folders option on the left hand side

KEEP ALL EXISTING LOCATION(S) IN PLACE and add your new location(s) by clicking, ‘Browse for Media Folder’

Choose the appropriate locations you created previously such as /mnt/Video

Click save changes, and if a library rescan doesn’t start, make sure you start one manually.

Once complete, turn on the ‘Empty Trash Automatically After every scan’ check box in Plex Server / Library page’ again and then you can safely remove the previous library mount locations through the steps above, this will get rid of any dead links to the former video location.

Repeat this for as many library sections as you have.

Summary

Final Word

At this point you will have a functioning Plex Media Server. There is ample to do within the server settings (found within Settings > Server) so now its a matter of fine tuning and enjoying your new Plex server!