Not everyone runs PMS on their desktop machine, and I believe this oversight with links is due to Windows users expecting to have GUI on their “servers”.
The link you show is a directory reference, not a discrete file URL. If you used the direct file URL, you would get the results you appear to expect which works well with wget
The downloads page is structured and written for interactive selection and download due to the existence of Public & Beta package availability which requires the user select the version as latest public != latest beta. It has nothing to do with Windows. It is OS agnostic.
To somewhat answer my own question the following will get a real download link that could be used with wget/curl: curl -s "https://plex.tv/downloads/details/1?build=linux-ubuntu-x86_64&channel=16&distro=ubuntu" | grep -Po '(?<=url=\")(\S+)(?=\")'
I believe ChuckPA completely misunderstood my question.
To clarify, one needs a non JS generated link that they could put in a cron job to automate update of the plex media server on their headless server (as in no GUI/screen).
As bonus here is how to get version of the “latest” download: curl -s "https://plex.tv/downloads/details/1?build=linux-ubuntu-x86_64&channel=16&distro=ubuntu" | grep -Po '(?<=(\" version=\"))(\S+)(?=(\"))'
Regarding the comment about URL to a directory vs URL to file, URL is URL, and from webserver/webapplication point of view it does not make any difference. Here is a quick example I made: https://sergei.nz/directory/ will 302 redirect to https://sergei.nz/file .
I’ve done this script based on information I could find around, it does the job
#!/bin/bash
#####
#
# This Script will update Plex Media Server to the latest version for Ubuntu
#
# To automatically check & update plex, run "crontab -e" and add the following lines
#
# # Check for Plex Media Server Updates every day @6:00 am
# 0 6 * * * /root/update-plexmediaserver.sh
#
# 2018 - Matthieu Guerry
#
###
# Check Current installed version and exit if latest is already installed
VersionInstalled=$(dpkg -s plexmediaserver | grep -Po '(?<=Version\: )(\S+)')
VersionAvailable=$(curl -s "https://plex.tv/downloads/details/1?build=linux-ubuntu-x86_64&channel=16&distro=ubuntu" | grep -Po '(?<=(\" version=\"))(\S+)(?=(\"))')
if [ $VersionAvailable = $VersionInstalled ]; then echo "Plex Media Server is already up-to-date (version $VersionInstalled)"; exit; fi
# Download latest installation package to /tmp folder
curl -s "https://plex.tv/downloads/details/1?build=linux-ubuntu-x86_64&channel=16&distro=ubuntu" | grep -Po '(?<=url=\")(\S+)(?=\")' | xargs wget -P /tmp/
# Stop Plex Service
sudo service plexmediaserver stop
# Install latest version
sudo dpkg -i /tmp/$(curl -s "https://plex.tv/downloads/details/1?build=linux-ubuntu-x86_64&channel=16&distro=ubuntu" | grep -Po '(?<=fileName=\")(\S+)(?=\")')
# Start Plex Service
sudo service plexmediaserver start
# Remove installation package from /tmp folder
rm /tmp/plexmediaserver_*
Here is mine for FreeBSD, it’s probably not very optimzed, but it works
#!/usr/bin/env bash
installed=$(cat $HOME/bin/version.txt) #you need to fill this file with your version first
version=$(w3m -dump https://plex.tv/downloads/details/1?build=freebsd-x86_64&channel=16&distro=freebsd | awk ‘/Release id/ {print $3}’ | cut -d “”" -f 2) #backslash before 2nd double cote doesn’t appear
arch=“freebsd-amd64”
plex_tmp=“PlexMediaServer-${version}”
plex_dir=“plexmediaserver”
plex_dir_old=“plexmediaserver_old”
plex_path="/usr/local/share"
if [ ${installed} == ${version} ]
then
echo “installed : $installed”
echo “current : $version”
echo “No update available”
else
echo “installed : $installed”
echo “current : $version”
echo “Update available, do you want to update ? (Y/n)”
read answer
if [ ${answer} == “n” ] ; then
exit 0
else
echo ${version} > $HOME/bin/version.txt
wget https://downloads.plex.tv/plex-media-server/${version}/PlexMediaServer-${version}-${arch}.tar.bz2
archive=“PlexMediaServer-${version}-${arch}.tar.bz2”
tar -xvf ${archive} > /dev/null 2>&1
rm PlexMediaServer-${version}-${arch}.tar.bz2
mv ${plex_tmp} ${plex_dir}
cd ${plex_dir}
ln -s “Plex Media Server” Plex_Media_Server
cd ${plex_path}
if [ -d ${plex_dir_old} ] ; then
sudo rm -rf ${plex_dir_old}
sudo mv ${plex_dir} ${plex_dir_old}
sudo mv $HOME/${plex_dir} ${plex_path}/
sudo service plexmediaserver restart
else
sudo mv ${plex_dir} ${plex_dir_old}
sudo mv $HOME/${plex_dir} ${plex_path}/
sudo service plexmediaserver restart
fi
fi
fi
Room21, This is great, I like this script. It’s easy to understand and does exactly what I was looking for. Honestly I would have been fine with just downloading the correct version and I can do the install myself but your script takes care of it. Thanks for sharing.
Thank you, that helps. For reference, in mrworf’s script I found that the correct arch for 32bit deb is i686. If you want to obtain the correct deb based on your system’s architecture, uname -m is your friend:
Is there some reason you aren’t using the package repository provided by Plex.tv? I used it when I was running Plex as deb packages, but I am now on docker.
I like this script, I use CentOS though, so I couldn’t use it as is, but I made my own changes.
I haven’t had the opportunity to see it work first hand but I believe it should work, if someone notices an error I appreciate the correction.
#!/bin/bash
#####
#
# This Script will update Plex Media Server to the latest version for CentOS
#
# To automatically check & update plex, run "crontab -e" and add the following lines
#
# # Check for Plex Media Server Updates every day @6:00 am
# 0 6 * * * /root/update-plexmediaserver.sh
#
# 2018 - Original by Matthieu Guerry - Modified by Arturo Vazquez
#
###
# Check Current installed version and exit if latest is already installed
VersionInstalled=$(rpm -q plexmediaserver | grep -Po '(?<=plexmediaserver-)(\S+)(?=\.x86_64)')
VersionAvailable=$(curl -s "https://plex.tv/downloads/details/1?build=linux-ubuntu-x86_64&channel=16&distro=redhat" | grep -Po '(?<=(\" version=\"))(\S+)(?=(\"))')
if [ $VersionAvailable = $VersionInstalled ]; then echo "Plex Media Server is already up-to-date (version $VersionInstalled)"; exit; fi
# Download latest installation package to /tmp folder
curl -s "https://plex.tv/downloads/details/1?build=linux-ubuntu-x86_64&channel=16&distro=redhat" | grep -Po '(?<=url=\")(\S+)(?=\")' | xargs wget -P /tmp/
# Stop Plex Service
systemctl stop plexmediaserver
# Install latest version
yum localinstall -y /tmp/$(curl -s "https://plex.tv/downloads/details/1?build=linux-ubuntu-x86_64&channel=16&distro=redhat" | grep -Po '(?<=fileName=\")(\S+)(?=\")')
# Start Plex Service
systemctl start plexmediaserver
# Remove installation package from /tmp folder
rm /tmp/plexmediaserver_*