Categories
Uncategorized

Installing Plex on a Raspberry Pi is Simple

If you’re looking to install Plex on a Raspberry Pi, this is the ultimate guide. I’ll show you how to install Plex easily, mount an external drive to store all of your data, and set up Plex so that you can easily watch files on any device.

Fox took Family Guy off of Netflix, but we had been watching it for years on Netflix. We don’t want to pay for a Hulu subscription (it has ads!), and don’t have a DVD player anymore. Plex to the rescue!

Installing Plex on a Raspberry Pi is Simple
Installing Plex on a Raspberry Pi is Simple

I’ve had a love affair with the Raspberry Pi, so I’ve got a few around the house. I also went through a “back all your data up… twice!” phase in my house, so I have a huge WD hard drive laying around doing nothing.

The perfect combination.

To get a Plex server up and running on a Raspberry Pi, you need some essential equipment:

  • A Raspberry Pi 3. I always get this Raspberry Pi starter kit from Amazon since it comes with an SD card, power cable, heat sink and enclosure. And can be at my house in 2 days.
  • A big external drive. While this is optional, I used a WD MyBook DUO since it has USB ports on the back. I use these USB ports to power the Raspberry Pi so that I don’t take up all of the electrical outlets in my office. But, any hard drive will do. Here’s a 4TB hard drive for less than $100, which is probably more than enough space.

Now, let’s get Plex on it. First, update Raspbian.

sudo apt-get update
sudo apt-get upgrade

Install the HTTPS transport package

sudo apt-get install apt-transport-https

Plex comes in a new repo, called Dev2Day. To get it, we need to add a key:

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

Now, we need to add the repo to our list of package sources:

echo "deb https://dev2day.de/pms/ jessie main" | sudo tee /etc/apt/sources.list.d/pms.list

Finally, update the package list:

sudo apt-get update

Now, install Plex:

sudo apt-get install -t jessie plexmediaserver

Set Plex to run as the pi user:

sudo vi /etc/default/plexmediaserver.prev

In that file, change PLEX_MEDIA_SERVER_USER=plex to PLEX_MEDIA_SERVER_USER=pi and save.

Restart Plex:

sudo service plexmediaserver restart

Now we need to mount the external drive permanently so that it’s available every time you restart your Pi.

To start, install exfat fuse:

sudo apt-get install exfat-fuse

Plug your external drive into your Pi and get it’s stats:

sudo lsblk -o UUID,NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL,MODEL

Take note of:

  • the location of the disk partition. This is typically something like /dev/sda1.
  • the fstype. This is typically something like fat, exfat, ntfs or ext4.

Create a target folder to mount your drive to.

mkdir /mnt/media

Mount the drive, replacing /dev/sda1 with the location of the drive you want to mount:

sudo mount /dev/sda1 /mnt/media

Verify that you see the files:

ls /mnt/media

Assuming you see the files you expect to see, let’s mount this drive permanently. Open fstab.

sudo vi /etc/fstab

Add a new line

/dev/sda2 /mnt/media exfat defaults 0 0

Replace /dev/sda2 with the location of the drive you want to mount, /mnt/media with the mount point, and exfat with the fsystem on the drive.

This out your mounting by rebooting your machine.

sudo reboot now

If it comes back up, you’re golden. If not, you probably messed up your fstab. Here’s how to fix your fstab.

Install Samba. This lets you run your Plex in a closet, but add files to it from another computer.

sudo apt-get install samba samba-common-bin

Configure Samba to share your media directory. Open the Samba config file:

sudo vi /etc/samba/smb.conf

Scroll down to the very bottom of the file and add this:

[Plex Media]
Comment = Plex media folder
Path = /mnt/media
Browseable = yes
Writeable = Yes
only guest = no
create mask = 0777
directory mask = 0777
Public = yes
Guest ok = yes

Be sure to replace /mnt/media with your media mount point.

Restart Samba:

sudo /etc/init.d/samba restart

Now, we need to create some folders that will make Plex easier to use.

In your terminal, create a folder for TV shows:

mkdir /mnt/media/TV

And create a folder for Movies:

mkdir /mnt/media/Movies

Now, add your media files to the appropriate folders.

If you’re on a Mac, you should see your pi appear as a shared drive in your Finder. You can also connect directly to it by going to Go->Connect to Server, and typing in smb://raspberrypi.local

Once you have your movies and TV shows copied over, we can set up Plex!

In your browser, go to http://raspberry.local:32400/web. If that doesn’t work, replace raspberrypi.local with the Pi’s IP address.

This will bring you to the Plex web app. Create an account (or sign in if you already have a Plex account). Plex will give you a quick guided tour, then will give you the chance to “Add to Library”.

Select the media type and the folder that contains that content. Plex will index these files for a few minutes, then organize it for you.

That’s it! You can connect to your Plex via web browser, or any of the dedicated clients on iPhone, Android, Roku or the Amazon Fire TV.