Openmediavault + Plex Media Server as Home Media Server

– [ Server Introduction ] –

OpenMediaVault (OMV) is a Debian based headless Operating System (OS). I have been using this for a while now. More I use this OS more I fall in love with. Reason for this is mainly because of its beautiful web based management system, plugin system (DLNA,CUPS, Tranmission) and  its based OS.

omvImage 1.1 – OpenMediaVault (OVM) Web Interface

Openmediavault is very lite weight operating system (download here).  It has straight forward installation method. I think the only problem with installation is that it takes whole hard drive (HD) for OS installation which mean you cannot use that HD for file storage purpose. Similarly, you cannot customise the space that you would like to give to OS unlike other operating system.( So Be Carefully before you install this OS make a backup!)

There is work around for this problem either you can (1) install OS in fast pendrive or (2) you can shrink you partition after you install the OS. I prefer second option and its much safer than pendrive as anyone can unplug pendrive and whole system will stop working. I am not going to explain how to install the OS in detail.

1. For installing OS in pendrive, insert your pendrive then run the installation. It will give you option later on to install in it.

2. For installing OS in hardrive  – follow in screen setup and install everything then you need a live OS to shrink partition. I prefer Partedmagic (download). Just boot in to live OS and use Partition Editor (its a Gparted application) to shrink to the size partition to size that you want to give to os (I would prefer 20GB so that you can play around with os later). (maybe I will explain this in detail near future?)

After installation of OS you will get a ip for you server (it will show your ip on your monitor). Just go to other computer at home and type that ip in your chosen browser (I prefer chrome but its up to you). It will now show you the login box. For the first time your login detail will be

User Name: admin
Password: openmediavault

To change the password, after you login you can do this

System -> General Settings ->Web Administrator password

Next thing we need to do is to enable ssh service. We need this to run different terminal command in server. Not everything can be done from web management system.

Go to Services -> SSH -> Enable (tick) ->OK

Again you need to download SSH client, if you are using Linux or Mac OS its build in system but for Windows system you need to download SSH client. My favorite SSH client for windows is putty (download). Putty is very user friend application. One does not need to spend more than 10 min to connect to SSH server.

puttyImage 1.2 – Putty

We will be using SSH to run different command remotely in server.

– [ End of Server Pre-Setup ] –
– [ Plex Media Server Introduction ] –

After this, we will install Plex Media Server (PMS) in server. Plex Media Server (PMS) is a server application which auto manage the media content and serves it to different platform. You can find its client apps in Windows & Mac OS as well as in mobile platform (iOS, Android) plus it can also be install in Apple TV, its build in Google TV, LG Connected Devices, Roku.

myplexImage 2.1 – Plex Media Server (PMS) Web Manager

Installing PMS in OpenMediaVault (OMV)

1. First thing we should know is that OMV is not ground up build system. It is based on Debian System. So anything that runs in debian will run in OMV. Plex Media Server (PMS) does run in debian system but not in direct way. PMS has .deb installation file which are base on Ubuntu OS (which like OMV is base on debian too). Lets start the installation, first you need to add repo (its a web link where file are kept) in source.list file in OMV.

Connect to SSH and run following command in order.

apt-get update
apt-get install curl

Add this line deb http://shell.ninthgate.se/packages/debian squeeze main

echo “deb http://shell.ninthgate.se/packages/debian squeeze main” >>/etc/apt/sources.list
apt-get update
apt-get install plexmediaserver

These command will add repo “deb http://shell.ninthgate.se/packages/debian squeeze main” to /etc/apt/source.list and keys to login to web. If everything went well without the error then plexmediaserver should be install.

Now check if plexmediaserver is running or not

/etc/init.d/plexmediaserver status

if it says “Plex Media Server process running” then PMS is running.(Please go to client browser and type http://serverip:32400/web to verify it) If it gave error like file not found or “Plex Media Server process not running” then it might be due to two possible reason. Either the installation didn’t add user plex or there is no file called plexmediaserver in /etc/init.d/

Either way the solution I found will work. We need to run PMS as root user. Follow the steps below

export LD_LIBRARY_PATH=/usr/lib/plexmediaserver

Now we need to check if there is plexmediaserver file in /etc/init.d/ or not

nano /etc/init.d/plexmediaserver

If this gives you empty editor then copy following code.


#!/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

test -f “/usr/lib/plexmediaserver/start.sh” || exit 0

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 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

Now, we need to change plex to root in /etc/default/plexmediaserver files

nano /etc/default/plexmediaserver

At line 19 change plex to root again.

Now run

chmod 775 /etc/init.d/plexmediaserver
/etc/init.d/plexmediaserver restart

Check if plex is running or not

/etc/init.d/plexmediaserver status

If it says “Plex Media Server process running.”

Now goto your client computer (i.e laptop / tab) and goto browser and type

[your server ip]:32400/web

It will show you the Plex’s web management system where you can add/remove contain.

NoticeNote: Using root user to run any application is not recommended, specially if you are concern about security. And If you use root to run PMS, every time you update PMS you need to go back to /etc/init.d/plexmediaserver, delete it and rename plexmediaserve.dpkg to plexmediaserver and restart demon.
 – [ End of Plex Media Server Installation ] –
– [ Optional for OMV- Moving PMS Library ] –

If you are like me who have small partition for you OS then you might need to think of moving Plex Media Server Application Library to different partition.

The easiest solution that I found is to make symbolic link of your Library folder.

First copy all the files from your library to other partition. (I am running PMS as root if you are using any other user then you need to change root to that user name)

cp -avr /root/Library /media/[partition name]/Library

Just in Case make a backup

mv /root/Library  /root/Library.bak

Now Symbolic link your Library folder

ln -s /media/[partition name]/Library /root/Library
– [ End of Optional for OMV- Moving PMS Library ] –

 
 

Advertisements

70 thoughts on “Openmediavault + Plex Media Server as Home Media Server

  1. Pingback: Plex Media Server Management | Linux+

  2. I like what you guys are up also. Such intelligent work and reporting! Carry on the superb works guys I have incorporated you guys to my blogroll. I think it’ll improve the value of my website 🙂

  3. Pingback: Openmediavault + Remote Access | Linux+

  4. I visited a lot of website but I think this one has got something special in it. “Let your life lightly dance on the edges of Time like dew on the tip of a leaf.” by Rabindranath Tagore.

  5. Pingback: Openmediavault + Deluge 1.3.6 | Linux+

  6. Hi FACTRO.

    I simply cannot get this to work. I get this message when running the apt-get update command:

    root@NAS:~# apt-get update
    E: Type ‘“deb’ is not known on line 1 in source list /etc/apt/sources.list.d/plexmediaserver.list
    E: The list of sources could not be read.

    I need your help

    Regards,
    Daniel

    • Here is what it looks in mine..

      deb http://plex.r.worldssl.net/PlexMediaServer/ubuntu-repo lucid main

      Try this
      nano /etc/apt/sources.list.d/plexmediaserver.list
      then add that line and delete any other line..

  7. Oh my god it worked! After so many headaches and tries! Thanks a bunch! One more question for you. If i reboot/shutdown my OMV machine – will the plex media server automatically start when my OMV machine boots back up again or will I have to manually start it up each time?

    Regards,
    Daniel

  8. yes it will.. the only problem you will have later is…when you update plex, script for plex in /etc/init.d/ folder will not work..
    .
    work around for this : when plex updates it will backup /etc/init.d/plexmediaserver ->/etc/init.d/plexmediaserver.dpkg and creates a new plexmediaserver file in there..which won’t work (its for ubuntu not for debian), what you need to do is delete the new plexmediaserver file and rename plexmediaserver.dpkg > plexmediaserver …
    and /etc/init.d/plexmediaserver start
    unfortunately , you have to do this every time it update…:(

    • Okay thanks for the info. Is there any way of disabling update. That way I can update manually when I’m ready to mess with the scripts again

      Regards,
      Daniel

      • I don’t think OMV updates automatically!.. what you need to do is, use omv web interface to update.. you can deselect plex when you update..

  9. Greetings,
    Awesome tutorial but I’m having an issue. when I try to execute /etc/init.d/plexmediaserver restart
    I get bash: /etc/init.d/plexmediaserver: Permission denied
    I’m running as root. Any clue why this would happen?

      • I was able to run your code but the restart did nothing. Then, I ended up copying your code your provided in your tutorial to the /etc/default/plexmediaserver. Where could I get the original code? Or should I just reinstall PMS?

  10. after you copy that code, save it and chmod 777 /etc/init.d/plexmediaserver
    /etc/init.d/plexmediaserver restart. If it didn’t work please check my reference.. 🙂

    Link to my plexmediaserver file..
    http://db.tt/bbsves7b

    after download change plexmediaserver.txt to plexmediaserver

  11. and can you check this /etc/init.d/plexmediaserver status after you restart, if its says its still not running download my plex files and replace it with yours and restart. It should work!..

    • I thought that code only went into the /etc/init.d/plexmediaserver? I seem to remember something different in the /etc/default/plexmediaserver file?

  12. yes code only goes to /etc/init.d/plexmediaserver file.. that should have root as user in it..

    I think its best you delete the old plexmediaserver file in /etc/init.d.. and download / upload the files I have in dropbox and change the permission and start. This should work.

    PS. while uploading plexmediaserver file dont forget to remove txt extension.

    • Just to clarify, you only had one file in your dropbox. As you suggested, I deleted my plexmediaserver file in /etc/init.d. I removed the .txt extension, moved the file, ran the chmod and I’m closer but still coming up short:
      root@Ultra:~# chmod 777 /etc/init.d/plexmediaserver
      root@Ultra:~# /etc/init.d/plexmediaserver restart
      Plex Media Server is not running (no process found)…
      Starting Plex Media Server: done
      root@Ultra:~# /etc/init.d/plexmediaserver status
      It seems that Plex Media Server isn’t running (no process found).

  13. Yes its just one files, have you run this command
    export LD_LIBRARY_PATH=/usr/lib/plexmediaserver
    as root?
    and try restarting the plexmediaserver again.

    PS. which os are you trying to running this in? OMV, Debian, Ubuntu..

    • I have. I followed those steps when I saw the message. the /etc/default/plexmediaserver still contains the same code as the /etc/init.d/plexmediaserver. I could have sworn this was different from the /etc/default/plexmediaserver file.

  14. /etc/default should be different..

    it should be like this

    ==copy from below===

    # 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= /media/to/you/temp folder/

    # 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=root

    ==Don’t copy from here====

    PLEX_MEDIA_SERVER_TMPDIR, you should change this to any local folder you want to use as tmp folder..

    • And now I’m in business! Thanks mate! I just saw the link you provided in PlexApp’s forums. Sorry to hijack your post but hopefully it’ll help others like me

  15. Hi, I’m a bit confused as im a newbie to all things Linux. I’ve got Plex Media Server running with your article above. I’ve updated Plex/Web to latest version via the plex webpage–>settings—>check for update, but how do i update Plex media server? There are comments above regarding /etc/init.d/plexmediaserver file are these to do with upgrading PMS or something else?? Sorry if this has been asked already i’m just getting confused with all this code!!!

    • To update your plex server, you need to run apt-get update && apt-get upgrade in terminal and it will upgrade all new updates in your system including plex or goto OMV update section and update from there.. (here you will have option to update selected files or if you don’t want to update other files then just select plex and update)

      And about /etc/init.d/plexmediaserver its a daemon script for plex, it has nothing to do with plex update. (Just for inform – when you update plex it will also update this script so if you are using root user to run plex then you might need to delete new plex script and then rename plexmediaserver.dpkg to plexmedaserver and /etc/init.d/plexmediaserver start)

      • Thanks Factro! i ran apt-get update && apt-get upgrade and it says there were 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. The OMV update section is currently empty as all updates were done when OMV released an update.

        I read somewhere that under Users in OMV web admin there should be a user called plex. Im guessing as i ran plex as root this may not appear?? Is there a way to switch to a normal user and not root as i hear its not the best way to run software in a linux environment.

        Just to confirm my version of plex media server is 0.9.7.22. The plex website states the latest version is 0.9.7.28.33.

      • yes there is a way to switch from root to plex. If you have followed all the steps it should have created a plex user in your system.

        run this in terminal

        cat /etc/passwd

        and see if there is plex in it. If its there then goto

        nano /etc/default/plexmediaserver

        and change root to plex.

        nano /etc/init.d/plexmediaserver

        and change root to plex

        and if you have already added media in your plex library then do this first

        mkdir /home/plex/Library
        cp -r /root/Library/* /home/plex/Library/
        chmod -R 775 /home/plex/Library

        Then restart your plex server

        /etc/init.d/plexmediaserver restart

        (and if you have not added anything then just do this)

        And about version don’t worry for now.. if its working then its fine.. 🙂

  16. Thanks very much for that very informative how-to … I now have Plex running on my HP Microserver with OMV. One (minor) question – how would I install the PlexPass versions of the Plex Media Server? (I’m fully paid up.) I see http://shell.ninthgate.se/packages/debian/dists/ contains a ‘squeeze’ folder which we installed from, but it also contains a ‘plexpass’ folder. Replacing the word ‘squeeze’ with ‘plexpass’ in /etc/apt/source.list.d/plexmediaserver.list didn’t do it, but I was probably expecting too much 🙂

    • Glad to hear that everything worked for you. 🙂 About plexpass, I am not sure about it cause I don’t have one.. but I think you don’t need to install special version of plex for plexpass?

      After installation of plex you should be able to login to your plexpass account from its web manager which should enable the plexpass function.. again am not sure try plex forums (http://forums.plexapp.com/) for more help 🙂

  17. right you are talking about beta version.. if you can get deb (for ubuntu) file.. you can try installing it in OMV.. but files will be in different place and bit difficult to run it..

  18. I think the server is back online and the steps above are working, I have used deb before to install plex and it worked for me.. and yes you need avahi-daemon too, I forgot to mention that.. but try normal way rather than installing from deb first.

    • okey i will try your guide again bcos it’s more simple 🙂 but now i can’t log in with putty via ssh it gives me putty fatal error network refused….aarrgghh

      • Yes i already did enable ssh via webgui, at the moment am trying to run omv from usb not from hdd, since i reboot i can no longer access via ssh but i can via telnet strange….and everytime i shutdown omv it stuck it won’t shut, maybe there’s bug with the new omv.

      • ya usb is not the best idea to run your OS.. 😦 , I know you can run OMV in USB but because its not live OS.. it might run into different problem.. like yours..

  19. Right i guess fresh install again to hdd and resize its partition with gparted, but i’ve done install to hdd and i got a problem with smb share i can’t access over network it always ask user name and pass, i tried log in as root, myusername still it won’t let me connect….jiii whats wrong with omv

    • Okay, lets start from beginning, go to omv web UI
      1. create new user and give password (I don’t think you can user root for smb)
      2. create share folder
      3. give permission to new user to that folder (read / write)
      4. create smb share
      Done.

  20. Run Plex Media Server with any user

    1) Go to WebGUI –> Create a user –> Grant SMB and ACLs access to movies folder for the new user (see openmediavault forums if you dont know how to)

    2) Change the home for the new user to /var/lib/plexmediaserver

    edit /etc/passwd

    replace this
    :
    newuser:x:1000:100:PlexMediaServer:/home/newuse:/bin/bash

    with this:

    newuser:x:1000:100:PlexMediaServer:/var/lib/plexmediaserver:/bin/bash

    3) Change owner of /var/lib/plexmediaserver

    chown newuser:users -R /var/lib/plexmediaserver

    4) edit /etc/default/plexmediaserver

    replace:
    PLEX_MEDIA_SERVER_USER=plex

    with:
    PLEX_MEDIA_SERVER_USER=newuser

    5) Restart plex media server

    /etc/init.d/plexmediaserver restart

  21. Thanks for your tutorial, it’s still quite a help. Unfortunately, when I go to log in on the webserver, it tells me

    “This media server is unavailable to you.
    Please check that you have permission to access this media server.” The only thing I’ve found with googling is that somebody’s system clock was off and caused this error. I just double checked and mine’s fine

  22. Hey, I have been going back and forth, trying different streaming media services. After trying out KODI for a bit I decided to go back to PMS. I have an older tv and I’ve got my OMV/PMS box hooked with a VGA to my screen… I was looking all over for an answer to the question, “how to watch from a OMV/PMS machine” in almost every possible variant. No luck. Do you possibly have any insight into this? I’ve been using your tutorials for every one of my test installs and I really appreciate all the work you’ve put into this. Thanks for your time
    -Elliott

    • You mean to have a server as well as client in same machine? if that’s the question, then its really easy (for windows) but for linux system, I think you should try ubuntu rather than OMV as OMV does not have GUI. But you can try installing gui like LXDE and try to install PMS client but I think PMS client does not work properly with linux system.

  23. Hi guys, i’m using pms 0.9.12.1 on omv 0.5.60 and I have issues with dlna and some films, playing on sony bravia kdl-55w805b. I found xml sony profile that may help but adds in dlnaclientprofiles.xml are not used (neither kept after reboot) and I didn’t manage to make plex use lone file. could somebody tell me where is the dlna profiles User folder ? thank you

  24. Got a ways down the road with setting up my first OMV / Plex system as described (terrific by the way) …only to discover that there is a lack of Debian drivers for the system’s Realtek sound card. Apparently Ubuntu Server has updated drivers for such. Is there a way of using a stripped Ubuntu Server as a basis for OMV?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s