Raspberry Pi and Plex: how to turn a single-board computer into a media server
The freemium software Plex offers one of the best solutions for managing your media collection. The cornerstone of this success is based on two main components: the Plex Media Server application, which brings together all kinds of audio-visual media files in a single library, and the Plex Media Player, which allows you to call on and stream those files. The latter is now available for a diverse array of devices, like the games consoles Xbox One and PS4, Android and iOS smartphones, as well as TV boxes like Apple TV. The server application runs on Windows, macOS or Linux, which is why you can use a Raspberry Pi to host it.
- What is a Raspberry Pi Plex server?
- What are the requirements for a Raspberry Pi Plex server?
- Tutorial: how to set up a Raspberry Pi Plex media server
- Step 1: update Raspbian to the latest version
- Step 2: enable HTTPS transfer during downloads
- Step 3: add the dev2day repository as a package source
- Step 4: install the Plex Media Server
- Step 5: change server users
- Step 6: set static IP address for the Raspberry Pi
- Step 7: Add files to the Plex library
- Step 8: Connect to the Raspberry Pi Plex Center
What is a Raspberry Pi Plex server?
A Raspberry Pi Plex server is a media server running on a Raspberry Pi computer, using the freemium Plex Media Server application. As such, it’s used to centrally organize multimedia such as photos, videos, and music, which are accessible to multiple users and devices within a private network. There are various client apps for this purpose (e.g. for iOS, Android, Amazon Fire TV, Xbox One, NVIDIA SHIELD, and PS4), which allow remote access to the server. Alternatively, the Raspberry Pi Plex media server can be controlled via devices that support the DLNA (Digital Living Network Alliance) when the appropriate function is activated, even without an extra application.
Plex also transcodes files in real-time to allow devices to play content in unknown formats.
What are the requirements for a Raspberry Pi Plex server?
To use Raspberry Pi as a Plex server you require a Raspberry Pi, but more specifically, a newer model – Raspberry Pi 2 or 3. This is important to make sure you have enough processing power and memory to run the media server. Both versions have an Ethernet port, which is essential for connecting a media center to a network. The Raspberry Pi 3 also features an integrated WiFi module, making it perfect for setting up a wireless streaming platform. In addition, a microSD card (at least eight gigabytes) is necessary to ensure you have enough storage space for the operating system and Plex Media Server.
To set up the system and server, you should also have a USB mouse, a keyboard, and a monitor. To complete the hardware setup, you need a USB storage device or external hard drive of your choice to store various multimedia files appropriately. As for the software, you will need to install one of the operating systems mentioned previously on your Raspberry Pi Plex server. Our recommended solution is the official Pi standard system, Raspbian – a spin-off of the Linux derivative Debian.
DIY enthusiasts can of course also use headless mode to control the computer via SSH remote access in order to install the Raspberry Pi Plex media server. In this case, no additional user hardware is needed (mouse, keyboard, and monitor).
Tutorial: how to set up a Raspberry Pi Plex media server
Once you have all the necessary components for a media server, start the installation by creating the bootable SD card. For this, you’ll need another computer with an SD slot, either integrated or external. Download the Raspbian image from the Raspberry Pi Foundation website, unzip the file, and write it to your SD card with your preferred image software (Win32DiskImager, Etcher, SD Formatter, etc.). Then use the SD to boot your Raspberry Pi and install Raspbian. See a more detailed description of each step in the video below:
Once Raspbian is installed and the first boot attempt is successful, the following steps must be taken to set up your Raspberry Pi Plex server.
Step 1: update Raspbian to the latest version
Even though it’s highly likely that you downloaded the most recent version of the Raspberry Pi distribution, it’s worth double checking. The newest version will ensure the latest features and that you will be protected against security vulnerabilities of the system components. The maximum level of security is crucial for the smooth running of your Raspberry Pi Plex, especially when connected to the internet. It’s quick and easy to check which version you’re running: simply open the command line of Raspbian (LXTerminal) and enter the following commands:
sudo apt-get update sudo apt-get upgrade
Step 2: enable HTTPS transfer during downloads
The Plex installation file for devices with ARM architecture is obtained from the dev2day repository, which is only available via HTTPS. The apt-transport-https package must be installed so that Raspbian’s package manager can also access these HTTPS sources. This should already be in place with newer versions of the operating system, but you can play it safe with a simple terminal command:
sudo apt-get install apt-transport-https
Step 3: add the dev2day repository as a package source
To enter the dev2day directory as a source in the sources.list file, you will first need a crypt O key, which is required for access. You can add it to your keychain with the following double command:
wget -O - https://dev2day.de/pms/dev2day-pms.gpg.key | sudo apt-key add
Then, add the repository to the sources list:
echo "deb https://dev2day.de/pms/ stretch main" | sudo tee /etc/apt/sources.list.d/pms.list
Finally, confirm the changes by updating the package list:
sudo apt-get update
If you receive the error message “/usr/lib/apt/methodes/https could not be found,” it means the apt-transport-https package was not correctly installed. If this case, repeat the installation procedure in step 2.
Step 4: install the Plex Media Server
Now you can install the Plex Server on your Raspberry Pi. To do this, simply start the Plex Media Server Installer with this command:
apt-get install plexmediaserver-installer
Step 5: change server users
To avoid authorization issues when configuring the Raspberry Pi Plex server, you need to exchange the default user profile with an administrator profile of your choice. To do this, use the default text editor nano to open the configuration file of the Plex Media Server. Here is the relevant command:
sudo nano /etc/default/plexmediaserver
Look for the entry “PLEX_MEDIA_SERVER_USER=plex” and replace “plex” (after the equals sign) with the username of the desired account.
Close the editor, and don’t forget to save your changes. After restarting the Raspberry Pi Plex server instance, the new user settings will be active:
sudo service plexmediaserver restart
Step 6: set static IP address for the Raspberry Pi
So that it’s as easy as possible to find the patched Raspberry Pi Plex server in the defined network, it’s sensible to assign a fixed IP address for the computer. If access is going to be made via the web interface, it makes sense that the network address should be known in advance, so that a query doesn’t have to be sent to the Raspberry Pi each time. Turning your current IP address into the fixed IP is the easiest way to do this. To discover your current IP, type the following command in the Rapsbian terminal:
Make a note of the address that’s displayed – you’ll need to type it into the command line of the configuration file in the next step. To do this, open the cmdline.txt file with the nano editor:
sudo nano /boot/cmdline.txt
Navigate to the end of the text document and insert a new line: “ip=IP address” (without parentheses), replacing “IP address” with the address you previously noted. Save and close the text file before restarting the Raspberry Pi with the sudo reboot command.
Step 7: Add files to the Plex library
Now that the Raspberry Pi Plex server is up and running, you can connect the computer to the external storage device that contains your media content. You can then launch the web-based user interface of your media server via the browser by entering your IP address followed by “:32400/web/”. It should look like this:
Plex Media Server transmits via TCP port 32400. If there are any issues connecting with the client, it may be that this port is blocked by a firewall in your network, such as the router’s firewall. In this case, simply open the port in the firewall and re-connect.
Next, create a new account or log in with either a Facebook or Google account. Once logged in, you can customize your Raspberry Pi Plex media server to suit your needs and prepare all your image, music, and video files for streaming over the network. To do this, click “Add Library” and specify the type of media and the directory in which the respective files are located.
The Raspberry Pi Plex server then synchronizes each individual media file and automatically adds useful metadata, such as cover pictures and short descriptions, as long it can find the relevant information on the internet.
Step 8: Connect to the Raspberry Pi Plex Center
As long as you have synchronized some photos, videos, or songs with the Plex Server, you can begin streaming. First, though, you should allow remote access to your new media server (found in the settings). Navigate to the “Server” menu tab, select “Remote Access.” Click “Enable Remote Access”, then wait a moment for the Raspberry Pi Plex server to apply the change.
Finally, download the Plex app for your preferred device from the relevant store and log in to your account. The Plex client will then present you with your library (as seen in step 7), which you can browse to your heart’s content using the search function, and course play all your media content. For an overview of available apps, see the Plex website.