New plex package.

There is a new plex package that is compatible with the armhf architechture you can try it at the following link:

http://www.htpcguides.com/install-plex-media-server-on-raspberry-pi-2/

I haven't tried it myself but it should work with minimal effort.

For help you can also check the plex forum (there is even a debian package available in this thread):

https://forums.plex.tv/index.php/topic/145717-i-have-pms-running-on-raspberry-pi-2/page-17

Introduction

The new raspberry pi 2 also contains an armv7 processor, theses instructions will also work for it if you install raspbian as a base

This is a small how-to on how I proceeded to install plex media server on my cubox-i.

Please note that this is just a dump of all the commands. This might be a little bit confusing.

The cubox-i comes with an armv7 architechture and there is no plex package for it.

The base idea of this document is to create a chroot environment with the armel architechture so the cubox-i can run a version of plex media server that is compiled for the arm architechture (armv5), the drobo package per instance.

I created this howto on Debian Wheezy for the cubox-i. Here is my installation procedure: Debian Wheezy

I suggest using the latest debian image from http://www.solid-run.com/community/topic1573.html

Warning

I am no linux expert everything is created as root user here, I'm just learning and having fun

Everything is done as ROOT this is probably a really bad idea

This is just an experiment

Please understand that english is not my primary language.

I am not responsible for any damage done to you, your cubox-i or your pet.

Install Plex Media Server into a chroot

Setup the chroot environment

apt-get install debootstrap debootstrap --no-check-gpg --arch=armel wheezy /chroots/wheezy-armel ftp://ftp.debian.org/debian/

Setup bind mounts to make it easy

In your main system add the following lines in your /etc/fstab

# Chroot bind mounts /home /chroots/wheezy-armel/home none bind 0 0 /mnt /chroots/wheezy-armel/mnt none bind 0 0 /tmp /chroots/wheezy-armel/tmp none bind 0 0 /proc /chroots/wheezy-armel/proc proc defaults 0 0 /dev /chroots/wheezy-armel/dev none bind 0 0 /dev/pts /chroots/wheezy-armel/dev/pts none bind 0 0

Mount your fiesystem

mount -a

Installing plex in your chroot

Go in your chroot

chroot /chroots/wheezy-armel/

Add chroot indication in prompt

echo wheezyArmel > /etc/debian_chroot

Exit and reenter in your chroot and your prompt will look like this: (wheezyArmel)root@cubox-i:

Correct the locales

apt-get install locales locale-gen en_US en_US.UTF-8 hu_HU hu_HU.UTF-8 dpkg-reconfigure locales

Fix some ischroot issues

dpkg-divert --divert /usr/bin/ischroot.debianutils --rename /usr/bin/ischroot ln -s /bin/true /usr/bin/ischroot

Download and extract plex

I did pick as a base the Drobo build which is compatible arm / armel architechture

cd /tmp mkdir plex cd plex wget http://downloads.plexapp.com/plex-media-server/0.9.9.12.504-3e7f93c/plex.tgz tar -zxvf plex.tgz mkdir -p /opt/plex/ mv Application/ /opt/plex mkdir -p "/opt/plex/Library/Application Support"

Create a plex launcher

vi /usr/local/bin/plexmediaserver

Paste this inside

#!/bin/sh SCRIPTPATH = /opt/plex/Application export LD_LIBRARY_PATH = " ${ SCRIPTPATH } " export PLEX_MEDIA_SERVER_HOME = " ${ SCRIPTPATH } " export PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS = 6 export LC_ALL = "en_US.UTF-8" export LANG = "en_US.UTF-8" export PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR = "/opt/plex/Library/Application Support" ulimit -s 3000 /opt/plex/Application/Plex \ Media \ Server

Make it executable

chmod +x /usr/local/bin/plexmediaserver

Check that plex is running correctly from inside the chroot

plexmediaserver &

You should have access to your plex server at the following address

http://<<Your IP Address>>:32400/web/index.html

Make plex startable from the host system

Go back to your host system (exit the chroot)

exit

Install dchroot

apt-get install dchroot

edit (or create) /etc/dchroot.conf

vi /etc/dchroot.conf

and add

# wheezyArmel chroot wheezyArmel /chroots/wheezy-armel

edit /etc/schroot/schroot.conf

vi /etc/schroot/schroot.conf

and add

[wheezy-armel] description = Contains the PLEX program aliases = wheezyArmel directory = /chroots/wheezy-armel

Now you should be able to start plex from the main host with the folowing command

dchroot -c wheezyArmel -d /usr/local/bin/plexmediaserver --directory /

Make plex start seamlessly

Create a chroot "caller"

vi /usr/local/bin/do_chroot

paste the following

#!/bin/sh ARGS = "" for i in " $@ " ; do ARGS = " $ARGS ' $i '" done exec dchroot -c wheezyArmel -d -q "`basename $0 `" " $ARGS " --directory /

Make it executable

chmod +x /usr/local/bin/do_chroot

Make a link to plexmediaserver.

ln -s /usr/local/bin/do_chroot /usr/local/bin/plexmediaserver

This looks like black magic, but the do_chroot will read the link name from the prompt and execute the same command in the chroot environment

Now you should be able to seamlessly start plex from the main host

plexmediaserver &

Auto start plex with your cubox-i

Create an init.d script

vi /etc/init.d/plexmediaserver

Paste the following

#!/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 # Adapted (cubox-i) Francis Belanger / francis.belanger@gmail.com # Version: 1.2 ### END INIT INFO # Read configuration variable file if it is present [ -r /etc/default/plexmediaserver ] && . /etc/default/plexmediaserver test -f "/usr/local/bin/plexmediaserver" || exit 0 plex_running = ` ps ax | grep "/opt/plex/Application/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/local/bin/plexmediaserver &" >/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 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

Make it executable

chmod +x /etc/init.d/plexmediaserver

Update rc to enable your new script

update-rc.d plexmediaserver defaults

Reboot and voilà Plex should start automatically with your cubox.

If you have issues loading the plex interface, try to delete the cache folder