Plex Media Server Raspberry Pi

Plex Home Movie Server – Raspberry Pi

Plex Media Server is an easy-to-use media server when you want to organize your movie collection. It can run on a wide variety of hardware including my favorite the Raspberry Pi 4. I would recommend using the Raspberry Pi 4 for this project the lower-end models just don’t cut it. If you plan on streaming 4k video from your Plex Server consistently you will need something more powerful than the Raspberry Pi 4. It does not have the processing power to keep up with encoding such large videos.

Hardware I Will Be Using

  • Raspberry Pi 4 – 4 GB Edition
  • USB 3 External Hard Drive – 2 TB (*Not required)
  • SATA Hard Drive – 1 TB (*Not required)
  • SATA to USB 3 Adapter (*Not required)
  • Case with Fan (*Not required)

Setting up Your Plex Server

For this guide, we want as much CPU power as possible for our Plex Server so we will be using Raspberry Pi OS Lite (link to the download page here). You are going to want to use a headless setup, there are few methods of doing this but I cover one in Headless Raspberry Pi Setup. So if you are unsure please check out that article before continuing. It will guide you through setting up your device. Before going any further let us quickly update our Raspberry Pi so we have all the latest packages. Run the following command in your console:

sudo apt update && sudo apt upgrade -y && sudo reboot 0

After the Pi is done rebooting you will be ready to continue to the next steps.

Seting Up the Hard Drives

Since we are running a movie server we will need a decent amount of space to store our movies and TV shows. SD Cards will not last forever if you are constantly reading from and writing to them. If your hard drive is using an EXT4 file system you can skip installing the NTFS or FAT32 file systems. If you are not using any external hard drives you can skip this section.

If your hard drive is using the NTFS filesystem you will need to install the following:

sudo apt update && sudo apt install ntfs-3g -y

So we have our hard drive(s) ready, now we need to find the path we can list all the hard drives with a simple command:

sudo blkid
Results of blkid on Raspbian

In the above image, you can see an example output from the command above my external drives are named Reserved and EXTHD. Take note of the path(s) (example: /dev/sda1) of your drive(s) we will need to use the paths later. Let’s make a folder structure where we can mount our drives. I am going to be using the naming convention of hd1, hd2, etc, etc.

sudo mkdir /mnt/hd1 && sudo chmod 775 /mnt/hd1
sudo mkdir /mnt/hd2 && sudo chmod 775 /mnt/hd2

The above command will make two new directories for us inside the /mnt folder. It will then set the permissions on the directory. If you are only using one external drive you can skip hd2, and if you are using more you can just keep incrementing the number until you reach the number of drives you will be using. Next, we need to mount the drives so we can access our files:

sudo mount -t ntfs-3g -o uid=1000,gid=1000,umask=007 /dev/sda1 /mnt/hd1
sudo mount -t ntfs-3g -o uid=1000,gid=1000,umask=007 /dev/sdb1 /mnt/hd2

So, we have our drives mounted but we want this to happen every time the Raspberry Pi boots. We are going to be editing a sensitive file so the first thing we should do is make a backup. You should always make backups before making any changes to the system.

sudo cp /etc/fstab /etc/fstab.backup

Let’s open fstab in nano my personal choice for making simple changes to files.

sudo nano /etc/fstab

We are going to be adding a new line for each drive we want to add, I will be using two like before. Before the # at the end of the file we are going to add:

/dev/sda1 /mnt/hd1 ntfs defaults 0 0
/dev/sdb1 /mnt/hd2 ntfs defaults 0 0

Press Ctrl + X, then Y and Enter to save the file. So now that we have finished setting up the hard drive(s) we can move on but let us do a quick reboot first.

sudo reboot 0

Setting Up Plex Server on Your Raspberry Pi

Static IP For Your Plex Server

Some routers have the ability to set static IPs in the admin interface, if yours does then assign one there. If not continue this section. Run the following code to start the DHCPCD service and open the configuration file in nano:

sudo service dhcpcd start
sudo systemctl enable dhcpcd
sudo cp /etc/dhcpcd.conf /etc/dhcpcd.conf-back
sudo nano /etc/dhcpcd.conf

This will start the DHCPCD service, enable it on boot, make a copy of dhcpcd.conf file and finally open it in the nano editor. At the bottom of the file, we want to add the following, editing with our own settings.

interface eth0
static ip_address=192.168.0.175/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1

You will need to set the above based on your network configuration. After adding your information press Ctrl + X, then Y and Enter. We are going to reboot just to make sure everything is working so far.

sudo reboot 0

Installing Your Plex Server on Raspberry Pi OS

For this section, we are going to need to install a few pre-requisites for using HTTPS repositories and curl to download the Plex GPG Key. Then we are going to import the GPG key, update our local repository cache, finally, we are going to install the Plex Server. It may take several minutes to run this.

sudo apt install apt-transport-https ca-certificates curl -y
curl https://downloads.plex.tv/plex-keys/PlexSign.key | sudo apt-key add -
echo deb https://downloads.plex.tv/repo/deb public main | sudo tee /etc/apt/sources.list.d/plexmediaserver.list
sudo apt update
sudo apt install plexmediaserver -y

Our Plex Media Server is now installed! Time to check and make sure everything is running ok. To do that we can run the following:

sudo systemctl status plexmediaserver

You will see some output like the following if everything is working properly.

Thank you for joining me on this journey.

A Few Things I Have Found

  • Can Plex on the Raspberry Pi stream to multiple clients?
    • Yes and No, it depends on the quality of what you are trying to stream I find I can stream to 2 devices at 1080p on my local network with little issues.
  • Can the Raspberry Pi support streaming at 4k?
    • Yes it can but you may occasionally see a error about not being powerful enough.

By Andrew

I love technology, and when I found Raspberry Pi's I was instantly hooked. Within the first week I had at least 5. I am also a avoid programmer so I made this blog about my creations to help others do cool things with their Pi's.

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x