How to setup Plex Media Server on your Raspberry Pi

For the uninitiated, Plex Media Server allows you to stream content (Movies, TV Shows, etc.) from your local drives to any device that is connected to your Wifi (or sometimes even to the internet). You can find my previous article below where you can try setting it up on your PC / Laptop (takes 5 mins) and see if you like it (you definitely will).How to stream content from your external storage driveBefore I begin describing the steps to install, I must mention that my Raspberry Pi 4 Model B (4GB Ram) can provide streaming for up to 5 devices seamlessly (without buffering) when my files do not require any transcoding.Now, for those who don’t have a Raspberry Pi, I would recommend buying a kit that includes all the peripherals required to set up a Raspberry Pi (Indian users can have a look at this – PiBox Jump Start Kit).You can install the Raspbian OS on it using NOOBS which is the easiest method and that is all you would need.Install Raspbian OS –

Once you have your Raspberry Pi all set up, we can install Plex Media Server on it.

Downloading Plex Media Server

  1. Before we download Plex Media Server we need to ensure that our OS is updated. Open a terminal and paste the following commands.
sudo apt-get update
sudo apt-get upgrade
  1. Now, to retrieve Plex packages we need to first install the “apt-transport-https” package which allows “apt” package manager to retrieve packages over the “https” protocol that the Plex repository uses.
sudo apt-get install apt-transport-https
  1. Let’s add the Plex repository to the apt manager’s 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.
curl | sudo apt-key add -
  1. With the Plex key added, we can add the official Plex repository to the sources list.
echo deb public main | sudo tee /etc/apt/sources.list.d/plexmediaserver.list
  1. As we have 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

Installing Plex Media Server

  1. Now that our Raspberry Pi can read from Plex’s official package repositories, we can go ahead and finally install the Plex Media server package to the Pi.
sudo apt-get install plexmediaserver
  1. 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 are 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”

    You don’t have to worry about any of this.
  2. Since plex made it’s own user and group, it will run without any trouble on that user profile. But, we want plex to run on our profile itself. So, to avoid any authorization issues with the Plex server, we will exchange the default user profile (which is “plex”) with an administrator profile of our choice (which is the default “pi”). Let’s open the plexmediaserver file and edit the default user.
sudo nano /etc/default/plexmediaserver
  1. Search for “PLEX_MEDIA_SERVER_USER=plex” and change it to “PLEX_MEDIA_SERVER_USER=pi”.Exit the editor and say yes to saving your changes (Ctrl + X then Y).
  2. We have to restart our plex server for the new settings to take effect.
sudo service plexmediaserver restart

Now, in order to make your Raspberry Pi easy to access across all devices on your Wifi network, we must give it a static IP address.

Setting a static IP address for our Raspberry Pi

To make our Raspberry Pi easily accessible over our Wifi network we must give it a static IP address.

  1. Let’s find our current IP address and make a note of it.
hostname -I
  1. Now open the “/boot/cmdline.txt” file.
  2. Insert a new line “ip=” at the end of the file. Save and exit the file (Ctrl + X then Y). There you go. Now, your Raspberry Pi will always be available on your Wifi network under this address. Which means, you can type “:32400” on any device’s browser (in the same Wifi network) and you will land on the Plex server that is running on your Raspberry Pi.
  3. Restart your Pi
sudo reboot

How to add files to your Plex library

You will most likely be adding files from your external storage and you would want it to always have the same drive name so that your Plex server can find your files easily. I would personally recommend enabling automatic mounting for your external drive so then your Raspberry Pi will always mount your drive to the same location from where the Plex server would be reading them.How to automount your drive on Raspberry Pi –

This completely automates your Plex server as you would then never have to worry about configuration ever again. Just turn on your Raspberry Pi and you are ready to stream!

You can now start the browser on your Raspberry Pi and navigate to “localhost:32400” and you will see Plex waiting for you to load your media files.

With your Plex Media Server is up and running, you can add media files to your Plex library. It is pretty straightforward, but If you need help on how to do that, you can see this picture walkthrough on my previous post.How to stream content from your external storage drive

 5,551 total views,  1 views today

How did you like the article?