Turn a Raspberry Pi into a Plex Media Server

The Raspberry Pi is a very capable little device that can do all sorts of things. One cool thing is being able to turn it into a Raspberry Pi Plex Media Server. Plex is a media player that organizes all of your TV Shows, Movies, Music, and Pictures. The Plex server will allow you to transmit all of your media to a client, which can be pretty much any device (eg. PS4, Xbox, Smart TV, Tablet, Phone, etc). You don’t even necessarily need to be connected to your home network to access your media, you can be anywhere in the world.

The Raspberry Pi is a very ideal way to host a Plex Media Server. Not only is it an inexpensive Linux computer (about $35) but it has very low power consumption. A typical laptop uses 60 watts per hour, the Raspberry Pi uses 1.4 watts per hour. A media server is meant to be on most of the time, so minimizing power consumption is important.

raspberry pi plex server

The Ideal Setup

Which model of the Raspberry Pi should I use?

A Raspberry Pi 3 or 2 will work best. I do not recommend using the original Raspberry Pi since the components are outdated and the server may run sluggishly.

Caveats: Running a Plex server on a Raspberry Pi limits your streaming to 1080p. You will not be able to stream 4K movies due to the Raspberry Pi’s limited power. If this is an issue I would suggest looking into the more powerful ASUS Tinker Board.

Where to store your media files?

The best place to store your media files would be a Network Attached Storage (NAS). This could be in the form of a traditional NAS like “WD My Cloud” or similar, or simply an external HDD connected via the USB port of your router.

Though less ideal/convenient, you could also place your files on your Raspberry Pi’s micro SD card or connect an external HDD to your Raspberry Pi. These are less ideal than a NAS because video files are large, and large micro SD cards are expensive. Although Pi Ethernet speeds are limited to 100Mbps, and USB 2.0 transfer speeds are higher, the convenience of a NAS outweighs this for me.

Update: You can check out Jeff Geerling’s post for information and benchmarks on adding a Gigabit adapter to your Pi to increase Ethernet speeds.

Requirements

Instructions

1. Install Raspbian OS

First, you must install the Raspbian OS on your Raspberry Pi. Check out the official guide here.

2. Install the Raspberry Pi Plex Server

We will need to make sure that our Raspberry Pi software is up to date before we proceed to install Plex. Log into your Raspberry Pi, open up a terminal window and type the following commands:

This can take a while if you are running a fresh install of Raspbian or if you haven’t updated your packages in a while.

Once that is done, we will install the “apt-transport-https” package since we will be downloading the Plex Server from an unofficial source that has an https address.

Next, we will download a secure key that will authenticate our downloads from Dev2Day (source where we are downloading from). Dev2Day has compiled the Plex Server for the Raspberry Pi.

After that has downloaded, we will add the Dev2Day repository to our Raspberry Pi source list.

Run the apt-get update commend again to refresh our repository list.

Finally, we can install the Plex Server. This will take a few minutes.

Now, let’s set Plex to run under the Pi user.

Your terminal window will fill with a big text document. Look for the line that says:

Delete “plex” and type in your username (by default “pi”).

Now press CTRL+X then Y then ENTER.

Now restart the plex server:

Now do a reboot:

3. Set a static IP address

We want our Raspberry Pi to have a static IP address so that every time we try access our Plex files, it knows where to look. Open up a new terminal and type the following command:

You will get a screen similar to this:

Once your screen, note the IP address that follows “inet”. Jot this down or remember it.

Next, type the following command to get your router’s gateway address.

Note the IP address under gateway. This is our routers address.

In the terminal, type:

Use your arrow keys to go navigate to the bottom of the file. Set your static IP address like this (change ip_address and routers values):

After you are done, press CTRL+X then Y then ENTER to save the file. You may need to reboot your Raspberry Pi for these changes to take effect.

4. Map a Network Drive to your Raspberry Pi (optional)

If your files will be stored externally (not on the Pi or a storage device connected to it) you will need to make some additional changes. Whether you have a NAS or a router equipped with a USB port you will want to map your network drive.

Create a folder on your Raspberry Pi to mount the drive in.

I mounted mine at /home/pi/DRIVE/share

To do this, type these commands in your terminal (change ‘DRIVE’ and ‘share’ to whatever you want)

Now mount your drive to the directory you just created:

If you are using a external HDD connected to the USB port of your router, your username and password will be what you normally use to log in to your router settings. You can replace “NIGHTHAWK” with the gateway address of your router as well.

Otherwise, use the credentials you set up when you installed your NAS.

Now, navigate to your drive by browsing to its mount point

If your see your files there, it worked.

Important: If you reboot now, your network share will not automatically mount itself. In order to automount your drive on each boot we will need to take a couple of extra steps.

To do this, we need to edit the /etc/fstab file, Run the following command to edit the /etc/fstab file:

User your arrow keys to navigate to the bottom of the file and add this (change as appropriate):

Now press CTRL+X then Y then ENTER. All done! Your share will automount at boot.

5. Setting up your Plex Media Server

Now it’s time for the fun part — adding media to your media server!

On any computer connected to your network (including your Raspberry Pi itself), open a web browser and navigate to your Raspberry Pi’s static IP address like so (change ip address to yours):

You will see something like this. Go ahead and click ‘Add Library’.

Select your library type, click next, and browse to your network share, USB drive, or folder. Don’t click on a specific movie/show, just the root directory where they are stored.

After you do this for the rest of your media types, your library will begin to populate. You can see Plex is automatically adds Cover Art and media descriptions, which is nice!

6. Access your media from anywhere

The last step is to enjoy and watch your media from anywhere! Go ahead and download the Plex app to whatever device you want to watch your media on.

You can also access your media outside of your home network. Go into settings and make sure this is not disabled.

Another setting you can turn on/off is DLNA. DLNA allows devices that support it to be able to see and access your media server without downloading the Plex client or anything at all. It will just show up (if you’re on your home network).

As always, let me know if you have any questions or comments!