Upgrade Plex Media Server with PlexPass on LibreElec via Command Line
Since I recently replaced my Xtreamer Ultra 2 with a shiny Xtreamer Wonder Pro (warning: do not get the WonderPro, as Xtreamer has locked down firmwares, and you will not be able to upgrade to anything else), I decided to repurpose my Xtreamer Ultra 2 as a dedicated Plex Media Server with PlexPass to provide media across the house for everyone:
For the first part of the installation it is best to have the Xtreamer Ultra 2 connected to a TV. I first started off with the installation of the Krypton release of LibreElec which was as simple as downloading the USB creator tool and then writing the image to flash disk (follow this to boot the Xtreamer into BIOS).
Automatically mounting NFS volumes
Once you have completed the installation process, open up a terminal session to your Xtreamer via ssh -l root <MediaCentreIP> (the password is librelec). As the next step we will mount our media (in my case all media resides on a Synology NAS with IP 172.16.0.97 – adjust the below accordingly) by creating mount-files in /storage/.config/system.d/:
Description=Synology TV-Series mount
# if we do network mounts like here we *require* 'network-online.service' which checks if the network is online
# our scripts must start *after* 'network-online.service', on timeout and if 'network-online.service' fails we
# can not mount and this scripts fails too
# usually we mount networks shares because we want they avaible *before* XBMC starts.
# so XBMC has access to this mounts from beginning. Note: this slows down the boot!
# The share we want mount
# Where we want mount this share
# Any options you usually use with the "-o" parameter in the mount command
# filesystem type
# The target is used by 'systemctl enable <name_of_this_file.mount>' to link
# this service to a runlevel for starting on boot. usually 'multi-user.target'
# is ok here.
Important: You can create multiple mount-files, but it is important that the file must be named to <mountpoint>.mount where <mountpoint>, is the FULL path where the share will be mounted but slashes “/” MUST BE REPLACED with dashes “-” with .mount as extension. This means, if we want mount to “/storage/synologyseries” (see above “Where=/storage/synologyseries”) then the file must be named ‘/storage/.config/system.d/storage-synologyseries.mount’ and can be enabled via ssh with the command ‘systemctl enable storage-synologyseries.mount’.
Installing the Plex Media Server Plugin
Install the Plex Media Server Plugin manually – in my case I downloaded the plugin and then installed via the XBMC GUI – be patient as this can take a good minute to complete. Reboot the Xtreamer (you can do this via the command reboot from the terminal) and once rebooted, verify that Plex has started via the URL http://YOURIP:32400/web/index.html.
Configure Plex Media Server, your libraries and users.
Upgrading Plex Media Server via the command line
Plex will frequently upgrade the media server and it is worthwhile to occasionally check for updates via the Plex GUI (in the server section):
I typically download and run the update via the command-line as it is very fast and requires the replacement of files within the downloaded plugin:
#### Update Plex latest version
curl -L -o /tmp/plexserver.deb "https://plex.tv/downloads/latest/1?channel=8&build=linux-ubuntu-x86_64&distro=ubuntu&X-Plex-Token=Uk9xht7VEWU7VbPV3Fpq"
rm -rf /tmp/usr/ /tmp/etc/ /tmp/lib/
ar -vx plexserver.deb
tar -xvzf data.tar.gz
rm -rf /storage/.kodi/addons/service.multimedia.plexmediaserver/lib.old
systemctl stop service.multimedia.plexmediaserver.service
mv /storage/.kodi/addons/service.multimedia.plexmediaserver/lib /storage/.kodi/addons/service.multimedia.plexmediaserver/lib.old
mv /tmp/usr/lib/plexmediaserver /storage/.kodi/addons/service.multimedia.plexmediaserver/lib
systemctl start service.multimedia.plexmediaserver.service
The above commands will download the Plex Media Server update from Plex (replace the URL with the most recent version), extract the files, stop Plex server, move the files into place and then restart Plex Media Server.