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.
Contents
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
- Raspberry Pi 3 Kit
- 8GB microSD Card for Raspberry Pi OS
- Storage for media files (the bigger the better)
- External HDD (recommended)
- Traditional NAS
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:
1 2 |
sudo apt-get update sudo apt-get upgrade |
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, remove Dev2Day’s unofficial plexmediaserver package if installed, otherwise scroll down to step 2b.
2a. Uninstall the unofficial Dev2Day plexmediaserver package (if installed)
We will remove the unofficial plexmediaserver client if it was installed previously on our Raspberry Pi. The migration is simple and your Plex library will be preserved.
First, remove the dev2day.de package by typing this in a terminal:
1 |
sudo apt-get remove plexmediaserver-installer |
Then, remove the dev2day.de repo, e.g. with:
1 |
sudo rm /etc/apt/sources.list.d/pms.list |
Now, download and install the Debian ARMv7 package from plex.tv here . Save the .deb file to your Raspberry Pi’s Desktop or somewhere you can easily find it.
In a terminal, navigate to the .deb file you just downloaded (eg. your Desktop) and install it. The name of your .deb file will be different depending on when you downloaded it. Press the TAB button to autocomplete the name. The following is an example of what you would type in the terminal:
1 2 |
cd ~/Desktop sudo dpkg -i plexmediaserver_1.15.2.793-782228f99_armhf.deb |
If a message pops up asking if you want to overwrite your configuration files type ‘Y‘ to replace them after you’ve viewed the differences.
2b. Install the official plexmediaserver package
To enable the Plex Media Server repository on your Raspberry Pi only a few terminal commands are required. From a terminal window run the following two commands:
1 |
echo deb https://downloads.plex.tv/repo/deb public main | sudo tee /etc/apt/sources.list.d/plexmediaserver.list |
1 |
curl https://downloads.plex.tv/plex-keys/PlexSign.key | sudo apt-key add - |
After that, it’s just a matter of running the normal sudo apt-get update
and the Plex Media Server repo will be enabled on the OS.
Note: If the above doesn’t do the trick you’ll have to manually install plexmediaserver.
Download and install the Debian ARMv7 package from plex.tv here . Save the .deb file to your Raspberry Pi’s Desktop or somewhere you can easily find it.
In a terminal, navigate to the .deb file you just downloaded (eg. your Desktop) and install it. The name of your .deb file will be different depending on when you downloaded it. Press the TAB button to autocomplete the name. The following is an example of what you would type in the terminal:
1 2 |
cd ~/Desktop sudo dpkg -i plexmediaserver_1.15.2.793-782228f99_armhf.deb |
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:
1 |
ifconfig |
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.
1 |
route -n |
Note the IP address under gateway. This is our routers address.
In the terminal, type:
1 |
sudo nano /etc/dhcpcd.conf |
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):
1 2 3 4 |
interface eth0 static ip_address=192.168.0.106 static routers=192.168.0.10 static domain_name_servers=8.8.8.8 |
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)
1 2 3 4 |
cd /home/pi sudo mkdir DRIVE cd DRIVE sudo mkdir share |
Now mount your drive to the directory you just created:
1 |
sudo mount -t cifs -o username=yourusername,password=yourpassword //NIGHTHAWK/S_Drive /DRIVE/share |
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
1 2 |
cd /home/pi/DRIVE/share ls |
If your see your files there, it worked.
To do this, we need to edit the /etc/fstab file, Run the following command to edit the /etc/fstab file:
1 |
sudo nano /etc/fstab |
User your arrow keys to navigate to the bottom of the file and add this (change as appropriate):
1 |
//DISK/share /home/pi/NIGHTHAWK/share cifs username=yourusername,password=yourpassword 0 0 |
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):
1 |
http://192.168.0.106:32400/web |
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!