Install Plex Media Server Raspberry Pi 2 + 3 manually to get the latest Plex Pass version. uglymagoo on the Plex forum has done the Pi community a great service by providing a repository to easily install the latest Plex Media Server on the Raspberry Pi. Because paying Plex Pass users always have access to a private latest version, uglymagoo cannot legally keep this version in his repository.
This guide is essentially a manual version of what uglymagoo's repository does when you install Plex. Essentially you are going to download the latest NETGEAR ReadyNAS version for Plex Pass which has transcoding enabled by default so no more javascript hacks are necessary. I used the minimal Raspbian distribution Minibian for this guide, when you are done Plex will also autostart on boot. If you are looking for a ready made image for the Pi 2 or Pi 3 that has Plex you can just upgrade see the other guide (that works on the Pi 2 and 3).
Pi Unit | ||||||||
---|---|---|---|---|---|---|---|---|
Raspberry Pi 3 | Quad Core | |||||||
Raspberry Pi 2 | Quad Core | |||||||
Raspberry Pi | Single Core | |||||||
Banana Pi | Dual Core | |||||||
Banana Pi Pro | Dual Core |
Install Plex Media Server Manually Raspberry Pi 2 + 3
Plex Media Server requires a few components to work properly:
- Make sure you have the en_US locale
- Make sure sure you have libc6 version 2.19 or greater by using Minibian or Raspbian Jessie or later
Generate Locales
First we need to verify the en_US locale is enabled.
This command lists current locales
locale -a
My output looks like this
C
C.UTF-8
en_US.utf8
POSIX
If you don't have en_US.utf8 you can generate it.
To generate the locale, edit the locale generator configuration file first to enable the locale
sudo nano /etc/locale.gen
Uncomment this line by deleting the #
# en_US.UTF-8 UTF-8
Ctrl+X, Y and Enter to save
Now generate the locales
sudo locale-gen
If you get the locale-gen cannot be found error this should solve it
echo "export PATH=$PATH:/usr/sbin" >> ~/.profile
Now generate the locales again if locale-gen wasn't found
sudo locale-gen
Reconfigure locales for good measure (source)
sudo dpkg-reconfigure locales
Install Plex Media Server Manually Raspberry Pi 2 + 3
Install the Plex Media Server dependencies
sudo apt-get install binutils libexpat1-dev libc6 -y
Go get the download link from https://plex.tv/downloads under the NETGEAR tab right click ARM 6.x RN2xx and copy the link to the clipboard.
Plex Pass users who want the latest version not available to the public will have to find the equivalent download link.
Replace the red text below with the download link, make sure to scroll all the way to the right for the full command.
cd /tmp
wget https://downloads.plex.tv/plex-media-server/0.9.16.6.1993-5089475/plexmediaserver-ros6-binaries-annapurna_0.9.16.6.1993-5089475_armel.deb -O plex.deb
Make the Plex Media Server directory
sudo mkdir -p /usr/lib/plexmediaserver
Unpack the Plex package
sudo ar p plex.deb data.tar.gz | tar -xzf - -C /usr/lib/plexmediaserver/ --strip-components=4 ./apps/plexmediaserver-annapurna/Binaries
Remove the config.xml file
sudo rm /usr/lib/plexmediaserver/config.xml
Create the Plex user
sudo adduser --quiet --system --shell /bin/bash --home /var/lib/plexmediaserver plex
Make the Plex user the owner of the Plex Media Server directory
sudo chown plex -R /usr/lib/plexmediaserver
Autostart Plex Media Server Raspberry Pi 2 +3
Make the Plex configuration file which the init.d script pulls variables from
sudo nano /etc/default/plexmediaserver
Paste the default Plex configuration file – note this is where you can change the user Plex runs under.
# default script for Plex Media Server
# the number of plugins that can run at the same time
PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS=6
# ulimit -s $PLEX_MEDIA_SERVER_MAX_STACK_SIZE
PLEX_MEDIA_SERVER_MAX_STACK_SIZE=3000
# where the mediaserver should store the transcodes
PLEX_MEDIA_SERVER_TMPDIR=/tmp
# uncomment to set it to something else
# PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR="${HOME}/Library/Application\ Support"
# the user that PMS should run as, defaults to 'plex'
# note that if you change this you might need to move
# the Application Support directory to not lose your
# media library
PLEX_MEDIA_SERVER_USER=plex
Ctrl+X, Y and Enter to save
Make Plex the owner of its configuration file
sudo chown plex /etc/default/plexmediaserver
Create the start_pms file which the init.d script uses to load Plex
sudo nano /usr/sbin/start_pms
Paste this currently confirmed working start_pms script
#!/bin/sh
#change these parameters in /etc/default/plexmediaserver
export PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS=6
export PLEX_MEDIA_SERVER_HOME=/usr/lib/plexmediaserver
export PLEX_MEDIA_SERVER_MAX_STACK_SIZE=3000
export PLEX_MEDIA_SERVER_TMPDIR=/tmp
export PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR="${HOME}/Library/Application Support"
test -f /etc/default/plexmediaserver && . /etc/default/plexmediaserver
if [ ! -d "$PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR" ]
then
mkdir -p "$PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR"
if [ ! $? -eq 0 ]
then
echo "WARNING COULDN'T CREATE $PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR, MAKE SURE I HAVE PERMISSON TO DO THAT!"
exit 1
fi
fi
export LD_LIBRARY_PATH="${PLEX_MEDIA_SERVER_HOME}"
export TMPDIR="${PLEX_MEDIA_SERVER_TMPDIR}"
echo $PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS $PLEX_MEDIA_SERVER_MAX_STACK_SIZE $PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR
ulimit -s $PLEX_MAX_STACK_SIZE
(cd /usr/lib/plexmediaserver; ./Plex\ Media\ Server)
Ctrl+X, Y and Enter to save
Make Plex the owner of start_pms
sudo chown plex /usr/sbin/start_pms
Make start_pms executable
sudo chmod +x /usr/sbin/start_pms
Create the Plex init.d script
sudo nano /etc/init.d/plexmediaserver
Paste this working Plex init.d script
#!/bin/sh
### BEGIN INIT INFO
# Provides: plexmediaserver
# Required-Start: $remote_fs $syslog $networking
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Plex Media Server
# Description: Plex Media Server for Linux,
# More information at http://www.plexapp.com
# Many thanks to the great PlexApp team for their wonderfull job !
# Author: Cedric Quillevere / origin@killy.net
# Rewamped Christian Svedin / christian.svedin@gmail.com
# Version: 1.2
### END INIT INFO
# Read configuration variable file if it is present
[ -r /etc/default/plexmediaserver ] && . /etc/default/plexmediaserver
plex_running=`ps ax | grep "\./Plex Media Server" | awk '{ print $1 }' | wc -l`
case "$1" in
start)
if [ "$plex_running" -gt 1 ]; then
echo "Plex already running..."
exit 0
fi
echo -n "Starting Plex Media Server: "
su -l $PLEX_MEDIA_SERVER_USER -c "/usr/sbin/start_pms &" >/dev/null 2>&1
sleep 1
echo "done"
;;
stop)
if [ "$plex_running" -eq 1 ]; then
echo "Plex Media Server is not running (no process found)..."
exit 0
fi
echo -n "Killing Plex Media Server: "
# Trying to kill the Plex Media Server itself but also the Plug-ins
ps ax | grep "Plex Media Server" | awk '{ print $1 }' | xargs kill -9 >/dev/null 2>&1
ps ax | grep "Plex Plug-in" | awk '{ print $1 }' | xargs kill -9 >/dev/null 2>&1
ps ax | grep "Plex DLNA Server" | awk '{ print $1 }' | xargs kill -9 >/dev/null 2>&1
sleep 1
echo "done"
;;
restart)
sh $0 stop
sh $0 start
;;
status)
if [ "$plex_running" -gt 1 ]; then
echo "Plex Media Server process running."
else
echo "It seems that Plex Media Server isn't running (no process found)."
fi
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
;;
esac
exit 0
Ctrl+X, Y and Enter to save
Make the Plex init.d script executable
sudo chmod +x /etc/init.d/plexmediaserver
Tell the system to use the Plex init.d script
sudo update-rc.d plexmediaserver defaults
Start the Plex Media Server service
sudo service plexmediaserver start
Plex will be available on its default port 32400 which can be accessed at http://ip.address:32400/web
Check out additional hard drives for your media
USB Hard Drive Model | |||
---|---|---|---|
Western Digital My Passport Ultra Portable Hard Drive | |||
Western Digital My Passport Ultra Portable Hard Drive |