I don’t often yack about this kind of stuff on my blog as it’s pretty much exclusively an art blog, but I recently bought a Raspberry Pi B+ that I thought I could use as a lower powered Plex Media Server rather than having my (dying) iMac run constantly. This is both in an attempt to prolong the life of my iMac and to help my incredibly high electric bill (whoops). While there are lots and lots of tutorials on how to set up Plex Media Server on a Raspberry Pi B+, I couldn’t find one that went through all of the steps I needed. So I’m going to compile them all here!
What you’ll need:
- Raspberry Pi B+ (Amazon.com has CanaKits for around $55)
- External USB Storage
- Wall-powered USB Hub (The Raspberry Pi does not have enough power to power USB storage devices on its own most of the time. If your Pi is running slowly or your server is having weird issues, if you’re not on a hub, this might fix your problem)
- Ethernet connection (You can connect via wi-fi, but your fastest connection will occur via ethernet)
- Class 10 SD Card (You can use a different class SD card, but class 10 is the fastest and you want to give your server a good running start)
- Mac or PC to pre-load the Raspbian operating system
- Wired keyboard and mouse for easiest access (The Pi comes with Bluetooth but it’s just easier with a wired keyboard and mouse)
Note: Raspberry Pi, even the B+ model, doesn’t have an incredible amount of a. RAM (1 GB) and b. processing power. Transcoding via Plex Media Server might be difficult or impossible (read: lots of buffering). If you want to share the server with a lot of people, I would suggest not using a Raspberry Pi.
Setting up your Pi out of the box
In this section I’m going to talk about how to set up your Raspberry Pi through Mac OS X. Since this is the only experience I have, I can’t tell you how to set it up via PC, but there are plenty of tutorials online that can show you how to do this. There are also instructions available on the official site.
What I used:
- 64 GB SanDisk Class 10 Micro SD Card
- SD Card Adapter
- Disk Utility
- Raspbian Stretch Package (Available for download here)
Go ahead and go to the Raspberry Pi website and download your choice of operating system. If you are totally new to using Terminal or otherwise, you might choose to go the NOOBS route, which is totally fine. I’ll tell you how to set up your Raspberry Pi by downloading the Raspbian Stretch with Desktop. The download is about 1.7 GB so think of this a little bit of pre-work.
While you’re waiting for that to download, now would be a good time to format your SD card. Put it in the adapter and insert it into your computer. Open Disk Utility, click on the SD card nested under External, and click “Erase”.
Note: Raspberry Pi does not support exFAT systems, nor Mac OS Extended (Journaled) aka HFS+… At least not in terms of an internal storage device. For that reason, you’re going to want to erase the system as FAT (MS-DOS). What you want is for it to format to FAT32. If you’re using an old SD card and you erase the SD card using disk utility, and it says it’s FAT16, chances are your SD card is too old to support FAT32.
Set it to erase as MS-DOS (FAT).
Here you might run into some issues like I did. I kept getting all kinds of errors trying to reformat the card. I can’t remember the exact errors, but it kept failing an erase. If this happens to you, unmount the SD card and pull out the adapter. Look at your adapter. Is there a little switch on the side? You may need to flip the switch. In my case, I had to flip the switch 75% of the way before it allowed me to reformat the card successfully. In other cases you may have to flip the switch and click erase twice… Disk Utility is finicky like that.
Before you’ve finished with Disk Utility, use it to find out where your SD card is located. It should be listed under “device” i.e. disk0s2, or disk1s2. It’s going to be “disk0” or “disk1”, minus the s2 part. Unmount your SD card, but don’t remove it physically from your machine.
Once you have your SD card formatted and your Raspbian Stretch with Desktop downloaded, go ahead and find your download… Probably in your downloads folder. Unpack the zip so you have a .img instead.
Crack open Terminal.
Figure out where you are by typing
Basically you’re going to need to figure out the path to the Raspbian img. In my case it’s in my downloads folder, so I’m going to type
From here I could type
ls and make sure that the Raspbian img is in there, but I know it is, so I’m going to go ahead and copy it now. In the terminal I am going to type:
sudo dd bs=1m if=raspbianfilename.img of=/dev/rdiskn conv=sync
Remember the device path I had you look for before? Make sure that you change the “n” after “rdisk” to the number you found before. Let’s say mine was disk1, so I’m going to change the path to “/dev/rdisk1”
Let that run! Once it’s complete, it’s going to bounce you back to your command line. Once that’s finished, congrats, you’ve just installed the Raspbian OS onto an SD card!
Now go ahead and take out your SD card and put it into your (assembled) Raspberry Pi. Get your Pi plugged into where it’s going to live (or you’re going to be using a monitor) and strap in ’cause we’re going to do some other cool things too.
Once you plug in the power cord your Pi will turn on, so connect that last. There’s no power button or switch on the Pi at this time unfortunately.
Switch your language settings
This may or may not affect you but the default language for the keyboard setup for your Pi is Great Britain. If you’re in the US using a US keyboard, you’re going to want to change that. Go ahead and open up the terminal on your Raspberry Pi and type:
Scroll down to
localisation options and set your language, keyboard layout, and time code preferences. You should be able to move around using the up and down arrow keys on your keyboard. Pressing the right arrow key will bring you to the select and finish buttons.
Let’s get cracking on that Plex Media Server!
There are options here, but I got stuck somewhere in the middle, so let me explain how I did it.
The first thing you’re going to want to do is to update your Pi and make sure it’s got all the packages it needs. Run:
sudo apt-get update
sudo apt-get upgrade
This might take a bit. Go get a snack! Once that’s done, we’re going to want to check some things. Run:
sudo apt-get install apt-transport-https
If you already have this installed, it’ll tell you, but you need it so run it anyway just in case.
Next up is grabbing the repository that contains Plex:
wget -O - https://dev2day.de/pms/dev2day-pms.gpg.key | sudo apt-key add -
(That’s a capital O, not a zero or a lowercase o)
Now add it to the package list:
echo "deb https://dev2day.de/pms/ jessie main" | sudo tee /etc/apt/sources.list.d/pms.list
And update it:
sudo apt-get update
Time to download Plex Media Server! Run:
sudo apt-get install -t jessie plexmediaserver
And then hit
y to say yeah, you do want to download it! Let that crunch through and when it’s done, we have to make some changes.
Plex runs on its own user by default, so we’re going to change it to run under our user… the default one, aka pi. Type:
sudo nano /etc/default/plexmediaserver.prev
Note: you can also use vim but I prefer nano.
You should see a bunch of configuration files come up. Scroll down until you find
PLEX_MEDIA_SERVER_USER=plex. Change “plex” to “pi”, and then control X to exit out, y to save, and enter to save as the current document. Once you’ve done that, go ahead and restart the Plex Media Server by running:
sudo service plexmediaserver restart
Set a static IP
Next you’re going to want to set a static IP address for your Pi Plex server. Run this:
It will give you your current IP address. Copy it down (or remember it).
sudo nano /boot/cmdline.txt
Go to the end and add
ip= then your IP. Control X to save, y, and then enter to overwrite. Great! Let’s restart your Pi to make sure everything is in effect.
Making sure Raspbian can read your USB drive(s)
Now I know you’re excited to get in and start customizing your Plex Media Server, but there’s a few things that can hinder that. First, you have to make sure that your Pi can at the very least read your hard drive(s). The first thing you’ll want to do is make sure that you have support for your drive format.
For HFS+ run:
sudo apt-get install hfsplus hfsutils hfsprogs
For exFAT run:
sudo apt-get install exfat-fuse exfat-utils
For NTFS run:
sudo apt-get install ntfs-3g
Personally, since all of my drives were formatted by Mac OS X, they were all HFS+, so I really only needed the HFS+ extensions.
Now, this is important. You’re going to want to make sure that your Raspberry Pi, now that it can recognize your disk file system, can actually read the contents in your disk. This is called permissions. Go ahead and run:
sudo chmod -R 777 /media/pi/
And possibly even further down with:
sudo chmod -R 777 /media/pi/drivename/
Great! Now let’s access your Plex Media Server and start adding some stuff.
Remember your IP address from before? Open up Chromium and type that in, followed by
:32400/web and hit enter. Now you should be able to start setting up and customizing your Raspberry Pi Plex Media Server!
Other Mac OS X Goodies
Another part of my set up I wanted was to be able to drop files into my Raspberry Pi over the network. In order to do this, I needed to install:
sudo apt-get install netatalk
Once this is done installing, you should be able to access your Raspberry Pi using your username and password (defaults are username
raspberry, definitely change that) using the Finder on the left sidebar under Shared… Click on All.
You might want to share other directories too other than just the Pi’s home directory, just edit this file:
sudo nano /etc/netatalk/AppleVolumes.default
~/ “Home Directory” add the path to the directory you’d like to also share. Some people set up mount points for their external media, and they may want to share
/mnt/media, for example.
Last thing I wanted was to be able to check up on the Pi without a dedicated monitor. How can I do that? Screen sharing of course! For that, you’ll just need to follow this easy-to-follow tutorial.
Congrats! Have fun playing with your new Raspberry Pi Plex Server!