How to Create a Plex Server on Raspberry Pi 4

Raspberry Pi Plex Server Featured

Plex is a wonderful piece of kit, a media server software which allows you to stream your movies and TV shows directly to any Plex client. Plex clients can be a page in a browser on a computer, an app on a tablet or phone, an Android TV box, or even an app on your Smart TV. Either way, the server software is neat and flexible and fast, and it keeps your movie and TV collection well organized and accessible. In this article we test the feasibility of making, and actually build, a standalone Plex server from a Raspberry Pi 4 and a hard drive.

Why the Pi 4?

The Pi 4 is your best bet when you are building a Plex server. The reason for this is purely about speed. Firstly, it’s a very fast little computer, almost up to the level of a low end laptop. Secondly, it has fast USB 3.0 ports to hook up a hard drive to storr the films. In video streaming it’s all about data throughput.

Raspberry Pi Plex Server Pi And Disk

The USB 3 sockets on a RasPi 4 are more than fast enough to shoot the data from the disk into the server brain and out to the waiting clients. Although it’s possible to use previous revisions of the Raspberry Pi for this build, the Pi 4’s USB 3.0 ports really pay off. Previous Pi USB 2.0 sockets run at 30-35MBps, whereas the new USB 3.0 runs at 320-360MBps, which is like a ten-fold speed hike.

With transfer rates like that, it’s totally feasible to run external drives from the USB at something approaching normal computer speeds. You can run external drives on a USB 2.0, but they drag a little, and you don’t want that while streaming HD or UHD video.

Another thing in the Pi 4’s favor is its Gigabit ethernet. Not only does the video fly off the drive, but it flies down the pipe via the router to your client, too, be that on a wired connection or Wi-Fi. The only bottleneck then is the speed between the router and the client, and that doesn’t matter quite so much.

Creating the Pi Plex Server

So to build this server you need the following items:

  • A Raspberry Pi 4 (in a case with heat sink or fan cooling preferred)
  • USB C power supply (official power supply preferred)
  • An SD card of sufficient capacity
  • Ethernet cable or Wi-Fi
Raspberry Pi Plex Server Plug

Firstly, install Raspbian on the card. You can get this from the Raspberry Pi Download page. Download the image and burn it to the SD card with appropriate software, like the excellent cross platform balenaEtcher, for example.

Install the SD card in the Pi as normal and boot it up.

Prepping the Pi

Once you get a command prompt, input the ID as pi and the password as raspberry to log you into the Pi.

Now you need to prep the installation, and to do that you need to make sure the Pi is fully up to date. Type the following:

Say yes to everything. You should probably reboot, so when it comes back up, just pop in your ID and password again.

Raspberry Pi Plex Server Https Transport

Now you need to download the correct repository containing the Plex server for Raspberry Pi Linux. You do this by first installing the https download transport for APT with the following command:

Before we can download the Plex repo, we have to add the Plex GPG key or “PlexSign.key” to the repo with the following commands:

Now that the key has been added, we can download the server software with the following commands:

Once that is done, you need to run the update command again to refresh the Pi:

When that has completed, we can finally install the server software onto the Pi.

Installing the Plex Server

Installation of the software itself is quite easy. Just type:

And if the repos are in place, it should install easily and normally. Now you need to ensure that the IP address on the network remains static. You do this first by finding out what the IP address currently is, then editing the “cmdline.txt” file to reflect that.

Find your current IP address by typing:

In my case, this returned an answer of “” Your mileage may vary. It may be that your network uses 192.168.1.x addresses. It all depends on your router.

Now open the “cmdline.txt” file and edit it. Open the nano editor and the file by typing:

and add the line:

to the bottom of this file and save it with Ctrl + X. (Answer “Y” at the prompt.)

Now type:

and your Pi will restart. You’re all set up, and the Pi can now run the Plex server headerless, so you don’t have to have a monitor plugged in. Use your Plex client or go in with a web browser to port 32400, like so:

where the first part is your IP address, as above. That is mine – you will need to substitute your own.

Either way, if you are successful, then the server will show up as one of the choices.

Raspberry Pi Plex Server Found Server

Then finally you can add the Library from your media files on disk. Choosing either movie or TV type library changes the way the files are organized in the database.

Raspberry Pi Plex Server Library Type

Break out the Popcorn

A few things to note: I’ve seen some tutorials on this subject which state that you need to change the name of your user to Plex in order for this to work. That’s not true; go with the default settings.

If your movie and TV files are on a USB stick and the USB ports are mounted, then you should be good to go. Be warned if you have a lite version of the OS (like I did), you may have to manually mount the USB drives. Better yet, edit the “/etc/fstab” file to mount them automatically.

This goes double if you are using an external USB hard drive; you will have to format it and mount it on the system. There are all kinds of drive types and operating systems, and all other info you might need about that is right here in our previous article about making a NAS with a Raspberry Pi.

Also, you can hot-swap drives on the system if, for example, you wanted to add files to them, but you have to make sure they are mounted again for the server to access them. The Plex database will update automatically once the drive is seen by the system.

If you have any questions about making your own Plex server, please let us know in the comments.

Phil South Phil South

Phil South has been writing about tech subjects for over 30 years. Starting out with Your Sinclair magazine in the 80s, and then MacUser and Computer Shopper. He's designed user interfaces for groundbreaking music software, been the technical editor on film making and visual effects books for Elsevier, and helped create the MTE YouTube Channel. He lives and works in South Wales, UK.


    1. the editor has messed with the commands
      use the below commands instead:

      curl | sudo apt-key add –

      echo deb public main | sudo tee /etc/apt/sources.list.d/plexmediaserver.list

  1. I am also getting stuck on “sudo apt-key add -” Is there a part of this command I am missing?

  2. > ip=YOUR IP

    Should it be literally like that? I would assume that it needs to be my IP address (so in your case,, but since you DO describe how to get the IP address and NOT where to add it, I’m a bit confused.

  3. Which memory size option (2gb, 4gb or 8gb) would you say is minimum to run a plex server sufficiently?


    1. I’m not sure the amount of RAM makes any difference, it’s mostly about throughput and processor speed as it’s a streaming client.

  4. I created the file and flashed it to the SD. The ID pi works with the IP however when prompted for the password “raspberry” it does not work….. is there another password???

  5. When I try to add folders on my Plex client, it only sees the hard drive connected to the Pi and not any folders in it. But I can see, open and play movies folders directly from the pi desktop.

  6. I am having a problem successfully following your instructions. My plan is to install Plex on my RP 4B running Buster, OMV5, Docker with Portainer, but Plex never sees the files on my media drive. The one item I notice, is all instructions I have read never instruct me to install the Plex Media software. So I tried installing Plex Software following your instructions, and I get error message. Here is the command I entered with the response:
    pi@MediaServer:~ $ | sudo apt-key add –
    -bash: No such file or directory
    sudo: unable to resolve host MediaServer: Name or service not known
    gpg: no valid OpenPGP data found.
    Any Idea what I am doing wrong?

  7. Like almost every other article to Use a Raspberry Pi as a Plex server…it doesn’t work. If your Editors are changing the commands, please re-publish with the proper command entries. RP4b, Debian, 4gb.

    1. Well, if it helps I later went on to make this into a video showing the process in full.

      1. Thanks Phil,
        Your instructions for set up & installation are 100% correct and work. I think I’ve entered these commands at least 100 times by now trying to get my Pi4 to run Plex. The problem occurs that Plex can’t access the files in the external HDD 2Tb Exfat). It mounts automatically. The Pi knows it’s there, plays video just fine in VLC. Plex plays online Plex content just fine. However, there’s a permission issue that the Pi won’t allow the Plex to access the files. I’ve tried changing the ownership to plex. Some command, I don’t remember specifically, where it reads pi:pi and change it to plex:plex and I get a message “Operation Not Permitted”

        I read that recently Plex changed the location of this code to now be installed in the lib files for plexmediaserver. I checked and yes, it’s there. Not where it used to be according to the many tutorials and instructions. It also doesn’t allow changes to the text.

        I’m finding the instructions on my macbook, then hand typing them into my pi. So screen shots & copy paste won’t work. I wish Plex would simply make a Plex Lite, that only does personal media handling. They keep complicating it and making it worse. Their support is also pretty rude and arrogant.

        1. I can’t speak on the rudeness of their support, but if that’s true I’m sorry that was your experience. There’s no call for that, right? I do vaguely recall a part where you change the pi to plex (it’s been some time since I did this) but yes I also have a vague notion I left that as pi because I figured it would work better if I went with the defaults. Things never stay static in the world of tech, and companies make random decisions that change the tech so the tutorials you did don;t work anymore. It’s a factor. Perhaps I’ll do an update at some point if there’s enough interest.

  8. Stucked in configuration page, server running but the plex page asks me to obtain plex media server

  9. I received two warnings. I as able to install ‘ocl-icd-libopencl1’ but apt-get was not able to locate and install ‘beignet-opencl-icd


    PlexMediaServer install: WARNING: Package ‘Beignet’, required for hardware transcoding of HDR content, is missing.
    PlexMediaServer install: Please install package: ‘beignet-opencl-icd’
    PlexMediaServer install: WARNING: The OpenCL library, required for hardware transcoding of HDR content, is missing.
    PlexMediaServer install: Please install package: ‘ocl-icd-libopencl1’

    1. My advice would be to watch my video of the install mentioned above to see if there’s anything different with your install.

    2. I just came across the same after updating Plex recently.

      Those packages are not required for Plex but otherwise help with hardware encoding – something which the Raspberry Pi isn’t that great at anyway. Here, it specifically deals with HDR content.

      From what I’ve found online, Beignet is just for Intel processors/not the Pi (so no worry there), and OpenCL hasn’t been properly setup for the Pi 4. There may be some version out for the Pi 3, but from my searches so far I don’t think it would benefit anything in the Pi+Plex world.

      Since upgrading to whatever this version of Plex is currently (first time noticing the same warnings), I haven’t had any issue with my current videos or performance.

Comments are closed.