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
- A Raspberry Pi 3 Micro Computer. Please consider purchasing it through our store to support what we do: https://cat5.tv/pi
- Raspbian Jessie – A free download from raspberrypi.org
- 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).
- In terminal, upgrade your distro to the latest and greatest.
sudo apt update sudo apt upgrade sudo apt dist-upgrade
- Reboot the Pi.
sudo reboot
- 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
- 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
- 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
- Update apt.
sudo apt update
- Install Plex Media Server.
sudo apt install plexmediaserver-installer
- 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)
- 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!
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
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)
You may be best to download the pre-built image: http://plexpi.com
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.
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!
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…
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
You may be best to download the pre-built image: http://plexpi.com
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
Try my pre-built image – http://plexpi.com
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?
Is that still being worked on? – is there any more updates?
PlexPi is scheduled for an update in Q1 2019. It is not yet on a development cycle, but this coming year will see it with a release schedule and proper update schedule.
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?
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
If you take the drive with you that has all the shows on it, you’ll be able to take it anywhere you’d like. A nice portable media server!
If i take it to a different place with a different IP address, wont I have to redo the setup?
Nope. If the IP changes, you’d just have to enter the new IP in your browser to access it. For example, if at one location you go to 192.168.0.15:32400/web but at your new location your Pi gets the IP 192.168.0.100, you’d simply go to 192.168.0.100:32400/web
If your drive with your videos on it are a NAS unit, you’ll need to change /etc/fstab accordingly (enter the new IP) and be mindful your first boot will take longer than usual as it attempts to mount the missing NAS.
Let me know if you need any help.
Thanks for the help!
My pleasure! I hope it goes well for you! Here if you need me.
I am also stuck on step 8
it comes up no such and directory
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
I have the same permission error on step 8 (bash: /etc/default/plexmediaserver: Permission denied
) also if I add the line manually.
Any idea?
I’d need to see the full copy-paste of what you typed and the error message please. Also, post the output of: sudo ls -lah /etc/default/plexmediaserver
Hi! I had the same issue. I had plexmediaserver.prev in etc/default folder.
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.
Yeah this really gets into the fstab 101 as mentioned in the show (please review the video). Perhaps I will add more details to that step for those who did not watch the video tutorial, or may be worth putting together a video tutorial specifically for this since it’s a pretty common issue for new Linux users. Thanks for the comment.
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
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.
Are you certain you are putting the correct IP Address http://MY IP:32400/web ?
Can you ping out from the Pi? Try: ping google.ca
Can you ping the Pi from your computer? Try: ping ipofpi where ipofpi is the actual IP of the Pi.
To be sure, try: ip a
If that doesn’t work, try: ifconfig
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? 🙁
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.
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!
Fantastic! Thanks for the update Steve. So it was indeed an update which broke it.
I have added it as a new step to the tutorial (Step 8). Thanks!
How strange. I have not personally seen this behavior, but you’re probably the third to mention it — but only lately. This is a new report. So I start to wonder, did an update occur which broke something in the underlying OS? YOu mention you can run updates, so I presume you are manually doing things like apt-get upgrade? I am curious if something there broke something to do with Plex. If you’d like, create an img of your SD card and send it to me. Either that or give me direct SSH access to your Pi and I’ll see if I can spot the problem.
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.
Hi Steve,
Basically you just need to open up a port in your firewall to pass through the SSH connection and then tell me your IP address (confidentially). Keep in mind this opens up your Pi to the world, so once I’m done you’d have to immediately revoke that pass through.
If you are not sure how to do this, I’d recommend creating an image of your card. Here is my modified version of rpi-mkimg which I use to create the NEMS images: https://github.com/Cat5TV/rpi-mkimg
** ALWAYS BACKUP YOUR CARD FIRST **
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
You can email the link to me – [email protected]
Happy to help!
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.
Without knowing more about what error you’re referring to, I’d try a different SD card.
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
Sounds like your MicroSD Card is out of room. You SHOULD NOT use your Plex server until you resolve this or you will cause irreparable damage to your Plex deployment. The reason you had to do an apt clean is because your drive ran out of space while trying to update, so this will cause all kinds of odd issues (and possibly entirely break things).
To start, type: sudo df -h
What does that output? It will show me info about your filesystem and how much space you have.
Side note: Did you remember to expand your filesystem during the installation?
Hi Robbie Ferguson. Here is link to my SD Card image.
https://www.dropbox.com/s/x1bn3uih40m4d5z/Rasp-Plex.img.zip?dl=0
-Sameer
Oh Sameer, I’m just seeing this now (April 21) and feel terrible for not spotting it sooner. Can you email me if you still need me?
Hey Sameer, sorry I’ve been so busy with the NEMS 1.2 release. My schedule was finally loosening up so I went to download this, but it’s no longer on Dropbox. Perhaps pop me an email?
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?
Make sure to change your keyboard layout from UK to US in order to use the |
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.
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
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
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/
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 apt–key add /tmp/pms.key
and still get gpg: no valid Open PGP data found
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
Sorry to hear you hit a snag Neil. At which step did you have trouble. I’m not sure what you mean about getting the key.
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
That should be
-
not – (hyphen, not em dash). Perhaps your copy and paste is messing it up as two of them are incorrect in your comment. Best to long-hand it if that’s the case, or manually change it back to-
. Hopefully that’s all it was. The file exists (confirmed January 25, 2017).Which command has — i dont see it in this line
wget -O – https://dev2day.de/pms/dev2day-pms.gpg.key | sudo apt-key add –
I’m seeing em dashes in your comments, but perhaps it’s only the comment system replacing them. Make sure all the hyphens are in fact hyphens, as that would explain why you’re getting this error.
Understand what you’re actually doing here: downloading the GPG key, and then adding it to the keyring.
As you can see if you try to open that key via your web browser, it does exist. So the “file doesn’t exist” error means there’s either something wrong with your Internet, or your command. I’d reckon it’s the hyphens, but if you confirmed it is not, break down the command and do it manually:
Download the key to a file:
wget -O /tmp/thekey.key https://dev2day.de/pms/dev2day-pms.gpg.key
Add the key to your keyring:
sudo apt-key add /tmp/thekey.key
Let me know how it goes.
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?
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?
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! 🙂
It always helps to know what the permissions are looking like.
Unmount the drive and then type: ls -lah /media and note the permissions of your mountpoint (eg., “library”).
Then mount it and run the same command.
Then with it mounted, run: ls -lah /media/library/ to see the permissions of the mounted top-level folder. You want to see that the user pi has access to read/write, and that the files look correct.
That just gives you a starting place to see why your permissions seem off. Also make sure it’s mounting in r/w mode (type: sudo mount to see).
Your filesystem type in /etc/fstab has been specified incorrectly. Eg., you’ve entered ext4 for an ntfs drive. Make sure you use the correct filesystem type in the fstab file before running mount -a
Hi Anthony,
If your mountpoint is called Seagate Expansion Drive you’ll need to either escape the spaces or put it in quotes. Otherwise the Linux terminal sees each word as a separate item. Seagate. Expansion. Drive.
You can do either of the following for the same effect:
sudo unmount /media/pi/Seagate\ Expansion\ Drive
or
sudo unmount “/media/pi/Seagate Expansion Drive”
Good luck!
The written tutorial is meant to supplement the video, not the other way around, so the video is bound to have some extra tidbits. If it is causing confusion though, I can certainly update the text. Let me know the timestamp in the video and the step in the blog to help me find what you mean.