Skip to content

Instantly share code, notes, and snippets.

@arevindh
Created December 14, 2024 04:49
Show Gist options
  • Save arevindh/1da03c7c1a819182fbbdf76e0c0514cc to your computer and use it in GitHub Desktop.
Save arevindh/1da03c7c1a819182fbbdf76e0c0514cc to your computer and use it in GitHub Desktop.
Debian plex Beta install and Update
#!/bin/bash
# Plex installation script for Debian-based systems
# Update the channel parameter as required
# Variables channel 16 for stable
CHANNEL="8"
BUILD="linux-x86_64"
DISTRO="debian"
TOKEN="xxxxxxxxxxx"
PLEX_DOWNLOAD_URL="https://plex.tv/downloads/latest/5?channel=$CHANNEL&build=$BUILD&distro=$DISTRO&X-Plex-Token=$TOKEN"
TEMP_DEB="/tmp/plexmediaserver.deb"
# Update and install required packages
echo "Updating package lists..."
sudo apt update -y
echo "Installing required dependencies..."
sudo apt install -y wget apt-transport-https
# Download Plex Media Server package
echo "Downloading Plex Media Server package..."
wget -O "$TEMP_DEB" "$PLEX_DOWNLOAD_URL"
if [ $? -ne 0 ]; then
echo "Error: Failed to download Plex Media Server. Please check the URL or your internet connection."
exit 1
fi
# Install Plex Media Server
echo "Installing Plex Media Server..."
sudo dpkg -i "$TEMP_DEB"
# Fix potential dependency issues
echo "Fixing broken dependencies, if any..."
sudo apt --fix-broken install -y
# Clean up
echo "Cleaning up temporary files..."
rm -f "$TEMP_DEB"
# Enable and start Plex Media Server
echo "Enabling and starting Plex Media Server..."
sudo systemctl enable plexmediaserver
sudo systemctl start plexmediaserver
# Status
PLEX_STATUS=$(systemctl is-active plexmediaserver)
if [ "$PLEX_STATUS" == "active" ]; then
echo "Plex Media Server installed and running successfully."
echo "Access it at: http://<your_server_ip>:32400/web"
else
echo "Plex Media Server installation completed, but the service is not running. Please check the logs."
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment