Plex Media Server

From Amahi Wiki
Jump to: navigation, search
Warning.png WARNING
Manually upgrading may break the Amahi 7 or greater Plex Media Server app or your HDA.

Amahi or Plex Inc. cannot provide support to help or correct any issues resulting from this upgrade if you chose to do it.



Recent "White Page" Issue

There is an issue in recent releases of the Plex Media Server app. If reaching the server yields a white page, please access it with this work-around link until (Plex fixes the issue): http://hda:32400/web.

Source Install

WARNING: This is a user contributed tutorial. Proceed with this guide at your own risk. If it breaks your HDA or you need assistance, Amahi cannot provide support.

This is a quick guide on how to install manually the PlexMediaServer (not the Amahi web app) on Amahi 7 or greater (Fedora). Find out the latest version by checking https://plex.tv/downloads and copy the link under the Fedora icon. Note that PlexPass users occassionally have access to preview versions of Plex that may contain additional functionality not yet released to other users. Use the toggle to download the preview release if you have a PlexPass.

  • Install the current Plex server version from the link above, where x.x.x.x-xxxxxxx is the current version (1.2.2.2857-d34b464 at October 2017)
64-bit
wget https://downloads.plex.tv/plex-media-server/x.x.x.x-xxxxxxx/plexmediaserver-x.x.x.x-xxxxxxx.x86_64.rpm
sudo yum localinstall plexmediaserver-x.x.x.x-xxxxxxx.x86_64.rpm
32-bit
wget https://downloads.plex.tv/plex-media-server/x.x.x.x-xxxxxxx/plexmediaserver-x.x.x.x-xxxxxxx.i386.rpm
sudo yum localinstall plexmediaserver-x.x.x.x-xxxxxxx.i386.rpm
  • Start the service: Next up we actually have to start Plex, the following command will do just that as well as create a symlink to always start Plex at boot.
sudo systemctl enable plexmediaserver.service && systemctl start plexmediaserver
NOTE: If you get an error with the above command while connected to the server with SSH through a terminal, it seems you have to relogin as root.
  • Run at least once the PlexMediaServer (and do nothing, just run once), from any browser in your network enter
http://localhost:32400/web/index.html#!/dashboard
  • Stop the PlexMediaServer (preferably log in with a terminal):
sudo systemctl stop plexmediaserver
  • File permissions and access: Our first big problem (although it’s not really) is to allow Plex to access any of our files. PMS runs as it’s own user (surprisingly a user called plex), not you by default. So we need to give that user access to your files. The easiest way to do this is to add the plex user to your users group. Type the following command in a terminal:
sudo gpasswd -a plex users
  • Restart the PlexMediaServer, wait 1-2 minutes and log in again to edit your libraries:
sudo systemctl start plexmediaserver
NOTE: Don't forget if you are using Greyhole, that in this case you have always to use your files "inside" from the mounted local files
  • Either by auto update (done so around midnight), or if you ask manually for updating the system, amahi will replace the original PlexMediaServer package with it's own amahi-plex (webapp). In order to prevent that you have to exclude the auto-update in the amahi-repo. Edit (as root) /etc/yum.conf (Amahi 8) or /etc/dnf/dnf.conf (Amahi 9) and add the following at the bottom:
exclude=amahi-plex

Use with Greyhole

If you add a library section connected to a folder that is part of your drive pool and thus handled by Greyhole, you should NOT check the option to allow clients to delete media in the Plex Media Server preferences dialog.

If you want to enable this feature you should mount your shares locally on your HDA and point Plex Media Server to these mount points instead. Otherwise deletes could cause orphan files in the storage pool since only the symlink would actually be deleted and not the actual file.

Locally Mounted Shares (Ubuntu & Fedora)

If you access your media files using locally mounted shares (eg if you are a Greyhole user as suggested above), you will need to change the permissions of your plex server user. The Plex Media Server is run by a special user plex who doesnt have access to the local shares by default.

for Ubuntu To fix, open terminal as root user and type:

sudo usermod -a -G users plex

for Fedora To fix, open terminal as root user and type:

sudo gpasswd -a plex users

You may need to restart Plex. Now when you want to add directories using the web interface all your shares should be accessible.

Update Plex Media Server

  • If you have installed manually by source the PlexMediaServer, it now has the ability to update itself through the settings' webpage
  • If you are using amahi-plex it will auto update itself as so as the developers push the new version into amahi's repo. Don't try to update the amahi-plex web app although in the setting's webpage it will inform you that a new version of PlexServer is available. Most probably it will fail or it will brake down your system !!!

Troubleshooting

Data not shown with Main page login

We noticed that when logging in to http://plexms/ plex does not seem to list any data from the plex server, allow you to set up libraries, or allow logins going through this front-door. It does not seem to "be able to connect to this server" on the left side. However, going through http://hda:32400/web/index.html it all works well.

The work-around is this: going to

http://hda:32400/web/index.html#!/settings/server/

Then login to plex on this page and give it a friendly name there."My Amahi server" or similar should do.

After that, it should show up under http://plexms/.

Dashboard Link Workaround

If the launch icon and link for Plex Media Server in the dashboard does not properly load the server, you may need to try a workaround.

First, try just restarting httpd.This should hold for as long as your server is running.

systemctl restart httpd

If that does not work, or you are restarting your server often, this longer workaround also works. Start by finding your ####-plexms.conf file in /etc/httpd/conf.d/ Open this file up in a text editor like vi or nano and remove (or comment out) the following two lines:

ProxyPass / http://hda:32400/manage/
ProxyPassReverse / http://hda:32400/manage/

Option 1

Add the following three lines below the two you commented out above:
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule (.*) http://%{HTTP_HOST}:32400/manage/ [R,L]
After completing the changes, restart httpd
systemctl restart httpd

Option 2

Create a text file called "index.html" and save that file in /var/hda/web-apps/plexms/html The contents of the file is a simple redirect. It should read:
<html>
<head><meta http-equiv="refresh" content="0; url=http://hda:32400/manage/" />
</head>
<body></body></hmtl>
Set the file ownership permissions:
chown apache:users index.html;

The Plex Media server page should now load when you click on the icon or link in the dashboard.