Home Media Server using Raspberry Pi & Plex
A comprehensive step by step guide, covering everything you need to know to install, run and maintain Plex Media Server running on a Raspberry Pi shared across your network.
Plex is a powerful media server which make your videos, music and photos accessible on all your favourite devices; Web, Android, iOS, Windows, Xbox, Chromecast, Smart TVs and more.
Plex indexes all you Movies, TV shows and Music, gathers beautiful posters and artwork, cast and crew info, Rotten Tomatoes ratings, and provides a nice clean interface where all your media can live and come alive.
Plex needs a running server instance on a machine locally on your network. Raspberry Pi can be a perfect in-expensive solution for an always on, low energy media server. Raspberry Pi is a tiny and inexpensive (~50$) computer.
An external Hard Drive with external power is needed as well to hold all your files. Raspberry Pi is not powerful enough to power the external hard drive, thus external power source is needed. In the following steps I’ll go through setting up a Plex Media Server on a Raspberry Pi (RPi 3 is the latest and fastest model with a 1.2Ghz cpu and 1Gb ram) with a 1TB 3.5 HDD in an enclosure and USB interface on a micro SD card.
b. Preparing your Raspberry Pi
c. Static IP for the Raspberry Pi
d. SSH-ing the Pi
e. Installing Plex Media Server
f. Preparing the disk storage
g. Setting up Plex
h. Keeping the server up & running autonomously
i. Monitoring your Pi
j. Updating Plex Media Server
k. Raspberry Pi as a client
- Raspberry Pi 3
- Raspberry Pi power adapter
- 8GB (or greater) micro SD Card class 10 (or faster) (and a card reader, duh)
- Router with internet & ethernet port
- Network cable
- Monitor with an HDMI connection, USB Keyboard and USB mouse (temporarily for the initial setup)
- External USB Hard Drive (the bigger the better) with an external power source
- Cable tie
- Can-do attitude!
Preparing your Raspberry Pi
To start we need to prepare the OS on the SD Card, setup the hardware and connect everything for initial setup.
IMPORTANT NOTE: from now on any terminal commands in block with “<…>” as value, means that you must remove the “<>” and the value inside is variable depending on your setup or information gathered in a previous step.
- First download Raspbian, an OS based on Debian optimized for RPi hardware. Download the image from: https://www.raspberrypi.org/downloads/noobs/ (use full not lite)
2. Format the micro SD Card (use FAT32 file system)
3. Install Raspbian image on the SD Card using NOOBS installer. Follow the official guide: https://www.raspberrypi.org/help/noobs-setup/
4. Insert the micro SD card into the RPi and attach the keyboard, mouse, monitor and network cables. Finally attach the power cable and turn on the power to start your RPi.
5. Once the RPi go to Menu > Preferences > Raspberry Pi Configuration
6. In the following setting screen change the following:
i. Turn ‘Auto Login’ on
ii. Boot is set to CLI/Terminal
iii. Change pi user password
iv. Change your hostname, like ‘plex-media-server’
v. Performance — GPU Memory is set to 16 (lowest possible)
vi. Set Locale as en(english) | US(USA) | UTF-8
vii. Set your Timezone
Finally click OK and you will be prompted to restart your RPi. Choose Yes.
Static IP for the Raspberry Pi
Home routers are commonly DHCP meaning that they will assign an IP randomly from an available set to each connected device. This can make things difficult if we need to login remotely (ssh) on our RPi. Thus, we need to set a static/fixed ip.
There are two ways to go about this, either setup the router to reserve an IP by the device MAC address or edit the network interface in the RPi to have a fixed ip. We’ll do the latter.
Our RPi should be in command line mode (if not restart device to command line). Lets take note of the current IP:
From the list given take note of the eth0 settings: (yours will be different, note the second line)
will translate to :
Current IP Address = 192.168.0.104
Broadcast Range = 192.168.0.255
Subnet Mask = 255.255.255.0
Now we need to get information about the router:
sudo route -n
We need to take note of the Destination IP and the Gateway IP
Gateway = 192.168.0.10
Destination = 192.168.0.0
Edit the network interfaces file
sudo nano /etc/network/interfaces
Edit the file which we just opened, first we need to update an existing line. Look for the following line:
iface eth0 inet manual
iface etho inet dhcp
We need to change this to:
iface eth0 inet static
Than, under that line we need to add the following with the values you noted down before
address <your IP address>
netmask <your subnet mask>
network <your destination>
broadcast <your broadcast range>
gateway <your gateway>
Finally save the file (CTRL + X , press Y and Enter)
Now we need to restart the RPi for to get the fixed ip.
“SSH, also known as Secure Socket Shell, is a network protocol that provides administrators with a secure way to access a remote computer.” ~ the internetz
SSH allows us to login in on our RPi OS remotely from another computer. This is helpful & useful! We can tuck away the RPi in a dark corner next to the router and access it remotely from the PC/MAC we already have at home. Think of it as Windows Remote Desktop, minus the desktop part. As of the November 2016 release, Raspbian has SSH disabled by default (for security reasons). We will have to enable it manually. This is done using raspi-config (command line control panel)
Open the RPi control panel from command line:
Select the option:
Then navigate to
Press Enter and select
Enable or disable ssh server
Store away the RPi in a cool dry place where it can run ad aeternum till the end of the world. I placed mine next to the router and attached to the eternal hard drive.
RPi only needs power cable, network cable and of course the external hard drive where we will be storing all of our media. Turn your RPi on again.
(Note: if you are on Windows, download PuTTY so we can SSH to our RPi)
In Terminal (or PuTTY) ssh to the RPi
(Where the IP address is the one we noted before.) If you are prompted with an ‘authenticity cannot be established’ message continue anyway by typing ‘yes’ (first time only). Login by entering your pi password and you should be in!
(note, if you didn’t update the pi password, by default it should be ‘raspberry’)
The rest of the step by step guide is in the PDF below.
Not convinced yet? See the result below!
After 1 year running now, the RPi never failed and worked flawlessly providing many devices (Rasplex on another RPi attached to TV, Xbox One, Fire Stick, mobile phones & laptops) with movies and tv shows.
Some things to note: If you are copying files on the external drive via network or Plex is busy indexing and getting metadata for the new media added, I highly recommend letting the process finish first before streaming/watching anything. Failure to do so might result in the RPi freezing.
Regarding streaming to multiple devices at the same time, I tested for 10 minutes playing two different videos to two different devices. Quality was set at 3Mbps 720p. Video quality was good & remained constant and never stopped waiting for any buffer. CPU usage varied, sometimes using 20% sometimes 100%. Memory was used in full. Results below:
I’m getting ‘Permission denied’ when I run commands.
You need more rights to run this command. Add ‘sudo’ infornt of your command, if this doesn’t work you can switch to root user with:
I’m getting a ‘cannot set LC_TYPE to default locale’ message when installing packages.
edit the bashrc:
sudo nano ~./bashrc
at the end of the file add
save the file (CTRL + X , press Y and Enter), than run
test if works