TechJunkie is a BOX20 Media Company

Home PC Windows Set Up A Plex Media Server And Player With The Raspberry Pi

Set Up A Plex Media Server And Player With The Raspberry Pi

Why Plex?

So, you want to set up a home theater streaming solution in your home. You have two obvious choices, Plex and Kodi. In reality, both work great. If you’re looking for a bit more polish and some more extras out of the box, though, Plex is the clear choice.

Plex is a commercial product, as opposed to an open source project like Kodi. They’ve already set up the hard parts for you. That means that you have to worry less about configuring and fine tuning your system, it’ll just work.

Plex also has wider platform support, making it a better choice when you have lots of different devices on your network that you want to stream to. Plex supports streaming devices, like Roku, and phones and tablets. You do have to pay for full Android and iOS support, though.

Plex allows you to stream outside your home network, as long as your media server is running. That’s part of what makes the Pi an excellent option for setting up a Plex server. It’s super low power, so it’s not too bad to leave it running.

Altogether, Plex makes an excellent option for setting up your home media streaming solution.

What You’ll Need

For this whole setup, you’re going to need duplicates of everything to set up a Raspberry Pi system as well as any additions you want for your media player. There’s not all that much to it, but choose your media player components like you were building any other home theater setup.

  • Raspberry Pi 2 or better x2
  • 8GB or larger MicroSD card x2
  • Raspberry Pi power cord x2
  • Ethernet cable(for initial setup)
  • A storage drive(networked or USB) for your media
  • USB Keyboard and Mouse

The Server

There isn’t a specialized Plex image for the Raspberry Pi. You’re going to need to set up the server with Raspbian. That’s alright, though, it’s actually very simple.

Flash The Image

To start, download the latest version of Raspbian Lite. You’re not going to need a desktop environment for this. It’s just a server, and you can manage it from SSH and a web interface.

Once you have you image, unzip it. Insert your first MicroSD card into your computer. You’re going to need something to write the image to the SD. Regardless of which operating system you’re using, Etcher, is a great option. Download the version for your OS.

Open up Etcher. The interface is about as easy as it gets. In the first column, locate your image. In the middle one, find your SD card. Finally, when it all looks right, use the button in the last column to write the image. Be absolutely sure that you have the right card location first. This will overwrite everything on the card.

Don’t remove your card just yet. You’re going to need to enable SSH. On your computer’s file browser, locate the “boot” partition that you just wrote to the MicroSD. Create an empty file in that directory called “ssh.” That file will tell the Raspberry Pi to enable SSH access on startup.

Put It Together

Take your SD card out of your computer and put it into the Pi. Connect the Pi directly to your network with an Ethernet cable. Then, plug in the Pi.

Wait a few minutes for the Pi to set itself up. It needs to resize its partitions and start up before you can access it. In the mean time, open a browser on your computer, and navigate to your router’s web interface. Find the interface where you can see the IP addresses of connected devices. Wait to see the Pi show up. Make note of the IP address that it has.

Open up OpenSSH. If you’re on Windows, that could be the OpenSSH app that’s built in, or it could be PuTTY. On Linux… you already know what to do. Connect up to the Pi via the IP address. The username is “pi” and the password is “raspberry.”

Set Up Wireless

Since this is a server, it’s probably a better idea to leave this wired. If you really need to use a wireless connection, you can set one up.

Start by updating the Pi. It’s always a good idea to have the latest packages.

$ sudo apt update && sudo apt upgrade

The password for “sudo” is still “raspberry.”

The Pi already comes with the WiFi tools that you need installed. You just need to set them up from the command line. Start by setting up your password and network name. There’s actually a tool for that. First, escalate your permissions to root.

$ sudo su

Next, run the tool, and direct the output in to the proper configuration file.

# wpa_passphrase “network” “passphrase” >> /etc/wpa_supplicant/wpa_supplicant.conf

WiFi Setup Pi

Open the file up. You’ll see your network name, the passphrase you entered, and the encrypted form of the password. Feel free to delete the plain text password for security reasons. Leave the encrypted one.

Drop your root privileges now.

# exit

Your Pi should automatically connect to your network now. You can check with:

$ ifconfig wlan0

If it doesn’t connect reboot the Pi, and it will connect. Remember that you’ll need to SSH back in.

$ sudo reboot

Install Plex

You’re finally ready to install Plex. The Plex server is available from an external repository. You’ll need to add it to your Pi in order to install the package and keep it updated. First, install the Debian package that allows package installs over HTTPS.

$ sudo apt install apt-transport-https

Next, download an import the repository’s GPG key.

$ wget -O - https://dev2day.de/pms/dev2day-pms.gpg.key | sudo apt-key add -

Then, add the repository. Use “nano” to create a file for your repository.

$ sudo nano /etc/apt/sources.list.d/plex.list

Plex Debian Repository

In that file, place the following line.

deb https://dev2day.de/pms/ stretch main

Save it, and exit.

You have he repository. Now, update Apt, and install the server.

$ sudo apt update
$ sudo apt install plexmediaserver-installer

The server will take a couple of minutes to install.

Configure The Server

Before you can use your server, you’re going to need to set up one thing. The Plex server runs as a user, “plex” by default. You want your “pi” user to run it.

Open up /etc/default/plexmediaserver.prev

Find the line:

PLEX_MEDIA_SERVER_USER=plex

Change it to:

PLEX_MEDIA_SERVER_USER=pi

Save, and exit. Then, reboot your Pi.

$ sudo reboot

Create An Account

You can now sign in to your server’s web interface. Open a browser, and browse to:

server-ip:32400/web

Use your server’s actual IP address there. What you’ll see when you arrive is a screen prompting you to create a Plex account or sign in. Which option you choose is entirely up to you.

Once you sign in, you’ll get a splash screen telling you a bit about Plex. Proceed to the next screen.

Next, Plex will try to sell you it’s “Plex Pass” service. It allows you to store media on their servers instead of your own. You don’t need to sign up now, so you can think about whether you want it. Just close the window if you don’t.

Plex Server Signin

Plex will then ask you to give your server a name. Pick something memorable.

It will ask you to set up a library next. You don’t need to. Save that for after you set up your hard drive. It’ll finish up by asking you to install Plex apps.

When it’s done, it’ll drop you into the home interface. This is the web interface of your server, but you can play media directly from here too.

Your Media Library

You should consider setting up your media library now. Since the server is a Raspberry Pi, you have two main options for adding a large storage device, networked storage or a USB drive. Which one you choose is entirely up to you. They’ll both work well.

USB

Connect your drive up to the Pi. Go back to your computer, and open back up that SSH connection to the Pi. Search in the /dev directory for your new drive.

$ ls /dev | grep sd

The boot drive will have multiple partitions, like sda1, sda2, sda3. The USB drive will only have one or two.

Create a folder to mount your drive on.

$ sudo mkdir /media/library

Open /etc/fstab with your text editor. After all the stuff that’s already there, add a line for your hard drive. It’ll look something like this:

/dev/sdb1 /media/library ext4 defaults,user,exec 0 0

If the drive is formatted to NTFS from use with Windows, you’ll need to specify that instead of “ext4,” and install a package for compatibility.

$ sudo apt install ntfs-3g

Mount your drive.

$ sudo mount -a

Network

If you have a networked drive, you’re going to need to install a package for compatibility first.

$ sudo apt install nfs-common

Next, make a directory to mount to.

$ sudo mkdir /media/library

Open /etc/fstab with your text editor, and add a line similar to the one below.

192.168.1.110:/your/share /media/library ext4 defaults,user,exec 0 0

Mount your drive.

$ sudo mount -a

Set Up a Library In Plex

Head back to your browser and the tab where you have Plex open. If you closed it, just go back with the IP and port number from before. On the side, click on the “Add Library” button. That’ll open up a new dialog box asking what type of library you want to add.

Select the type that you want. The screen will progress to the next step. Click the button to browse to your library location, and select it.

Once you select it, Plex will start scanning that directory for media content and adding it to your library.

External Access

One of Plex’s biggest selling points is access to your files from outside your network. You can set that up fairly easily, but you need to enable port forwarding on your router. The process for setting it up is different for every router, but there are some universal aspects. First, open your router’s web interface.

You can usually find port forwarding settings under the NAT/QoS tab of your router. Some routers may have a separate section for port forwarding. Under that section, you’ll need to set a source port, a destination port, and a destination IP. This tells the server to forward all incoming connections on that port to the specified IP address for that computer to handle the request. Save and apply your settings.

The Player

Right now, you can connect to your Plex server over the web interface. You can also install the Plex app on any variety of devices and connect. However, if you want to use a second Raspberry Pi as a dedicated Plex client, you’re going to need to set that up too.

Download The Image

There’s a dedicated Raspberry Pi image for use as a Plex client. Go and download the latest release from the project’s Github page. The file is compressed, so you’re going to need to expand it. If you’re on Linux, that’ll be easy, just use gunzip.

$ gunzip RasPlex-1.8.0.148-573b6d73-RPi2.arm.img.gz

If you’re on Windows, you can use a tool like 7-Zip.

Flash The Image

Once you have you image unpacked, insert your second SD card, and fire up Etcher again. Follow the exact same steps as last time. Pick your image. Find your MicroSD, and flash the card.

Put Your Pi Together

Just like before, plug your MicroSD card into your Raspberry Pi. Connect it up to a keyboard, mouse, and screen. Then, connect up any additional devices, like speakers, that you want to use on your media center. When everything else is in place, plug in the Pi.

Start It Up

Like before, the system will take some time to boot up. The Pi still needs to set itself up and resize its partitions. You should see a RasPlex splash screen while you’re waiting.

When the Pi is ready, it’ll walk you through a basic setup process. It’ll ask you to connect to your network, connect to your Plex account, and set up caching options. None of it is too complex.

The interface itself should feel familiar to Kodi users. OpenPHT, which RasPlex is based on, is built on top of Kodi.  You should also notice right away that your libraries that you added earlier are already available on this Raspberry Pi.  That’s all done behind the scenes with your Plex account acting as the authorization to connect to the server.  You can now watch the content from your server on RasPlex.

Closing Thoughts

Plex is a simple, yet powerful, media center solution. It enables a world of options for you to manage and experience your media both on your own network and remotely.

This configuration that you’ve set up can grow and adapt with your network. You can, and definitely should, expand your network and add additional devices to take maximum advantage of Plex and your media library.

All the YouTube Keyboard Shortcuts You Will Ever Need

Read Next 

2 thoughts on “Set Up A Plex Media Server And Player With The Raspberry Pi”

C Dreyer says:
Watch Plex online with RASPLEX. I have a plex server setup in my LAB and in the TV room RASPLEX. I can view my own libraries but can one set-up the RASPlex to also watch the Plex Live TV, Movies & Shpws and your Watchlist.
Stephen Luisi says:
Thank you for this wonderful and up-to-date rundown of how to get the most out of your plex pass.

I do have a question that I’m wondering if you could help me with?

Sadly it seems I’ve over-complicated things by installing Raspbian Stretch Desktop “for PC’s” (i386) Variant, on my Old Over Powered Desktop.

I did this with the intent to use it as a dedicated Plex Media Server/ Plex Home Theater / Plex Media Player.
The added benefit of an optional desktop experience on my largest TV/Display was attractive to me. I was also attracted to the idea of having more horse power so to speak for Plex Trans-coding and Library Scanning. This was all well and fine for the server side of things and after-all I did intend to have RasPlex Running on an actual Pi3b+ for the Media Player side of things on my upstairs TV.

I was successful in setting up Raspbian and getting Plex Media Server to install and run, though it was not as straight-forward. Oddly enough; It would have been less difficult to fallow along with most online tutorials had I just used a less obscure OS version like (Raspbian Stretch for Pi.)

My real question is; How can I install the immersive Plex Home Theater app (that with a feel similar to RasPlex) onto my Raspbian Stretch for PC (i386) Desktop? I would prefer the simplicity and aesthetics of the Plex App, over viewing the media from within the chromium browser. I have downloaded the Plex images for embedded i386 and practically every other image or deb available. i just haven’t figured out how to run the immersive app over Raspbian (debian).

Because I use do utilize Plex Cloud and can access most things from there, running the server side at the same time as the app is not a requirement of mine. Though it would be nice to eliminate the network utilization.

Your help would be most appreciated & Thank You again for your time.

Leave a Reply

Your email address will not be published. Required fields are marked *


Adam

Jun 1, 2018

643 Articles Published

More