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.

It’s important to make sure you have expanded the SD card to the full size, this setting is found in the Raspi-config. If you installed via the NOOB installer then you don’t need to do this.

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.

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

7. By default, the Plex Media Server package will utilize a user named “plex“.

To reduce the chances of dealing with annoying permission issues, we will change the server’s default file so that it utilizes the “pi” user instead.

To do this, open the file with the nano editor by using the following command.

sudo nano /etc/default/plexmediaserver

8. Within this file change the PLEX_MEDIA_SERVER_USER line from plex to pi as we have shown in our example below.

Find

export PLEX_MEDIA_SERVER_USER=plex

Replace with

export PLEX_MEDIA_SERVER_USER=pi

Once done, save and exit the file by pressing Ctrl + X then pressing Y and pressing ENTER.

9. As we have made changes to the “default” file, we will need to restart the “plexmediaserver” service. Restarting the service ensures that it loads in our changes and starts using the “pi” user.

You can restart the service by running the command below

sudo systemctl restart plexmediaserver

10. Now it should all be installed, but before we get started, we should make sure the Pi has a static IP, so it’s easy to remember the IP address.

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

hostname -I

11. Now open up the cmdline.txt file.

sudo nano /boot/cmdline.txt

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

13. Once done, exit by pressing ctrl x and then y to save.

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

sudo reboot

15. 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.  Again make sure you set the group & user owner to Pi or the user that will be running the Plex software.

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.

I hope that you have been able to get the Raspberry Pi Plex server up and running without any trouble. If you come across any issues or have some feedback, then please don’t hesitate to leave a comment below.

79 Comments

  1. E Kort on

    Hi,

    I have my video’s already storied on a NAS (Synology 413J), but I can’t install PLEX on it, Can I use this PLEX-server to play video’s from the NAS to tv?

    1. Emmet on

      Hi,

      Yes this should be possible, all you should need to do is mount your NAS’s shared drive to the Pi then point Plex at that mount point.

      I would recommend using a Pi 4 to maximize your network throughput though.

      Cheers,
      Emmet

    2. Edwin on

      Thanks. Ordered a Pi4 (4gb) , now waiting for it to arrive and to play with it.

  2. Sigma on

    Can you fix your link to “Raspberry Pi network attached storage” Tutorial? It’s linking to an image.

    1. Gus on

      Thank you pointing this out. It appears WordPress decided an image needed that link instead of the tutorial. It’s all fixed now.

  3. grahame on

    sudo apt-get install plexmediaserver
    If you get an error at this step, then be sure to check out my troubleshooting section at the bottom of this tutorial.

    what is the cause of this please?
    copied and pasted all code so no typos.

    1. Gus on

      Hi Grahame,

      Sorry, the line about troubleshooting was from a previous version of this tutorial.

      Can you please let me know the error you’re receiving?

      Thanks,
      Gus

  4. Mike on

    The error I got was:

    E: Unable to locate package plexmediaserver

    Everything else went alright

    1. Emmet on

      Hi Mike,

      We have gone ahead and rewritten the tutorial to utilize the repositories provided officially be Plex.

      It should all now work as intended.

      Cheers,
      Emmet

  5. Alex on

    Hey great tutorial. I was able to go through each step with no issue. The problem I’m having now is that when i try to add a library on plex, I select the external hard drive i have my media on, but the folders inside the drive do not show up and it says I have no media in the library. Any suggestions of what is going wrong?

  6. Daimyo on

    When attempting to start the Plexmediaserver service I receive an error “Status=132”
    How do I resolve this?

    root@raspberrypi:~# service plexmediaserver status
    ● plexmediaserver.service – Plex Media Server for Linux
    Loaded: loaded (/lib/systemd/system/plexmediaserver.service; enabled; vendor preset: enabled)
    Active: failed (Result: exit-code) since Tue 2018-01-09 13:37:59 CST; 2min 59s ago
    Process: 3833 ExecStart=/bin/sh -c LD_LIBRARY_PATH=/usr/lib/plexmediaserver “/usr/lib/plexmediaserver/Plex Media Server” (code=exit
    Process: 3829 ExecStartPre=/bin/sh -c /usr/bin/test -d “${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}” || /bin/mkdir -p “${PLEX_MEDI
    Main PID: 3833 (code=exited, status=132)

    [–SNIP–]

    1. Gus on

      Hey Daimyo,

      What version of the Raspberry Pi are you attempting to utilize with Plex?

      Cheers

    2. Daimyo on

      All of my testing was on a Pi2 (the Pi3 that I had ordered was DOA).

      However after receiving a new Pi3 everything worked as expected.

      Now I just need to do some video conversions to get my library to natively play from the Plex-Pi

    3. Gus on

      Hey Daimyo,

      Glad to hear it all ended up working on the Pi3. It’s strange as it should have worked without issue on the Raspberry Pi 2 as well.

      Cheers

    4. Slurpy on

      I have the same problem as Daimyo. I am using Jessie on a Raspberry Pi 1 B+ V1.2.

    5. Gus on

      Hey Jordon,

      Sadly Plex will not work on the Raspberry Pi 1 at all, it simply is not developed with support for the version of ARM that is utilized on the original Raspberry Pi’s.
      You will have to upgrade to either a Raspberry Pi 2 or a Raspberry Pi 3 to be able to complete this tutorial. Of course, we recommend upgrading to a Raspberry Pi 3.

      Cheers,
      Gus

  7. Derek on

    Will this stream all HD content without any issues? Is the raspberry powerful enough to do this? I am looking to replace my media server that is a power hog.

    I plan to install plex media server on my pi and use my roku as the client.

    1. Gus on

      You will likely find that the Pi isn’t powerful enough to stream HD content, especially if you want to stream to multiple devices.

  8. Teknosherpa on

    Gus,
    How do you manually install a Plex Media Server update?

    1. Truman on

      @Teknosherpa open a terminal window on your Raspberry Pi 3, and type

      sudo apt-get upgrade
      Enter

      Let that run, and then once that completes, type

      sudo apt-get update
      Enter

      let that complete, and that will update Plex and any other modules running on your Pi

  9. haikal on

    your tutorial is so clear that i got everything right in one try! thank you so much!
    Successfully created NAS raspberry + Plex media server on raspberry pi 3

  10. Rob on

    Thank you for this. I had tried two other tutorials and failed to get everything working properly… this was as simple as it gets. Great work!

  11. Mike S on

    Great tutorial. Got everything up and running. Unfortunately, it doesn’t seem the Pi 3 can handle the transcoding of 1080p .MKV files which is a deal breaker for me as that is most of my media.

    1. YGB on

      Did you get a fit x for this? Having the same issue.

    2. James on

      It looks like our Pi 3’s are not powerful enough to handle HD content at this time. Looks like we are stuck with SD content for now.

  12. Truman on

    I figured out mine! Just needed to enable port forwarding to 32400 and point it to the static IP of my Pi 3 while it’s connected to Ethernet. Success!

  13. Truman on

    I’ve followed all instructions and added the IP address to the /boot/cmdline.txt file, but when I reboot the Pi 3, and even see the “[ OK ] Started LSB: Plex Media Server. I can’t navigate to the IP:32400/web/. What am I missing?

  14. Robert on

    Great instruction, step-by step, finished it all without a problem, and when I try to connect to server with a PI Browser all works prefect, but when I try connect with a another PC got a following message:

    This site can’t be reached

    192.169.0.21 took too long to respond.

    What to do?

    1. haikal on

      you have to specify the port in the address. Default port used by plex is 32400, so your address should look like this 192.168.0.21:32400/web/

  15. Rodney on

    Hello! I’m considering building a Pi-based Plex server in order to free up my PC for use at my office. Leaving my wife and kids without Plex would be a pretty bad move… LOL.

    The only concern that comes to mind for me is the ability to stream 1080p .MKV files. Is real-time transcoding performance any different than what I get from my PC? I plan on hanging a USB hard drive from a yet-to-be-purchased Pi 3. Thanks!

  16. Andy on

    Mine had been running fine for weeks, but all of a sudden I have been getting the message that the server is not powerful enough, even on content that had been ok before. Have just re setup the whole thing, done all updates and its a bit better, but still doing it. CPU is at 99%

  17. Kevin Stacy on

    Step 4 after typing in the command it says tee: /etc/apt/sources.list.d/pms.list: no such directory Deb https://dev2day.de/pms/ Jessie main

    1. Katie H on

      I’m getting this same issue, I think. Any luck?

  18. Sam on

    Thank you for the great article. I was able to setup my Raspberry Pi 3 without any problems.

  19. Fredrik on

    I followed the guide and almost everything is working as expected. I find my server both locally and on remote networks. I’ve some issues with the streaming though. I’m not sure the Pi3 is powerful enough to stream high quality videos to remote networks. I’m trying to stream 1080p .mkv files with h264 codec, but it buffers like every 5 seconds. I’ve been trying with 720p movies too, but it just doesn’t work smoothly.

    Am I missing something? Or is the Pi3 just not powerful enough?

    1. BluebellGamerYT on

      how do you set it up for remote networks

Leave a Reply

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