HOWTO Setup a Plex Media Server (PMS) Appliance on an Ubuntu Server

Description

The first of a three part series that guides you through all the steps to create, setup, load and maintain a Plex Media Server (PMS) appliance running on a computer running Ubuntu Server OS.

This will result in a low overhead solution that can be run on less demanding computing hardware. 

The tutorial makes it very easy to interact with the appliance by allowing owners to access it from the familiarity of their Windows computer.




Notes for HOWTO Setup a PMS Appliance on an Ubuntu Server Part (1 of 3)

## YouTube Video URL: https://youtu.be/cOgnW4HoHsg

## Ubuntu URL: https://ubuntu.com
## Rufus URL: https://rufus.ie
## Putty URL: https://putty.org


 

Notes for HOWTO Setup a PMS Appliance on an Ubuntu Server Part (2 of 3)

## YouTube Video URL: https://youtu.be/3i4DJSQ5QW0

## Add PMS directory to Ubuntu package list
echo deb https://downloads.plex.tv/repo/deb public main | sudo tee /etc/apt/sources.list.d/plexmediaserver.list
curl https://downloads.plex.tv/plex-keys/PlexSign.key | sudo apt-key add -

## Install the https download transport ofr APT
sudo apt install apt-transport-https

## Update the list of available packages
sudo apt update

## Install PMS
sudo apt install plexmediaserver

## Clear Terminal Windows
clear 

## Has PMS been installed?
systemctl list-unit-files | grep plexmediaserver

## If PMS Service is not enabled to autorun
sudo systemctl enable plexmediaserver

## Get information about the PMS service
sudo systemctl status plexmediaserver

## Reboot PMS
sudo reboot

## Shutdown
sudo shutdown 

## To create directories
sudo mkdir /plexmedialibrary

## To list directories
ls /

## To set full rights on the folder /plexmedialibrary (and any subfolders) for user, group and world to the highest possible (Read-Write-eXecute)
sudo chmod -R 777 /plexmedialibrary

## To create subfolders under /plexmedialibrary
sudo mkdir /plexmedi alibrary/movies
sudo mkdir /plexmedialibrary/tv
sudo mkdir /plexmedialibrary/photos

## To get help on a command used the --help option
sudo chmod --help

## To clear the Terminal Screen
clear

## The package that will install the CIFS (Common Internet File System) that will allow access to folders on Windows computers
sudo apt install cifs-utils

## The directory will be used to link to folders on the Windows server (These are known as mount points)
sudo mkdir /media/plexshare
 
## Command to properly shutdown the computer (with a delay)
sudo shutdown

## To cancel queued shutdown
sudo shutdown -c



Notes for HOWTO Setup a PMS Appliance on an Ubuntu Server Part (3 of 3)

## YouTube Video URL: https://youtu.be/UmhGZ1fol5I


## Why PLEX-APP and SRV-PLEX
## -------------------------------------
<From within Web Browser>: http://192.168.16.9:32400/web
 

## Setting up PMS Folders
## -----------------------------
<< no command line text entered >>


## Transfering files directly from Windows (Putty's PSCP Utility)
## --------------------------------------------------------------------------

# Putty's PSCP Utility is being run from within a Windows Command Prompt!!!  It is NOT run within a Ubuntu Terminal session.
# <From Windows Command Prompt>: pscp -r   C:\Users\Administrator\Desktop\Photos\*.* administrator@192.168.16.9:/plexmedialibrary/photos/

# Help on chmod
sudo chmod --help

# Change attributes as follows: user: read + write; group: read; world: read 
sudo chmod -R 644 /plexmedialibrary/photos


## Accessing media on USB devices
## -----------------------------------------
 
# List mounted devices
sudo fdisk -l

# List contents of folder /media
ls /media/

# Create folder external under media folder
sudo mkdir /media/external

# List contents of folder /media
ls /media/

# To mount a FAT16 ot FAT32 device
sudo mount -t vfat /dev/sdb1 /media/external -o uid=1000,gid=1000,utf8,dmask=027,fmask=137

# To mount an NTFS device
sudo mount -t ntfs-3g /dev/sdb1 /media/external

# To list the contents of the attached device referenced by mount name '/media/external/'
ls /media/external/

# Help on the copy command
cp --help

# Copy all files from mounted USB recursivly drive to PMS tv folder
cp -R -v /media/external/tv/* /plexmedialibrary/tv/
 
# To unmount a device
sudo umount /dev/sdb1

# List contents of folder /PMS tv directory
ls /plexmedialibrary/tv/

# To set full rights on the folder /plexmedialibrary/tv/ (and any subfolders) for user, group and world to the highest possible (Read-Write-eXecute)
sudo chmod -R 777 /plexmedialibrary/tv/*

# To set read only rights on the contents of /plexmedialibrary/tv/ (and any subfolders) for user, group and world
sudo chmod -R 444 /plexmedialibrary/tv/*

# List contents of folder /PMS tv directory
ls /plexmedialibrary/tv/


## Accessing media from a Windows Shared Folder
## ------------------------------------------------------------
 
# <On Windows computer create a user account that will be used by the PMS service to gain access to the media>:  
# - username=plexagent
# - password=123578fgkj4834rd-48e2h^^47

# <On Windows computer assign plexagent to the Windows user group>
#  You can place this account in a group with even more limited access - only the ability to traverse the directory and have read access is neccessary as a minimum.

# define a windows credentials file
sudo nano /etc/win-credentials

# In the file '/etc/win-credentials' add the windows username and password for the plexagent account
username=plexagent
password=123578fgkj4834rd-48e2h^^47
domain=domain

# List contents of folder '/media' (/'to verify that '/media/plexshare/' exists)
ls /media/

# Determine the IP address of the Windows machine
<From Windows Command Prompt>: ipconfig

# On the Windows computer the PMS folder needs to be shared (as plexmedialibrary in this tutorial)

# Test that the credentials file is able to access Windows computer (the IP address of the Windows computer is assumed to be 192.168.16.27)
sudo mount -t cifs -o credentials=/etc/win-credentials //192.168.16.27/plexmedialibrary /media/plexshare

# List contents of folder '/media/plexshare/movies/'
ls /media/plexshare/movies/

# Unmount the Windows computer file share mount point
sudo umount /media/plexshare

# Clear terminal window
clear 

# To have this share automount everytime PMS Ubuntu appliance starts
# - edit the file '/etc/fstab'

# - add the following: //192.168.16.27/plexmedialibrary /media/plexshare cifs credentials=/etc/win-credentials,file_mode=0755,dir_mode=0755 0 0

# execute '/etc/fstab' contents
sudo mount -a

# List contents of folder '/media/plexshare/movies/'
ls /media/plexshare/movies/


## Keeping your PMS Appliance updated
## -----------------------------------------------
 
 # Reboot PMS appliance
 sudo reboot
 
# Get an updated list of packages that can be updated
sudo apt update
 
 # Show the packages that can be udpated
 apt list --upgradable
 
# Perform the actual package upgrade
sudo apt upgrade

# Shutdown computer immediatley
sudo shutdown now



Comments

Popular posts from this blog

HOWTO setup OpenVPN server and client configuration files using EasyRSA

Securing your Web Server using Let's Encrypt and Certify-The-Web

HOWTO Generate password protected OpenVPN client configuration using EasyRSA.