Plex Media Server on a Raspberry Pi 3

I wanted to document the instructions shared on Episode 459 to supplement the episode.

On the show, Jeff and I demonstrated how to turn a Raspberry Pi 3 with Raspbian Jessie into a Plex Media Server, giving you the chance to stream your entire video and music library to all your devices.

I won’t get into the full details here, since this is only a supplement to give you some copy-and-paste instructions, but I’d encourage you to watch the video.

What You Need

  1. A Raspberry Pi 3 Micro Computer. Please consider purchasing it through our store to support what we do: https://cat5.tv/pi
  2. Raspbian Jessie – A free download from raspberrypi.org
  3. Obvious stuff like a good MicroSD card, Ethernet cable (preferred as opposed to wifi), keyboard and mouse… etc.

How to Do The Do
Updated February 7, 2018
due to some evolution of the process. These steps are more current than those used in the video (a new video will be coming soon).

  1. In terminal, upgrade your distro to the latest and greatest.
    sudo apt update
    sudo apt upgrade
    sudo apt dist-upgrade
  2. Reboot the Pi.
    sudo reboot
  3. Add the ability for apt to use https repositories. If you already have this, it’ll report as “already the current version” and you can move on.
    sudo apt install apt-transport-https
  4. Add the Plex Media Server repository provided by Universität Leipzig.
    echo "deb https://dev2day.de/pms/ jessie main" | sudo tee /etc/apt/sources.list.d/pms.list
  5. Add the GPG key for the repository.
    This is the “easy” method (which didn’t work for us because my keyboard was in some weird mode with no pipe character):

    wget -O - https://dev2day.de/pms/dev2day-pms.gpg.key | sudo apt-key add -

    Alternate method (which I had to use on the show since I didn’t have a pipe character… I’ve cleaned it up a bit since the live show so it is cleaner since it was an unexpected twist and I kinda made it seem more confusing than it should):

    wget -O /tmp/pms.key https://dev2day.de/pms/dev2day-pms.gpg.key
    sudo apt-key add /tmp/pms.key
  6. Update apt.
    sudo apt update
  7. Install Plex Media Server.
    sudo apt install plexmediaserver-installer
  8. Create the default config file so Plex knows what user to operate under.
    echo "PLEX_MEDIA_SERVER_USER=pi" | sudo tee -a /etc/default/plexmediaserver
    sudo chown -R pi:pi /var/lib/plexmediaserver
    sudo service plexmediaserver restart

    (Thanks to Steve for submitting this additional step)

  9. Reboot one final time.
    sudo reboot

And there you have it! All the commands we used to get Plex Media Server installed on a Raspberry Pi 3 in a nice clean blog post  🙂

Optional: Use External Storage for Media

From there, we plugged in the USB flash drive (don’t do it! Use a proper external hard drive–this was only a demonstration) and after it mounted we used the following command to see its /dev assignment:

sudo mount

Since our drive was /dev/sda1, and of the filesystem type “fat32” this is what I did to make it work as the media library for Plex Media Server:

sudo nano /etc/fstab

and add the following line:

/dev/sda1 /mnt/library fatfs defaults 0 0

I then created the mountpoint:

sudo mkdir /mnt/library

and made it so it can only be written to if mounted:

sudo chattr +i /mnt/library

and finally, mounted the drive:

sudo mount -a

From there, I could easily add folders on my external drive to Plex using the web interface, which you’ll find on Port 32400 in the /web subfolder on your Pi.

To get my IP address, I brought up the terminal on the Pi and typed:

sudo ifconfig

That showed the IP address of my Pi under “Ethernet”… 192.168.0.105

So to open Plex in my browser, from my computer I entered:

192.168.0.105:32400/web

The IP address will most likely be different for yours, and you might even want to set it up as a static IP. Easiest way to do that would be to use your router’s DHCP reservations to hard-set the Pi to something outside your DHCP pool. For me, that’d be 192.168.0.5 or something like that, since the pool seemingly starts at 100.

Good luck, and if you have any questions or comments, please leave them below. Don’t forget, if this has helped you out, or if you just love supporting nice guys who wanna keep giving knowledge for free, please head over to our Patreon page, or throw a bit in the tip jar. Thanks!

0 0 votes
Article Rating
Subscribe
Notify of
guest
100 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
SiddR
SiddR
5 years ago

You also have to do this:

Edit plexmediaserver.service and change the user and group to pi.

sudo nano /lib/systemd/system/plexmediaserver.service

User=pi
Group=pi

Stephen
Stephen
5 years ago

Followed the instructions, still failed to load Plex service properly.

Plex – changes I had to make

/etc/default/plexmediaserver not listed
Showing as /etc/default/plexmediaserver.prev
I did sudo cp plexmediaserver.prev plexmediaserver

Also in /etc/default/plexmediaserver
Edit this line to point it at the right location (sudo nano /etc/default/plexmediaserver)
PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=/var/lib/plexmediaserver/Library/Application\ Support

sudo pico /lib/systemd/system/plexmediaserver.service
User=pi (was Plex)
Group=pi (was Plex)

Shawn
Shawn
5 years ago
Reply to  Stephen

Stephen, you saved me on this, I had followed all the steps and it was not working. I checked your findings and mine was just as you had said. After making the changes, I did
sudo service plexmediaserver restart
and the terminal command instructions told me to reload, U followed those instructions and it let me into the web app and I logged into my Plex account.

Ron Kierstead
Ron Kierstead
5 years ago
Reply to  Stephen

Brilliant. I installed it according to the instructions provided on this webpage, then when the website failed to load, I used your changes to get this working.

I did have to issue “sudo shutdown -r now” before I was able to call up the webpage.

Thanks!

Merlin
Merlin
5 years ago
Reply to  Stephen

Hey this fixed mine

sudo pico /lib/systemd/system/plexmediaserver.service
User=pi (was Plex)
Group=pi (was Plex)

thank you, i couldnt load the webserver until i did this…

Stephen
Stephen
5 years ago

I was following along with the updated version for RPi Stretch on youtube.
I followed every step exactly. Even pulled up the web browser to localhost:32400/web when you did in the video.
Next step was to sudo apt install plexmediserver-installer
One difference I found was that when you were editing the config file /etc/default/plexmediaserver it actually shows up in my directory as /etc/default/plexmediaserver.prev

Also, for just a moment, before I had finished going through the steps, the web brower refreshed and I DID have plex running on the website. But then I did the edit to make PLEX_MEDIA_SERVER_USER=pi and chown’d /var/lib/plexmediaserver/
Since then Plex won’t come up when I look at localhost:32400/web

Arnie
Arnie
6 years ago

I followed your instructions explicitly, yet I get this error message when I try to connect to Plex from my W10 computer. And yes, I can connect to the NAS server running on the same RPi. I can also connect to SSH on the same RPi as well as the VNC. Can you suggest a solution to get the Plex to work? Here is the error message I get:

This site can’t be reached
192.168.2.106 refused to connect.
Search Google for 192 168 106 32400 web index
ERR_CONNECTION_REFUSED

Thank you. I can let you SSH or connect to my VNC if you have the time.
—Arnie

Derek
Derek
6 years ago

does the pre-built image allow for plug&play external HDD connection? or should we still follow the external HDD mounting part of the instructions above?

Jones
Jones
6 years ago

Is that still being worked on? – is there any more updates?

Marco
Marco
7 years ago

I have a issue, after perform the installation, i go to 192.168.1.100:32400/web and perform the login…But the server configuration wizard or server tab is missing, how to i can do?

Anthony
Anthony
7 years ago

Hello all,

 

I’ve recently started researching using Plex on my RPi3. I had a quick question though. If i set up my RPi3 with the plex server at home and want to bring the RPi3 with me to my college apartment, would I need to redo these steps to set up the server since I have disconnected and powered off the RPi3?

 

Thanks

Anthony
Anthony
7 years ago

If i take it to a different place with a different IP address, wont I have to redo the setup?

Anthony
Anthony
7 years ago

Thanks for the help!

michael
michael
7 years ago

I am also stuck on step 8

it comes up no such and directory

Al
Al
7 years ago

Fantastic guide, thank you for taking the time to write it! Had me up and going very quickly. I installed this on a RetroPie image so now I have both running on the one Pi… very cool.

I hit a snag with Step 8, this command didn’t work (permission error) but I added the line to the file (/etc/default/plexmediaserver) manually and it worked.

sudo echo “PLEX_MEDIA_SERVER_USER=pi” >> /etc/default/plexmediaserver

Otto
Otto
7 years ago
Reply to  Al

I have the same permission error on step 8 (bash: /etc/default/plexmediaserver: Permission denied
) also if I add the line manually.

Any idea?

Tamas
Tamas
6 years ago

Hi! I had the same issue. I had plexmediaserver.prev in etc/default folder.

Sam Pain
7 years ago

For anyone here having problems mounting an external HDD that doesn’t use a Linux based file system, NTFS for example try the solution here, just change vfat to ntfs.

https://sampain.wordpress.com/2017/02/15/adding-readwrite-permissions-when-mounting-fat32-usb-to-raspberry-pi/

I went out of my mind trying to get a 64GB usb flash drive working on my raspberry server mk1.

Now I have Plex, I have a 1TB HDD which worked after using this edit for the fstab.

Hope this helps someone.

Sam Pain
7 years ago

I must sadly admit I didn’t watch the video until the end as I became excited about my new media server and the new western digital 1TB I ordered.

I’m new to Linux so certain things aren’t always obvious but its a fun learning excerise. I think there are a lot of people out there struggling with this issue so a video would be awesome!

I’ve researched further into this subject since that blog post and managed to break my pi, needing to hook up a display as it went to emergency mode, changed the fstab quite a bit and got rather grumpy with it all, but I managed to pull info from several forums/blogs to find a solution and can now ftp my media onto my pi server hdd, yay!

Sam

Sameer
Sameer
7 years ago

I followed the above without any errors, but couldn’t open plex in the browser with “http://MY IP:32400/web”

Then in terminal I tried: “sudo service plexmediaserver status” and this is i got.

————————————————————–

plexmediaserver.service – LSB: Plex Media Server

Loaded: loaded (/etc/init.d/plexmediaserver)

Active: active (exited) since Tue 2017-03-07 21:37:46 EST; 9min ago

Process: 360 ExecStart=/etc/init.d/plexmediaserver start (code=exited, status=0/SUCCESS)

Mar 07 21:37:41 Plex-Server systemd[1]: Starting LSB: Plex Media Server…

Mar 07 21:37:43 Plex-Server su[399]: Successful su for plex by root

Mar 07 21:37:43 Plex-Server su[399]: + ??? root:plex

Mar 07 21:37:43 Plex-Server su[399]: pam_unix(su:session): session opened f…0)

Mar 07 21:37:46 Plex-Server plexmediaserver[360]: Starting Plex Media Server:…

Mar 07 21:37:46 Plex-Server systemd[1]: Started LSB: Plex Media Server.

Hint: Some lines were ellipsized, use -l to show in full.

 

So is Plex working? if yes then why i can’t access plex from browser? Please help very frustrated. BTW i tried this tutorial with and without expanding the filesystem.

Sameer
Sameer
7 years ago

Hi Robbie. Thanks for the reply. Yes the IP Address is correct. I can SSH Raspberry from my mac. I can also Ping google.ca, here is the result.

PING google.ca (209.85.201.94): 56 data bytes
64 bytes from 209.85.201.94: icmp_seq=0 ttl=45 time=19.378 ms
64 bytes from 209.85.201.94: icmp_seq=1 ttl=45 time=23.312 ms
64 bytes from 209.85.201.94: icmp_seq=2 ttl=45 time=32.862 ms
64 bytes from 209.85.201.94: icmp_seq=3 ttl=45 time=21.006 ms

So what am i doing wrong? 🙁

steve
steve
7 years ago
Reply to  Sameer

I’ve been having this exact same issue. Any guidance is greatly appreciated. I was up and running perfectly fine, watching a movie and the day after I could not connect to the server. Only thing that worked was uninstalling and reinstalling everything from scratch but then after watching one movie it went back to this and I can’t connect to the Plex server or find any advice on the internet on how to fix it. I’m SSH’d in, my Pi has internet (can download updates, can connect to the Deluge webui), but the Plex server does not go live no matter how many times I stop/start the server or reboot the Pi. I’d prefer not to reinstall the server every day to get it to work either lol.

steve
steve
7 years ago
Reply to  steve

Just fixed up my server last night with the help of these commands. Hopefully this helps you. Will keep you posted on if my server stops with the same error again:

sudo nano /etc/default/plexmediaserver
PLEX_MEDIA_SERVER_USER=pi
sudo chown -R pi:pi /var/lib/plexmediaserver
sudo service plexmediaserver restart

Let me know if it works for you!

Sameer
Sameer
7 years ago
Reply to  steve

Hi Robbie Ferguson. Still not working after trying what Steve told. How can i give you SSH access of pi? you got email so i can inbox you the info.

Sameer
Sameer
7 years ago
Reply to  steve

Hi Robbie Ferguson. I have created the image of my SD Card. Please let me know how to send you? I really appreciate your help and effort.

Sameer

Sacha
Sacha
7 years ago
Reply to  steve

I have also followed this tutorial and get the same error.
Previous to this I followed another tutorial on htpc guides – again unable to get it going.

steve
steve
7 years ago
Reply to  steve

Last night after a few days of smooth running, I ran into this issue again. However, this time I solved it by running
sudo apt-get clean
followed by
sudo apt-get autoclean

To be honest I’m not completely sure what each of these do. I’m pretty sure they delete package installers that have already been installed but I’m not 100% on this (what paths they look at, if they do anything else, etc.) Do you know what these commands do or where they operate that could be affecting Plex? I want to know if I should expand a partition on the Pi (installed using NOOBS) to give me some more room wherever Plex thinks it needs it.

P.S. a related issue with this I found is that if you try to autocomplete a command in terminal via SSH, the following error appears:
-bash: cannot create temp file for here-document: No space left on device

Sameer
Sameer
7 years ago
Reply to  steve

Hi Robbie Ferguson. Here is link to my SD Card image.

https://www.dropbox.com/s/x1bn3uih40m4d5z/Rasp-Plex.img.zip?dl=0

-Sameer

Henri
7 years ago
Reply to  Sameer

Hello.

I have exactly the same problem like Sameer. I know my Ip-addres 192.168.1.124. and yes, i can reach other sites on the net. My PI 3 is listed in my rouret.
During the install of Rasbian and the Plex Media Server i had no problems. The server is running.

Any idea what is going on?

Microcyb
7 years ago
Reply to  Sameer

Make sure to change your keyboard layout from UK to US in order to use the |

Microcyb
7 years ago
Reply to  Sameer

Say you have a Network location that contains your movies. In this case we will use a Western Digital my cloud.

Make a Local Directory on your Pi
mkdir wdmycloud

Find the IP addre on your Network Attached Storage (NAS)
Now mount (aka map network drive for windows users)

Say we have a NAS located at 192.168.192.62 and the folder we want is Movies
sudo mount -t cifs -o guest //192.168.192.62/Movies /home/pi/wdmycloud

Now, you will see wdmycloud within Plex.

Walter Davies
Walter Davies
7 years ago

Hi guys – thanks for a really helpful video for this new guy!

I have 2 questions, if you don’t mind:

I’m using a 3 tera drive with well over 300 movies, and over 1000 tv episodes. My Pi has a 64 Gb Micro SD. Yet Plex only loads around 50 movies. Is there something I can do to get it to load the whole disk worth?
My drive is formatted as HFS+. I’ve downloaded HFSPlus utils etc, but I still cannot write to the disk with SSH, or using Cyberduck for example. How can I send files to the Disk – as Plex is a Media Server, it seems sensible to be able to SSH files to the HDD without having to disconnect it from the Pi, connect it to the Mac, transfer, connect it to the Pi etc.

Thanks, Walt

Edide Mora
Edide Mora
7 years ago

Hello,

Thank you for the setup, got plex installed, but now i am trying to add my wd 6 tb nas to my pi and I am not able to can some one please help me, I can see it in the gui as afp, but i cant mount the drive to the pi to add it to plex.

Regards,
Eddie Mora

Shekhar B
Shekhar B
7 years ago
Reply to  Edide Mora

https://thepihut.com/blogs/raspberry-pi-tutorials/26871940-connecting-to-network-storage-at-boot

mkdir /home/pi/shared/nasmedia/
sudo update-rc.d rpcbind enable
sudo cp /etc/fstab /etc/fstab.backup
sudo nano /etc/fstab
add line:
192.168.1.114:/volume1/HSB_MEDIA /home/pi/shared/nasmedia nfs defaults 0 0

sudo mount -o nolock 192.168.1.114:/volume1/HSB_MEDIA /home/pi/shared/nasmedia/

Neil
Neil
7 years ago

I did the following

sudo nano /etc/apt/sources.list

put this line in

deb https://dev2day.de/pms/ jessie main
then did this

wget O https://dev2day.de/pms/dev2day-pms.gpg.key | sudo apt-key add –

and all i get is gpg: no valid Open PGP data found
i also tried this

wget O /tmp/pms.key https://dev2day.de/pms/dev2day-pms.gpg.key
sudo aptkey add /tmp/pms.key

and still get  gpg: no valid Open PGP data found

Neil MacQueen
Neil MacQueen
7 years ago

Followed the instructions to install plex media server and tryvto get the key it wint load says the file doesnt exist did all the upgradesand updates as well as the https transport

Neil MacQueen
Neil MacQueen
7 years ago

wget -O – https://dev2day.de/pms/dev2day-pms.gpg.key | sudo apt-key add –

After i input the above it comes back that no file exists

Neil MacQueen
Neil MacQueen
7 years ago

Which command has — i dont see it in this line

wget -O – https://dev2day.de/pms/dev2day-pms.gpg.key | sudo apt-key add –

Anthony
Anthony
7 years ago

Hey! Great tutorial, really teaching this noob a lot. 🙂

Having some trouble unmounting my external HDD, though. I keep receiving a “umount: mountpoint not found” when I try to: sudo unmount  /media/pi/Seagate Expansion Drive. Does it have something to do with the name of the HDD? I could unmount a USB flash drive this way without a problem.

Also, your written tutorial doesn’t seem to mention unmounting before editing fstab but your video walkthrough does. Any reason why?

Anthony
Anthony
7 years ago
Reply to  Anthony

Believe it or not it was the name of the HDD causing issues, so I renamed it and it worked. I’ve reached another stumbling block, however.

When I try to sudo mount all in /mnt/library I receive the following error:

mount: wrong fs type, bad option, bad superblock on /dev/sda1
missing codepage or helper program, or other error

Anyone have any ideas?

Anthony
Anthony
7 years ago
Reply to  Anthony

Okay, so I realized that I wrote “default” instead of “defaults” in fstab…progress!

Now the problem is that I can’t get back into my library folder, it is telling me permission denied after mounting all and exiting. I feel like I am missing something else obvious…

I realize I’m talking to myself here but this is very therapeutic! 🙂