Setting up your PLEX Server on Raspberry Pi 4

Danial Hallock
CodeX
Published in
8 min readJun 22, 2021

With The Office having left Netflix, I finally decided to do a technology refresh for my Plex Server, to make sure that it’s good-to-go and cheap to use. I’ve been utilizng an unRAID server built from gaming computer hand-me-downs for most of my household work over the last seven years, but I’d grown tired of the $10–50/yr power costs to power the monstrosity.

Enter the Raspberry Pi 4. With mini-PC technology having come so far in the last decade it seemed like the perfect time to switch to a much more elegant solution for my home server needs. A ten-year old unRAID server is still a little more powerful than what I would be using now, but Plex doesn’t require much power to run internal to your home network. That said, if you plan on streaming (or having others stream) your content from outside your home network, then you’ll want to stick with unRAID for your Plex Server.

However, if you plan on just utilizing Plex inside your home, then a Raspberry Pi 4 will work. So, if you’ve come here just to find that answer (which is surprisingly hard to find!), you’ve found it: Raspberry Pi 4 will run an internal Plex Media Server! Thanks for coming to my Ted Talk. For the rest of this article, I’m going to step through the process of how to set-up a Raspberry Pi 4 Plex Media Server.

First, you’ll want to purchase the required material. I utilized a CanaKit Raspberry Pi 4GB Starter Kit though they now come with 8GB Starter Kits which would also work for Plex Media Server; though the extra 4GB of RAM is really a convenience factor for how quick the Pi operates other functions, not so much transcoding Plex which is uses an identical 1.5 GHz Central Processor in both models. You’ll also need a USB 2.0-capable external hard disk drive (HDD) with external power, like this 8TB external hard drive. These are surprisingly hard to find, because a lot of places don’t make USB 2.0-capable drives, and even fewer make drives that have external power supplies. However, your hard drive needs to have both as the Rasbperry Pi cannot power a spinning hard drive. You could buy an external solid state drive (SSD), but if you’ll likely need two or three of these 2TB SSDs, and they’re each $20 more expensive than the 8TB HDD.

Once you get all of your gear, you’ll need to install it into the case as described in the video below. Before putting the top onto the case, refer to the Quick Start Guide that came with your CanaKit and install the miniature heatsinks on your CPU, RAM, and Gigabit Controller as well as the miniature case fan.

Once you all of these are installed, and you’ve placed the case onto the Pi, install the microSD Card facing upside down (the label should be facing towards the bottom of the case). The SD Card will not be flush with the Pi itself, but will not extend past the CanaKit.

Insert a mouse and keyboard into the USB 1.0 (black) slots, the micro-HDMI cable into the HDMI 0 slot, and finally the power supply into the USB 3.0 slot. The Raspberry Pi should boot in less than 3 minutes, if it doesn’t, turn the Pi off and ensure the SD card is properly seated and try again. If the Pi still doesn’t boot, run through this forum post for troubleshooting techniques. It’s possible that your SD card just isn’t seated correctly, the SD card doesn’t have NOOBs installed, or the EEPROM isn’t configured properly.

Once the Raspberry Pi has booted up, you should be looking at the NOOBS installation page, where you’ll install the Operating System (OS). Install the Raspbian (recommended) option; this will take about 30 minutes on the 4GB model. Reboot at the completion of the installation, when prompted.

After your Raspbian OS boots up, you’ll be prompted to do several things, like set up your language, password, and update your OS. Follow these prompts and restart when prompted. When the prompts stop, you’re ready to begin.

The first step to setting up a Plex Media Server on your Raspberry Pi is to first set your Raspberry Pi up as a network server. That’s a fairly simple process. First, you’ll want to plug in your external hard drive; most preformatted ones will automatically mount and work off the shelf (the recommended Seagate did!), but if yours doesn’t, follow this tutorial. Once your HDD is running, use the Graphical User Interface (mouse-and-click) to find the Hard Drive and delete the files on it, if any, before setting up your desired Plex Media Server folder structure. You can do this in the Terminal, but, honestly, it’s just as easy to do it in the GUI if you’re not familiar with Linux-based OS. This is, however, a temporary solution because GUI-based mounting has some weird hidden permissions associated with it so Plex will never be able to read/write to it!

So you’ll need to permanently mount the drive, and in order to do this, you need to open your GUI file explorer and unmount (the same hidden permissions that prevent Plex from reading/writing to temporarily mounted HDDs can prevent unmounting from the terminal) your hard drive, open a terminal and type the commands below. If you need assistance, click this article for more details on what you’re doing, but for those who don’t need the additional information, proceed below:

mkdir /plex/mediasudo sh (enter your password)dfblkid (enter the /dev/sd### for your HDD; copy the UUID for this drive)nano /etc/fstab (and enter a new line “UUID=######## /plex/media ntfs 
default,auto,rw,nofail 0 1”)
CTRL+X, Y, ENTERmount /plex/media

If you don’t get an error, try navigating to /plex/media (cd /plex/media) and displaying the contents (ls -latr) and see if your files are displayed. If so, you’re good to go and you’re done with this step! If not, this article will help you troubleshoot. If you proceed, you’ll get to the end and Plex won’t display any media, and you’ll be able to loop back to this step to fix. Next, you’ll want to install Samba so that you can share files across your networks by typing the following commands:

sudo apt-get updatesudo apt-get upgradesudo apt-get install samba samba-common-bin

These commands installed the Samba file sharing service into your Raspbian OS, which is how the Linux-based OS shares files on networks. Next, you’ll need to configure the service by modifying its configuration (or conf) file. If you’ want to know more about Operating Systems, services, and what things like “sudo” mean, please check out my book Understanding IT: Decoding Technology and Business. For the purposes of this tutorial, it’s important to know that sudo tells the terminal window to do something as an administrator (the text-based equivalent of hitting “continue” on those pop-ups in Windows 10), and you don’t want to just arbitrarily type sudo followed by commands you find on the internet if they look somewhat shady.

sudo nano /etc/samba/smb.conf

When this file opens up, scroll down to the bottom and add another block using the following text. I recommend that you indent the text the same way it is in the smb.conf file, to keep things easy to read, but that’s ultimately your call.

[Pi Plex Share]path = /plex/mediawriteable=Yescreate mask = 0777directory mask = 0777public = Yes

When you’re done editing the file, you’ll want to use the nano controls to save and exit (CTRL+X, Y, and ENTER). Tada, as long as you followed these steps, then the folders should be discoverable on your network. You’ll want to eventually edit this file to be “public = No” and set up a username and password to secure your files in the event someone is visiting your home, but while setting it up, it’s easier to limit the number of potential hang-ups.

To test your success, go to your Windows 10 computer that’s going to be accessing the share, and enable SMB 1.0/CIFS file sharing Support by going into Control Panel, clicking Programs, and then “Turn Windows Features on or off.”

Once SMB 1.0 is enabled, restart your PC and go to the terminal window on your Raspberry Pi and type hostname -I and write down the IP address. When your Windows 10 computer is rebooted, hit Windows-R and type in \\192.168.X.X\ where X.X is the IP address that you’ve written down, and click Run. If you’ve done everything correctly, you’ll see the folders that you created on your Raspberry Pi!

If you saw that screen, then it worked! Next, if you’re like me, and transferring data from another server, you’ll need to do that now. You can do it the slow and easy way (just copying things over the network using your Windows 10 computer), or you can set up a second external HDD to transfer data bit quicker. I, uh, opted for the lazy method, and it took a long while.

Once that’s completed, or if you don’t have data to transfer over, you’re ready to move onto the next step and install Plex Media Server onto your new Raspberry Pi! While you wait, you might want to make sure that SSH is installed (via the GUI) or by typing sudo raspi-config into the terminal, selecting Interface Options, SSH, Yes, OK, and finally Finish. Once SSH is enabled, try SSHing into your Raspberry Pi and typing sudo whoami. If you’re unable to SSH into your Raspberry Pi at all, or that command doesn’t respond with root, it’ll make things alot easier if you fix those issues now by troubleshooting here or here respectively.

It’s also a good idea to ensure that your Raspberry Pi has a static IP address, either by configuring your router (or whatever handles DHCP in your network) to reserve that IP, or by configuring the Raspberry Pi itself.

Now that your Raspberry Pi is a Network Server, you can go about the process of making it a Plex Media Server by opening a terminal and typing the following commands.

sudo apt-get install apt-transport-httpscurl 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.listsudo apt-get updatesudo apt install plexmediaserver

If you get the error /usr/lib/apt/methods/https could not be found, then retry — you likely overlooked an error or warning at the sudo apt-get install apt-transport-https. Once its done you can navigate to the Plex Web App through your web browser through the IP address:32400/web/, and it should look like this!

At this point, ripping media content into your Plex Server remains the same process for a Raspberry Pi as it does unRAID: Handbrake! You can read the tutorial on that by clicking the button below, and once you’re done you’ve got your own Netflix!

--

--

Danial Hallock
CodeX
Writer for

Danial Hallock has 15-years of experience in the U.S. Defense industry and writes about geopolitical and STEM topics on the weekends. His views are his own.