Skip navigation

How-To

Using a Raspberry Pi 4 as a Plex Server

Christan Fergus • 2020


A run-down of my experiences with the Plex media server on a Raspberry Pi 4. Installation, lessons, enhancements, and tweaks.

Plex is a fantastic way to watch and share all of your media with one powerful tool. Even better, it can be installed on a small footprint with a Raspberry Pi. If you like to tinker, this tutorial is for you. However, just because you can, doesn’t mean you should. While the Pi is a great way to get Plex going, it doesn’t have the horse power to do lots of high quality simultaneous device streaming. That said, for most people, it will do the job nicely.

Requried Kit

Hardware

  • Raspberry Pi 4 (4GB RAM is pretty necessary)
  • USBC power adapter
  • Mini HDMI to HDMI cable
  • Micro SD card (32GB or more)

Software

  • Raspbian OS
  • Plex Linux Server

Set up the Raspberry Pi

Install Raspbian OS

In this section we're going to get the Raspbian OS up and running so that we can then install Plex.

  1. Download NOOBS
  2. Format your micro SD to FAT.
    The Mac's Disk Utility is an easy way to do it.
  3. Transfer Noobs onto the SD card.
    Note: Only transfer the files inside the downloaded folder. Noobs will not boot if you transfer the root folder over.
  4. Insert the SD card into the Pi and turn it on. If the files were transferred correctly, the Pi will automatically boot up to a distro install screen.
  5. Choose Raspbian and install. Either full or basic are fine. I went with basic to preserve a little space and the fact I wouldn't be using any extra software.
  6. Follow all the prompts making sure to change your default pi password, set up wifi, download any updates, etc.
  7. Finally, enable SSH via the GUI to enable remote access from another computer: Pi Menu>Preferences>Raspberry Pi Configuration>Interfaces>SSH=Enable.
    This is very handy if you end up having your setup in a hard-to-access location, or run it headless. In most cases, I do all my RP work over SSH since my Pi is located in an invonvinient place.

Prepping your system and storage requirements

There a few things you'll need to make sure are installed and working properly to ensure everything goes smoothly. Launch the terminal on your Pi and get to work.

  1. Ensure HTTPS transport package is installed (it most likely is for the latest versions of Noobs & Raspbian):
    sudo apt-get install apt-transport-https
    Code example reading, "sudo apt-get install apt-transport-https".
  2. If you're going to be dealing with NTFS drives, you'll want the NTFS packages:
    sudo apt-get install ntfs-3g
    Code example reading, "sudo apt-get install ntfs-3g".
  3. If you're dealing with EXFAT drives:
    sudo apt-get install exfat-fuse exfat-utils
    Code example reading, "sudo apt-get install exfat-fuse exfat-utils".
  4. Finally for this section, find out what architecture you have. This is how you're going to determine the correct version of the Plex server to download.
    dpkg --print-architecture
    Code example reading, "dpkg --print-architecture".
    Remember what's returned, you're about to need it.

Set Up Plex

  1. Head to the Plex download page and grab the right version for your Linux distro. In our case, Raspbian is a Debian fork, so you want the Debian install. In addition, you want the right version for your architecture (the value you got in the last step).

    • armhf requires the ARMv7 package
    • arm64 requires ARMv8 package

    Do not extract the downloaded package in the GUI, we'll do that via the command line.

  2. Back in the terminal, run the following command to install the Plex server:

    sudo dpkg -i [DOWNLOADED FILE, i.e /Downloads/plex_etc...]
    Code example that shows the command to find and install the plex server: sudo dpkg -i [location of file]

  3. You now need to change the default Plex user from "plex" to whatever your chosen username is. Let's face it, it's probably "pi", amirite? You will do this in the command line. I used Nano to edit the file, but you can use the editor of your choice.
    sudo nano /etc/default/plexmediaserver
    Code example that shows the command to change the default Plex user.
  4. In the file, locate the line reading, PLEX_MEDIA_SERVER_USER=plex and change the user from plex to your user name (which is probably pi). PLEX_MEDIA_SERVER_USER=[YOURUSERNAME].
  5. Save your changes and exit out. If you're in Nano and not sure how to do so: CTRL+X, Y, ENTER
  6. Once everything is installed, in your browswer, navigate to https://127.0.0.1:32400/web where you should see the glorious Plex logo appear!
  7. It's now time to have Plex discover your content. Connect your hard drive(s) to the Pi if you haven't already.
  8. Follow the setup steps on the Plex server site that you just navigated to. At some point, it will ask you to set up your content libraries. This is where you're going to find out if you need to do some harddrive mapping.

    Go ahead and choose the type of library you want to set up (movies, music, TV, etc.) and navigate to the harddrive that contains the files.

    If you can see your hard drive contents you're in business. If you cannot, there is more work to be done. You must manually map your drives. For information on how to do that, check out these resources:

Stay Up-To-Date

Plex frequently releases updates to the server. The easiest way to stay up-to-date is to periodically run an update command. For this, I went ahead and created a bash script so I wouldn't have to run everything manually. The script involves these commands:

#!/usr/bin/env bash
# runs a full system update and install

sudo apt update -y
sudo apt full-upgrade -y
sudo apt clean
sudo apt autoclean
sudo apt autoremove
my bash script

There may be an occasion where you need to start, stop, or restart the Plex server. You can do so with these commands:

sudo service plexmediaserver start

sudo service plexmediaserver stop

sudo service plexmediaserver restart
Managing the Plex server status

This tutorial only scratches the surface of how you can install and tweak Plex. If you like to get your hands dirty, it's a fun project to tweak and maintain.