How to Setup a Raspberry Pi Plex Server

In this tutorial, I go through all the steps to getting your very own Raspberry Pi plex server up and running.

Raspberry Pi Plex Server

This project is perfect for anyone who wants to have a media server that can be accessed by anyone within a household. You can also set it up to be accessed outside your local network.

Plex is a client-server setup where the client directly streams data from the Plex media server. This setup means you can have all your movies, music, and photos located on the one device, the server. In this case, we will be using the Raspberry Pi.

You can then have multiple clients connect to the same server. It is great as you don’t need to have multiple copies of the same media across several devices.

The Plex client is supported on a ton of devices including Windows, Apple, Android, Amazon Fire TV, Chromecast, Xbox, PlayStation, Linux, and so much more. It really is a fantastic home media solution.

If you just want a single client without the whole server setup, then something like the Raspberry Pi Kodi media center might interest you more.

Equipment

You will need the following equipment to be able to complete this Raspberry Pi Plex server tutorial.

Recommended

Raspberry Pi 2, 3 or newer

Micro SD Card

Power Supply

Ethernet Cord or Wifi dongle (Best to stick with Ethernet for a media server though)

Optional

Raspberry Pi Case

USB Keyboard

USB Mouse

External Hard drive or USB Drive (For storing movies, music & photos)

NOTE: This will not work at all on older versions of the Pi. A Raspberry Pi 2 or later will work.

Setting up the Raspberry Pi Plex Server

In this tutorial, I will be using Raspbian so if you haven’t got it installed then check out my guide on how to setup Raspbian here.

If you want to run a slim version of Raspbian, then you should take a look at installing Raspbian Lite.

Preparing your Pi for Plex

1. Now before we install the Plex Media Server software to the Raspberry Pi, we need first to ensure our operating system is entirely up to date by running the following two commands.

sudo apt-get update
sudo apt-get upgrade

2. To install the Plex packages to the Raspberry Pi, we will need to add the official Plex package repository.

Before we do that we need to install the “apt-transport-https” package. This package allows the “apt” package manager to retrieve packages over the “https” protocol that the Plex repository uses.

Install the package by running the command below.

sudo apt-get install apt-transport-https

3. Let’s now add the Plex repositories to the “apt” package managers key list.

This key is used to ensure the files that you are downloading are in fact from that repository and signed by that key.

Run the following command to download and add the key to the package manager.

curl https://downloads.plex.tv/plex-keys/PlexSign.key | sudo apt-key add -

4. With the Plex GPG key now added, we can finally add the official plex repository to the sources list by running the following command.

echo deb https://downloads.plex.tv/repo/deb public main | sudo tee /etc/apt/sources.list.d/plexmediaserver.list

5. As we have just added a new repository to our sources, we will need to run the “update” command again to refresh the package list.

sudo apt-get update

If you get the error “/usr/lib/apt/methods/https could not be found.” Then the https transport package hasn’t been installed. Double check that it has been installed correctly.

Installing Plex to your Raspberry Pi

1. Now that we have set up our Raspberry Pi so that it can read from Plex’s official package repositories we can go ahead and finally install the Plex Media server package to the Pi.

To install the “plexmediaserver” package, go ahead and run the command below.

sudo apt-get install plexmediaserver

2. The installation process for Plex sets up a few different things for us.

The first is that it creates a user and group for Plex to run under. This user and group is called “plex“.

It also will set up two directories, one where to store files temporarily that Plex is transcoding. You can find this folder at “/var/lib/plexmediaserver/tmp_transcoding“.

The second directory is where Plex will store all the metadata it retrieves for your media. This folder can be found at “/var/lib/plexmediaserver/Library/Application Support

3. As Plex is running a different user to the Raspberry Pi’s default “pi” user, you will need to make sure you have permissions set correctly on your drive.

If you need help setting up your external drive with Plex, you can try following our guide on mounting a USB drive on Raspbian.

Setting a Static IP Address for your Plex Server

1. Now that we have installed Plex to our Raspberry Pi we should make sure that we are using a static IP address.

There are two reasons to use a static IP. One is that the IP will be easier to remember. Second is that it will make sure your Plex server can always be found at the same address.

To get your current IP address, enter the following command.

hostname -I

2. Now open up the cmdline.txt file.

sudo nano /boot/cmdline.txt

3. At the bottom of this file, add the following line: (Replacing “YOUR IP” with the IP you got from using hostname -I)

ip=YOUR IP

4. Once done, exit by pressing CTRL + X and then Y to save.

5. Now simply restart the Pi by running the following command.

sudo reboot

6. The Pi should now always start with the same IP. You can also set this on most routers by tying the mac address of your network device (WiFi or Ethernet) to an IP.

Now the Raspberry Pi Plex media server should be all set up and ready to scan your media and stream it any client that wishes to connect. I will go through some basics of setting everything up below.

Storing Media on the Raspberry Pi

Now there are several ways to store your media on the Raspberry Pi. I will mention each of the methods below.

You can hook up an external hard drive with all your music, movies and whatever else you may have. Setting the Plex program to run as the Pi user means you can plug a USB hard drive in and access the media in Plex without any issues.

You’re also able to mount drives permanently; I have already covered this in a previous tutorial, so be sure to check out my guide on how to mount a USB hard drive to the Raspberry Pi. Make sure you set the user & group owner of the drive to Pi.

Another option is to your Pi up to act as a NAS so you can transfer your media across to it without needing to disconnect and reconnect a hard drive.

You can set this all up by following my tutorial on setting up a Raspberry Pi network attached storage.

Lastly, you can use the SD card for storage, but as you could imagine, this will quickly run out of space. You can set up a folder on the SD card to be accessed via the network.

Connecting Clients to The Plex Media Server on the Raspberry Pi

If you’re using an app on your phone, computer, Xbox, PlayStation, or any other device, then the Plex client should be able to pick up on the server automatically.

You will, unfortunately, find the official mobile Plex applications are behind a paywall. For example, you will need to pay money to get full access to all the features. However, all other apps, including the web app, should be free with only a small set of features requiring a subscription.

To connect to the browser, enter the IP followed by the port 32400 and /web/. For example, mine is.

192.168.1.100:32400/web/

You will be prompted to log in, simply sign up or sign in to an existing plex account. You can skip this by just entering by entering the address above again.

Next, you will need to set up your music, movie, and TV show libraries. This process is incredibly easy and shouldn’t be too hard in getting it set up correctly.

1. First select add library in the left-hand side column.
Add Library

2. Next, select the type of media that is in the folder. If you have more than one type, then you will need to add a new library for each type of media.

Media Type

3. Next, you will need to select the folder that has all your media in it. For example, mine is on a USB drive that is displayed in the left-hand side column or can be found at /media/pi/ESD-USB

Add Folder
4. Once you add the library, it will now organize your clips in a nice easy to browse interface.

If you need more information on how to setup, name and organize your media library, then Plex has an amazing amount of documentation on naming and organization.

Fixing File Permission Errors with Plex

One of the most common problems you may run into with Plex on your Raspberry Pi is with it being unable to access your files. The most common cause of this issue is incorrect permissions.

This section will show you how to modify the permissions for an ext4 drive.

If you are running an NTFS or FAT formatted drive, you will need to try remounting your disk drive and adjusting its mounting options. The reason for this is that the NTFS and FAT filesystems do not support the Linux permission system.

1. To begin, work out the location of the drive or folder that you want to adjust the permissions for.

For example we have an ext4 drive mounted to our Raspberry Pi at the location /mnt/pimounteddisk/.

2. As the next two commands need to be executed as the superuser, let’s change to it by running the following command.

sudo su

3. With the path to your drive or folder in hand, we are going to make use of the following two commands.

Make sure that when you run these that you replace [YOURDRIVEPATH], with the path you want to adjust permissions on.

find [YOURDRIVEPATH] -type d -exec chmod 755 {} \;
find [YOURDRIVEPATH] -type f -exec chmod 644 {} \;

The second command finds all directories and assigns the owner “read“, “write” and “execute” privileges and gives all other uses “read” and “execute” privileges.

The third command is used to find all files and will assign the owner “read” and “write” privileges, and all other users will get the “read” permission.

4. Once those commands have finished running, we can go ahead and exit out of the superuser mode.

exit

5. You should now be able to interact with your media files from within Plex successfully.

Hopefully, at this stage, you will now have Plex up and running on your Raspberry Pi without any issues.

If you come across any issues or have some feedback, then please don’t hesitate to leave a comment below.

93 Comments

  1. Glenn on

    Í’m sorry, I got the problem. I messed up the “PLEX_MEDIA_SERVER_USER=pi” step this fixed the problem. Thanks for your video’s

  2. Glenn on

    I can see all my movies on the raspberrypi 3 but when I want to view them in the plex server (so add them to my libarry) it doesn’t show any movies in that folder.

  3. Thomas Koren on

    I have my Plex server up and running, but I would like to add videos remotely without having to physically access my Pi. Is that possible?

    1. Jay on

      I have the same goal as you and my idea how to solve it is to run utorrent on the pi too and remotely control it from my phone with the utorrent remote app. Not sure how it works if it downloads and streams at the same time..

    2. Zaphi on

      I know this is an old comment, but in case anyone is still looking around (like I was), you can set up samba server on the Pi and access it as a network share.

  4. Raman Mehat on

    Hey, I set up plex no problem but for remote access it doesn’t work I don’t know if there something I missed or messed up?

    1. Nosman1987 on

      Generally all that is need for remote access to work is to forward port 32400 to your Plex server. This is probably easier to do if the Plex server is given a static IP address.
      For remote access, you need to change some settings on your router.
      In your router’s interface, forward port 32400 to the IP address of your raspberry pi. If you don’t know how to do this, generally a google search for ” port forward guide” will get you a going.
      Once that is setup, in the Plex web UI got to Settings > Server > Remote Access > Show advanced > check off manually specify port and leave the default of 32400
      If you have DHCP enabled your pi may get a new IP address from time to time. If the IP address changes the port forward will no longer be pointing to the R Pi. This is why it is useful to set the Pi to have a static IP. This can also be done in your router’s interface. (credit to Teem214)

  5. Ian Truelsen on

    Great tutorial. I have set it up on a Pi3 and it seems fine, with one problem: I can play either music or video from apps, but it will only play for about a minute and then stop. I have my media stored on a usb stick. Any thoughts on why only the minute of playback?

    1. Gus on

      Not sure why you’re only getting a minute playback. From what I remember some of the plex apps only allow for 1 minute playback unless you pay for it. You need to either buy the app or purchase a plex pass (It could this or something else). The browser version is completely free.

  6. usuallymatt on

    I followed these steps on a fresh Jessie install of Raspbian but i keep getting the following when trying to install plexmediaserver:

    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    Package plexmediaserver is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source
    However the following packages replace it:
    plexmediaserver-installer

    E: Package ‘plexmediaserver’ has no installation candidate

    1. Gus on

      Try running sudo apt-get install plexmediaserver-installer

      Let me know how that goes.

  7. sh00ks on

    Any idea if this will run on a pi Zero?

    1. Gus on

      I am not sure, I think even if it did work it would struggle to the point that it would be pointless for video.

    2. Sh00ks on

      No problem, thanks for getting back to me Gus. Looking more at streaming remote channels through plex rather than physical files. May work, I will report back with my outcome. Cheers

  8. Pete on

    Setup in less than an HR…Seamless, all is working as expected.. Cheers

  9. SconnieSven on

    Thanks for the great tutorial! Once I got NFS setup on my Synology and mounted the share in Raspbian, I went through this step by step and got Plex working on the first try! This is my first Rpi project and am hoping I can replace my temperamental old Plex laptop with this for serving up my media…we’ll just have to see how well it can transcode everything. Anyway, just wanted to say thank you!

  10. Geoff on

    Hi Gus,
    First of all many thanks for your tutorials, they are fantastic (not to say the best)!

    I am just a bit confused about the connection of the plex server to a NAS. Specially when you write : “Again make sure you set the group & user owner to pi or whatever the user Plex is running as”.

    I followed step by step your NAS tutorial and it is working perfectly! but in your NAS tutorial, you are creating a pimylifeup user (I take your tutorial user name for the sake of the explanation). My question is should I change the user from plex to pimylifeup or can I keep it to pi and it will access to the NAS ?

    Again thanks a lot for your tutorials!

    Geoff

    1. Gus on

      Hi Geoff,

      Is the NAS running on the same Pi? If not you don’t need to change the user. Just connect to the network storage using the username/password you set for it.

      If it’s on the same Pi and you want to directly access the NAS folder (/media/NAS/). Then you may come across permission problems when trying to access the files you want. To correct this you may want to change plex to run as pimylifeup or the NAS to run as Pi.

      I hope that helps, let me know if you need any more info or a better explanation 😀

    2. Geoff on

      Hi Gus,
      Many many thanks for your reply it does help a lot! My plex server is setup to the pi user and so far, so good! but I will follow your comment and change it to pimylifeup!

      Again thanks for your massive help and thanks for being so inspirational!

      Geoff

  11. joe on

    after entering (wget -O - https://dev2day.de/pms/dev2day-pms.gpg.key | sudo apt-key add -) i get these line: wget: invalid option --'0' , Usage: wget [option]...[URL]... , Try 'wget --help' for more options. , gpg: no valid OpenPGP data found.
    help please!!

    1. Gus on

      It looks like you’re entering a 0 (Zero) instead of an O (Capital O).

    2. joe on

      thanks it worked. working on setting up the NAS I probably will get that a little wrong to.

  12. Brokenstick on

    Great tutorial, easy to follow, works like a charm.

    I have a question, for which I apologize for being new to this: how do I start up or launch the PMS when I start up or reboot my Raspberry Pi (3)? I would like to keep it running so that outher TVs’ in my home can access it.

    1. Gus on

      Plex should start up automatically when you reboot/start your Pi. If it isn’t you can do the following.

      First open up the rc.local file by doing the following.

      sudo nano /etc/rc.local

      Then before the exit 0 line add the following line.

      sudo service plexmediaserver restart

  13. pilover on

    Great video and article. Clearly laid out info was all i needed to make my pi a powerhouse!

    Just a minor issue, when i type hostname -I, i get 2 ips? How to get rid of that?

    Thanks a lot and i subscribed to your email 🙂

    1. Pilover on

      Update: I got 2 ips as I was connected to both Ethernet and wifi.

  14. Justin on

    Great Article. Mine has been running on a PI 3 flawlessly since the article was posted. I’m primarily using it to Host music for my family. All my music is stored on a 128GB USB Thumb Drive. Thanks for the great article!

    1. Sam Naser on

      Hi! You mentioned in your comment that you are streaming your media off a flash drive. Did that require any additional setup? When I attempted this, Plex complained that it could not play the media, but it works with the files on the Rasberry Pi just fine! (also using Pi3 btw)

    2. Justin on

      My thumb drive is 128gb EXFat. So I did have to find a tutorial about how to mount that and put it in my /etc/fstab

      This is what my line looks like.

      /dev/sda /media/NASHDD1 auto nofail,uid=1001,gid=1001,noatime 0 0

      Does plex see your USB Drive?

    3. Sam on

      Did streaming from the USB drive require any additional setup/configuration?

  15. Jeff on

    Looks like its working for me! Best tutorial for my needs. Thank you so much!

    1. Nikhil on

      Hi Jeff, which Rasp Pi are you using? I have followed all steps as shown in the video, but the plex server isn’t being visible for some reason. I am using a B+.

    2. Jeff on

      I’m using a Pi 2.

  16. joel on

    thanks for the great tut!
    I am looking to replace minidlna on my pi2, i really like the inotify feature.
    does plex have an auto library detect/update features like this?

  17. Demond P on

    Thank you for this great tutorial. What if I don’t want to use my RPi3 as server but just want to install PLEX inside of raspberry jessie and connect to windows 10 plex server?

    1. Demond P on

      Nevermind. I misunderstood something and makes sense now. Thanks again for another great tutorial!!!!

  18. Bjoern on

    Hi in need some help, I use a Pi3 Raspberrian GNU/Linux8 and followed all your steps succesfully.
    However when I reboot the system waits during reboot for 110 seconds to connect to the network.
    Next line says: IP-config: Guessing netmask 255.255.255.0
    Then IP-config: Complete;
    Device=eth0,hwaddr=b8:27….. ipaddr=192.168.1.7 , mask=255.255.255.0 ,gw=255.255.255
    host=192.168.1.7 domain=, nis-domain=(none)
    once it ran through the boot, the OS shows on my touch screen but I see nothing of the Plex Server.
    Do I need to start it somehwor (how??) or is there a problem while booting ?

  19. Nikhil on

    Is it necessary to restart the plex server once the Pi is restarted or does it auto run?

    1. Gus on

      It should auto run!

  20. Aaron Ellis on

    Thanks for the step-by-step. I can’t get the server to recognise my media. I have renamed my files, the folders they are in and did all kinds of searching on the Internet to find an answer but still have not been able to get the server to see my media, any of it.

    1. Aaron Ellis on

      I fixed it! The third time is the charm I guess! I just started over with the entire installation, and it worked. This time I really looked at everything and made sure I typed everthing correctly. I just missed something the first two attempts.

      Thank you again for these instructions and for a great website!

    2. Frits on

      Will this also works with the new Pi 4 ?

    3. Emmet on

      Hi Frits,

      This should work fine with the Raspberry Pi 4, even though the Pi 4 uses a better processor then the Pi 3 they both still use the same architecture.

      Cheers,
      Emmet

Leave a Reply

Your email address will not be published. Required fields are marked *