How to Install Plex on the Raspberry Pi 4

The Raspberry Pi, with its tiny footprint and low power draw makes for the perfect network-attached storage (NAS) device. There are several means of spinning up a Raspberry Pi media server, but my favorite option is Plex. The robust media server software option offers a comprehensive feature set that's at once easy to use and highly customizable. Learn how to make a Raspberry Pi Plex server for an affordable Plex streaming device!

What is Plex Media Server?

Plex is a media server software offering. You can think of it as a sort of do-it-yourself Netflix. Whereas streaming subscription services like Hulu and Netflix host content, with Plex you provide content such as movies, TV shows, and music. Then, Plex scrapes your libraries and adds box art and metadata for a lush user interface. Aside from videos and audio, Plex can host photos as well. Aside from a Raspberry Pi, Plex can run on Docker, Linux, macOS, Windows, and FreeBSD. 

Why You Should Use Plex for a Raspberry Pi Media Server

My Plex journey began in 2016 when I began ripping my DVDs and Blu-Rays. Initially, I ran a Plex server off of an aging AMD A10 APU-powered HP laptop before graduating to a Xeon-powered Lenovo ThinkServer TS140. While I'm still a dedicated collector of physical media, from VHS tapes and LaserDiscs to DVDs, Blu-Rays, and vinyl, having my entire movie, TV show, and music collection backed up on my Plex server is a huge bonus. Discs can get scratched and suffer from disc rot, so a back up digital copy means extra redundancy. Sure, hard drives are far from infallible. But you can easily back your digital media collection to onsite drives or cloud storage providers. 

Plus, there's the convenience of being able to access my media library from anywhere. If I'm on vacation and want to watch a movie, I can merely pull it up on a Plex client such as my phone, tablet, or laptop. Furthermore, Plex evolved into the ultimate app for cord-cutters. While it began with a media server focus, Plex added features such as podcasts, web shows, streaming news, Tidal integration, DVR functionality, and now free ad-supported movies and TV shows thereby positing it as a true cord-cutting haven. 

  • Stream your movie, TV show, and music collection to compatible client devices
  • Cord-cutting features such as ad-supported streaming movies and TV shows, Tidal integration, web shows, and podcasts
  • Easy to use yet highly customizable

Can the Raspberry Pi Run a Plex Server?

Considering its modest specs, you might wonder if you a Raspberry Pi can even run a Plex server. While you can create a Raspberry Pi-based Plex server, performance won't match that of a dedicated server, or even an older laptop or desktop. Still, the price-to-performance ratio is fantastic. Plus, the Pi sips energy whereas even a low-power server that's always-on will still drive up your energy bill at least a bit. 

Although you technically can transcode on a Raspberry Pi Plex media server, you can't transcode well. This is a project mostly suited to in-home streaming to direct-play compatible Plex clients. Any Raspberry Pi 2 or newer board should be able to handle Plex server use. However, I'd suggest at least a Raspberry Pi 3 B+ or, better yet, a Raspberry Pi 4 Plex server. 

  • Great for in-home streaming
  • Can transcode but not well 
  • Excellent for direct play
  • Low power
  • Small footprint
  • Affordable Plex server solution

How to Make a Raspberry Pi Plex Server

Building a Raspberry Pi Plex server is pretty easy. You'll need little more than a Raspberry Pi board, microSD card, case, peripherals such as a keyboard and mouse, as well as an active internet connection. Additionally, you'll need to install software, namely Plex media server for the Pi. Depending on the size of your media collection, you'll probably want a large capacity flash drive or external harddrive. Finally, you'll need a Plex client device, or another device that you can stream Plex to. This could be simply a Windows, macOS, or Linux PC, a game console like a PlayStation 4 or Xbox One, dedicated streaming device such as a Roku, or even another Raspberry Pi board. 

What you need to make a Raspberry Pi Plex server:

  • Raspberry Pi board (Raspberry Pi 2 or newer)
  • microSD card
  • Raspberry Pi case
  • Compatible Raspberry Pi power supply
  • Debian Linux-based Raspberry Pi operating system (i.e. Raspbian)
  • Peripherals (keyboard, mouse)
  • Plex media server software
  • Plex client

Total cost: $35+ USD. You can snag the base Raspberry Pi 4 for a mere $35 for the standalone 1GB Raspberry Pi board. Then the 2GB RAM model retails for $45, while the 4GB Raspberry Pi variant clocks in at $55. If you're just starting our, I highly suggest snagging a complete Raspberry Pi kit. Especially if you're streaming and using your Raspberry Pi as a NAS, you'll want to keep your device cool, and a case with a heatsink goes a long way in that. Plus, many Raspberry Pi starter kits include a microSD card. 

How to Set Up a Raspberry Pi Plex Server

Before proceeding with using your Raspberry Pi as a Plex server, as with any software installation, it's best to perform an update. In a new terminal, run:

sudo apt-get update 

sudo apt-get upgrade

After that, you'll need to install Plex Media Server. Before doing so, it's necessary to add the Plex package repository which requires installing the apt-transport-https package. This allows the apt package manager to obtain packages over an https protocol. Enter the command:

sudo apt-get install apt-transport-https

With the apt-transport-https package successfully installed, it's time to add the Plex repositories to the apt key list. This verifies that any files you download from the Plex repo are signed with that key. Add the Plex key:

curl https://downloads.plex.tv/plex-keys/PlexSign.key | sudo apt-key add -

Now that the Plex key is added, you can go ahead and add the official Plex repository:

echo deb https://downloads.plex.tv/repo/deb public main | sudo tee /etc/apt/sources.list.d/plexmediaserver.list

After that's finished, run an update:

sudo apt-get update

Because the Raspberry Pi is configured to read the official Plex package repositories, you can install Plex media server with:

sudo apt-get install plexmediaserver

The Plex media server package features a default user of plex. But it's a good idea to change this to pi instead to avoid any potential permission problems. Open the /etc/default/plexmediaserver file using a text editor such as Nano:

sudo nano /etc/default/plexmediaserver

Find the PLEX_MEDIA_SERVER_USER line and change that from plex to pi

Next, find:

export PLEX_MEDIA_SERVER_USER=plex 

and change it to:

export PLEX_MEDIA_SERVER_USER=pi

Save when you're finished with CTRL + X, then hitting Y and Enter. Next, restart the Plex media server service using:

sudo systemctl restart plexmediaserver

Plex should be properly installed on the Raspberry Pi. 

Setting a Static IP on the Raspberry Pi

Although your Raspberry Pi Plex media server should be technically ready to begin streaming, it's a best practice to establish a static IP on your Raspberry Pi. To set a static IP address on your Raspberry Pi, enter the command:

hostname -I

Next, open up cmdline.txt:

sudo nano /boot/cmdline.txt

Where there's the line IP, enter your IP address:

ip=RASPBERRY PI IP ADDRESS

After you've input your Raspberry Pi's IP address, hit CTRL + X, then Y to save. Once you've configured a static IP address on your Raspberry Pi Plex server, restart your device:

sudo reboot

Adding External Media to the Raspberry Pi

If, like me, you've got a massive media collection, your Raspberry Pi microSD card might not be sufficient to hold your entire media library. As such, you'll need to use an external drive such as a flash drive or hard drive. As of Raspbian Stretch, USB drives should auto-mount. 

But you can always manually mount. To see where drives are mounted, run:

sudo cat /proc/mounts

This lists a string of any connected USB drives. For instance, my 1 TB external harddrive appeared under /dev/sda1

Alternatively, you may prefer to manually mount a USB drive in the Raspberry Pi. You can accomplish this pretty easily by establishing the drive under the fstab file. If you're using an NTFS drive, install the NFTS 3G package:

sudo apt-get install ntfs-3g

If you know the UUID, you can enter that. To discover the UUID, you can obtain a list of all connected drives with:

ls -l /dev/disk/by-uuid

Find a drive with an /sda address, such as /dev/sda1. After that, you should see a string that's the UUID.

Then, create a new directory to mount the USB to:

sudo mkdir /media/usb1

Find out the GID with:

id -g pi

And locate the UID using:

id -u pi

After that, edit the fstab file:

sudo nano /etc/fstab

Add a line with the necessary information about your external drive:

UUID=NAME OF DRIVE /media/usb1 auto nofail,uid=your_uid_here,gid=your_gid_here,noatime 0 0

Save and exit with CTRL + X, then Y. You'll need to unmount the drive:

sudo umount /dev/sda1

Then mount your drives with:

sudo mount -a

And you can restart your Raspberry Pi Plex server to double-check that all drives have properly been mounted:

sudo reboot

Upon rebooting, your external drives should auto-mount. 

Configure Plex on the Raspberry Pi

With Plex installed and your external drives set up, it's time to configure Plex on the Raspberry Pi and point it toward your media library. Head over to localhost:32400/web/ where you should see the Plex log in screen. 

First up, you'll need to name your server. I went with RasPlexPi but you can give your Pi server whatever name you like. Hit Next and point your Plex server software towards your media libraries. On my external drive, I've got a media folder at the root of my drive with subfolders for movies, TV shows, and music. Click Add Library, and select the library type, such as movies, TV shows, music, photos, or other videos. Then, find the folder where your media files are located and they'll be added to your library. 

Raspberry Pi Plex Server Performance

how to install plex on the raspberry pi - how to set up a raspberry pi plex serverUltimately, Raspberry Pi Plex server performance will vary based on the specific files you're streaming, what clients you're streaming on, and your internet connection. Likewise, which Raspberry Pi board you're running Plex on affects streaming performance. However, generally a Raspberry Pi 4 Plex server will provide the best experience. Can a Raspberry Pi transcode in Plex? Yes, although not well, and not smoothly. You'll definitely experience buffering for Pi Plex transcoding. As such, direct play works much better. 

how to install plex on raspberry pi - raspberry pi plex server performance1080p direct play files work extremely well on a Raspberry Pi 4. Moreover, a Raspberry Pi 4 can handle about 4 or 5 simultaneous direct play files. For in-home streaming, the Pi 4 is a great Plex server option. What really surprised me was that my Raspberry Pi Plex server handled 4K direct play. Transcoding is out of the question, but that's incredibly impressive. 

Is the Raspberry Pi Good for a Plex Server?

Now, the big question: Is the Raspberry Pi good for a Plex server? Absolutely, but with a caveat. As long as your Plex clients and files allow for direct play, you're streaming in your home as opposed to remote, and don't need to exceed around four or five simultaneous direct play streams, a Raspberry Pi Plex server is a cost-effective, energy-conserving Plex server alternative. With a starting price tag of just $35, it's super easy to whip up a Plex media server with a Raspberry Pi.

Admittedly, my Pi Plex server isn't going to replace my beefy Xeon-powered TS140. My 24/7 dedicated Plex server can handle around four simultaneous 1080p transcodes, and can easily transcode 4K Blu-Ray rips. The Pi can't even come close. Still, it's much more than the price of a Raspberry Pi, and the modest standard desktop PC case features a much larger footprint than the Pi. Similarly, despite its low power draw, my Lenovo server is power-hungry when compared to the Raspberry Pi. If you're merely serving media to clients around your house, a Raspberry Pi Plex server is an excellent media server solution that won't break the bank. For streaming media and local file playback, transform your Raspberry Pi into a low-power home theatre PC

Leave your feedback...