Skip to content

Instantly share code, notes, and snippets.

@Drewster727
Created January 31, 2021 18:54
Show Gist options
  • Save Drewster727/439faa809d836ec3863057fd46ea9492 to your computer and use it in GitHub Desktop.
Save Drewster727/439faa809d836ec3863057fd46ea9492 to your computer and use it in GitHub Desktop.
Obtain & Install Latest Public Plex Media Server (Debian)
#!/bin/bash
VERSIONS_URL=https://plex.tv/api/downloads/5.json
LATEST_VERSION=$(curl -s $VERSIONS_URL | jq -r '.computer.Linux.version')
OS_LABEL="Ubuntu (16.04+) / Debian (8+) - Intel/AMD 64-bit"
DOWNLOAD_URL=$(curl -s $VERSIONS_URL | jq -r --arg OS_LABEL "$OS_LABEL" '.computer.Linux.releases[] | select(.label==$OS_LABEL).url')
FILE_NAME=$(echo ${DOWNLOAD_URL##*/})
echo "[DOWNLOAD] $DOWNLOAD_URL"
wget $DOWNLOAD_URL
echo "[STOP-SVC] plexmediaserver"
service plexmediaserver stop
echo "[INSTALL] $FILE_NAME"
dpkg -i $FILE_NAME
echo "[START-SVC] plexmediaserver"
service plexmediaserver start
echo "[CLEAN] Removing $FILE_NAME"
rm -rf $FILE_NAME
echo "[DONE] Plex updated to $LATEST_VERSION"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment