Plex is a wonderful piece of kit, a media server software which allows you to stream your movies and TV shows directly to any Plex client. Plex clients can be a page in a browser on a computer, an app on a tablet or phone, an Android TV box, or even an app on your Smart TV. Either way, the server software is neat and flexible and fast, and it keeps your movie and TV collection well organized and accessible. In this article we test the feasibility of making, and actually build, a standalone Plex server from a Raspberry Pi 4 and a hard drive.
Why the Pi 4?
The Pi 4 is your best bet when you are building a Plex server. The reason for this is purely about speed. Firstly, it’s a very fast little computer, almost up to the level of a low end laptop. Secondly, it has fast USB 3.0 ports to hook up a hard drive to storr the films. In video streaming it’s all about data throughput.
The USB 3 sockets on a RasPi 4 are more than fast enough to shoot the data from the disk into the server brain and out to the waiting clients. Although it’s possible to use previous revisions of the Raspberry Pi for this build, the Pi 4’s USB 3.0 ports really pay off. Previous Pi USB 2.0 sockets run at 30-35MBps, whereas the new USB 3.0 runs at 320-360MBps, which is like a ten-fold speed hike.
With transfer rates like that, it’s totally feasible to run external drives from the USB at something approaching normal computer speeds. You can run external drives on a USB 2.0, but they drag a little, and you don’t want that while streaming HD or UHD video.
Another thing in the Pi 4’s favor is its Gigabit ethernet. Not only does the video fly off the drive, but it flies down the pipe via the router to your client, too, be that on a wired connection or Wi-Fi. The only bottleneck then is the speed between the router and the client, and that doesn’t matter quite so much.
Creating the Pi Plex Server
So to build this server you need the following items:
- A Raspberry Pi 4 (in a case with heat sink or fan cooling preferred)
- USB C power supply (official power supply preferred)
- An SD card of sufficient capacity
- Ethernet cable or Wi-Fi
Firstly, install Raspbian on the card. You can get this from the Raspberry Pi Download page. Download the image and burn it to the SD card with appropriate software, like the excellent cross platform balenaEtcher, for example.
Install the SD card in the Pi as normal and boot it up.
Prepping the Pi
Once you get a command prompt, input the ID as
pi and the password as
raspberry to log you into the Pi.
Now you need to prep the installation, and to do that you need to make sure the Pi is fully up to date. Type the following:
Say yes to everything. You should probably reboot, so when it comes back up, just pop in your ID and password again.
Now you need to download the correct repository containing the Plex server for Raspberry Pi Linux. You do this by first installing the https download transport for APT with the following command:
Before we can download the Plex repo, we have to add the Plex GPG key or “PlexSign.key” to the repo with the following commands:
Now that the key has been added, we can download the server software with the following commands:
Once that is done, you need to run the update command again to refresh the Pi:
When that has completed, we can finally install the server software onto the Pi.
Installing the Plex Server
Installation of the software itself is quite easy. Just type:
And if the repos are in place, it should install easily and normally. Now you need to ensure that the IP address on the network remains static. You do this first by finding out what the IP address currently is, then editing the “cmdline.txt” file to reflect that.
Find your current IP address by typing:
In my case, this returned an answer of “192.168.0.53.” Your mileage may vary. It may be that your network uses 192.168.1.x addresses. It all depends on your router.
Now open the “cmdline.txt” file and edit it. Open the nano editor and the file by typing:
and add the line:
to the bottom of this file and save it with Ctrl + X. (Answer “Y” at the prompt.)
and your Pi will restart. You’re all set up, and the Pi can now run the Plex server headerless, so you don’t have to have a monitor plugged in. Use your Plex client or go in with a web browser to port 32400, like so:
where the first part is your IP address, as above. That is mine – you will need to substitute your own.
Either way, if you are successful, then the server will show up as one of the choices.
Then finally you can add the Library from your media files on disk. Choosing either movie or TV type library changes the way the files are organized in the database.
Break out the Popcorn
A few things to note: I’ve seen some tutorials on this subject which state that you need to change the name of your user to Plex in order for this to work. That’s not true; go with the default settings.
If your movie and TV files are on a USB stick and the USB ports are mounted, then you should be good to go. Be warned if you have a lite version of the OS (like I did), you may have to manually mount the USB drives. Better yet, edit the “/etc/fstab” file to mount them automatically.
This goes double if you are using an external USB hard drive; you will have to format it and mount it on the system. There are all kinds of drive types and operating systems, and all other info you might need about that is right here in our previous article about making a NAS with a Raspberry Pi.
Also, you can hot-swap drives on the system if, for example, you wanted to add files to them, but you have to make sure they are mounted again for the server to access them. The Plex database will update automatically once the drive is seen by the system.
If you have any questions about making your own Plex server, please let us know in the comments.
Get our stories delivered to your inbox.