Mastering Raspberry Pi Plex Server Setup: Your Ultimate Guide to Seamless Media Streaming

Mastering Raspberry Pi Plex Server Setup: Your Ultimate Guide to Seamless Media Streaming

May 9, 2024

0510.jpg__PID:7a17bb30-ff44-4e31-9036-14b51c0aba2c

Plex is a media server software that allows you to organize and stream your media files like movies, TV shows, music, and photos to various devices such as smart TVs, computers, tablets, and smartphones.

It provides a user-friendly interface for accessing and playing your media library, complete with metadata like cover art, descriptions, and ratings.

Features

Media Organization

Plex automatically organizes your media files, downloads metadata (like movie posters, plot summaries, etc.), and provides a clean interface for browsing.

Streaming and Transcoding

Plex can stream media to various devices, transcoding on-the-fly if needed to ensure compatibility and smooth playback across different platforms.

Remote Access

With a Plex Pass subscription or a one-time purchase, you can enable remote access to your Plex server, allowing you to stream your media library outside your home network.

Offline Sync

Plex offers offline sync capabilities, allowing you to download media to your mobile devices for offline playback.

User Management

Create multiple user profiles with personalized watch histories, recommendations, and parental controls.

Plugins and Add-ons

Plex supports plugins and add-ons for additional functionality such as subtitles, trailers, music lyrics, and more.

Automatic Updates

Plex Media Server on Raspberry Pi can be set to automatically update to the latest version, ensuring you have access to new features and improvements.

Setting up a Raspberry Pi Plex Media Server can be a great way to create your DIY media center enabling you to store, manage, and stream your media content to various devices within your home network or even remotely with the right setup

Install

Installing Raspberry Pi Plex Media Server can be done using various methods such as using a script, Docker, or repositories.

图片2.png__PID:ffca575a-a2a5-414b-921c-d26602e90d82

What You Need:

  • Raspberry Pi (4, or newer) with Raspberry Pi OS
  • MicroSD card (8GB or larger, class 10 recommended)
  • Power supply
  • Ethernet cable or Wi-Fi dongle (for network connectivity)
  • External storage (USB drive or hard disk) for storing media files

Prepare Your Raspberry Pi:

√ Install Raspberry Pi OS and make sure your Raspberry Pi is connected to the internet.

√ Update your system:
sudo apt update
sudo apt upgrade


√ Setting a Static IP Address for your Raspberry Pi Plex Media Server. For that, you can see Complete Guide to Setting a Static IP on Raspberry Pi: Enhance Network Stability and Access

Setup Raspberry Pi Plex Media Server with Docker

We can still set up Plex Media Server on your Raspberry Pi by using a community-built version or by running it in a Docker container.

1.Install Docker (if you already no installed)

curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh


1.Install Docker Compose (if you already no installed)

sudo apt install docker-compose

2.Create a Docker Compose File:

Create a directory for your Plex configuration files and create a docker-compose.yml

mkdir ~/plex
cd ~/plex
nano docker-compose.yml


file inside it:

Add Plex Service to Docker Compose File:

version: '3'
     services:
       plex:
        image:ghcr.io/linuxserver/plex
        container_name: plex         
        environment:
           - PUID=1000
           - PGID=1000
           - VERSION=docker
         volumes:
           - ~/plex/config:/config
           - ~/plex/data:/data
           ~/plex/transcode:/transcode
         ports:
           - "32400:32400"
           - "3005:3005"
           - "8324:8324"
           - "32469:32469"
           - "1900:1900/udp"
           - "32410:32410/udp"
           - "32412:32412/udp"
           - "32413:32413/udp"
           - "32414:32414/udp"
         restart: unless-stopped

Inside the docker-compose.yml file, add the following configuration for Plex:

3.Start Plex Container:

docker-compose up -d

Save the docker-compose.yml file and start the Plex container using Docker Compose:

4.Access Plex Web Interface:

Once the container is running, you can access the Plex web interface by opening a web browser and navigating to http://<raspberry_pi_ip_address>:32400/web.

Raspberry Pi Plex Media Server with Repositories

Installing Plex Media Server with repositories on a Raspberry Pi involves a few steps. 

1.Install Plex Media Server

sudo apt install apt-transport-https curl
sudo nano /etc/apt/sources.list.d/plexmediaserver.list


Add the Plex repository

Add the following line to the file and save it:

2.Import the Plex GPG key to verify the packages:

3.Update the package list again to include the Plex repository:

curlhttps://downloads.plex.tv/plex-keys/PlexSign.key | sudo apt-key add -
sudo apt update
sudo apt install plexmediaserver


4.Finally, install Plex Media Server:

图片3.png__PID:15fa2ff7-a22a-4d1c-8f03-6f753ad11f5d

After installation, Plex Media Server on Raspberry Pi should start automatically. You can access the Plex web interface by opening a web browser and navigating to http://<raspberry_pi_ip_address>:32400/web

Raspberry Pi Plex Media Server with Script

Plex doesn’t have an official build for Raspberry Pi, but there are community-built versions available. One popular version is Plex Media Server for Raspberry Pi by “mrpjevans” on GitHub.

1.Install Plex Media Server:

Follow the commands in the install_plex.sh listing to add Plex’s repository, update, and then install and configure Plex. Once complete, we can check Plex is running using this command:

sudo systemctl status plexmediaserver

2.Configure Plex Media Server:

Once Plex is installed, you can access its web interface by opening a web browser http://<raspberry_pi_ip_address>:32400/web

Basic Configurations

This step is most important: CONTINUE WITH EMAIL and then SIGN UP WITH EMAIL

图片4.png__PID:d2812d9a-1128-4fb3-8a24-a81ef56249cf
图片5.png__PID:1128bfb3-0a24-481e-b562-49cfb89ef72c

1.Add your media libraries (movies, TV shows, music, photos) to Plex.:

图片6.png__PID:9ef72cec-faa6-4a10-aeee-d4d8697c96d1

2.Access Your Plex Media Server
Once sets up, you can access your Plex serveron Raspberry Pi from various devices (smartphones, tablets, smart TVs, computers) using the Plex app or web interface.

图片7.png__PID:dfbf6002-f747-456d-8125-f2e6dfc98102

3.Additional Features:
Customize Plex settings to optimize streaming quality, enable remote access (with Plex Pass or Port Fordward to port 32400), and set up user profiles for personalized experiences.

Optimizing Plex Media Server performance

Optimizing the performance of Plex Media Server on a Raspberry Pi can greatly enhance your media streaming experience. By tweaking settings and utilizing hardware resources effectively, you can achieve smoother playback and faster response times.

Access Plex Media Server settings and set the follow configurations:

Transcoder quality is set to a balanced level (e.g., "Automatic" or "Make my CPU hurt").

Transcoder temporary directory to use a location on your external storage device for faster transcoding performance and to reduce wear on the microSD card.

Generate video preview thumbnails Disabled

图片8.png__PID:8d175dec-ef9a-46c9-b580-cbe9eeabcbe0

Network Considerations

Connect your Raspberry Pi to your network via Ethernet for faster and more stable streaming, especially for high-bitrate content.

Ensure your router or network switch is capable of handling high-speed data transfers for streaming multiple streams simultaneously.

Media Library Optimization

Organize your media library with proper naming conventions and metadata to help Plex Media Server identify and categorize content accurately.

Use optimized media formats compatible with direct playback on client devices to reduce the need for transcoding.

Transcoding Optimization

Enable hardware-accelerated transcoding if your Raspberry Pi model supports it (e.g., Pi 4 with a compatible GPU).

If hardware acceleration isn't available, limit simultaneous transcodes to match the Pi's capabilities to avoid overloading the CPU.

Common Issues and Solutions

Setting up Plex Media Server on a Raspberry Pi can sometimes come with its share of challenges. Here are some common issues you might encounter and their potential solutions:

Performance Issues

Raspberry Pi limited hardware may struggle with transcoding, leading to buffering or playback issues.

Use media files in formats natively supported by your playback devices to reduce transcoding requirements.

Lower the Plex Media Server's transcoding settings to minimize strain on the Raspberry Pi.

Utilize a fast microSD card or, ideally, an external USB 3.0 SSD or HDD for media storage to reduce I/O bottlenecks.

Networking Problems

Plex Media Server not accessible from external networks or devices.

Ensure port forwarding is correctly set up on your router to forward traffic from external networks to your Raspberry Pi Plex Media Server (port 32400 by default).

Check firewall settings on your Raspberry Pi to allow incoming connections on the Plex Media Server port.

Verify that your ISP isn't blocking Plex Media Server traffic or using a double NAT setup.

Permissions and Ownership

Plex Media Server unable to access media files or encountering permission errors.

Make sure the user running Plex (usually `plex` or `plexuser`) has appropriate

chmod 755 (for directories)
chmod 644 (for files)


read/write permissions to your media directories.

Check ownership of media files and folders (`chown` command) to ensure they are accessible by the Plex user.

For more information, follow the oficial Plex documentation.

Step-by-Step Setup: Your Raspberry Pi Media Server for Streaming, Gaming, and More Back to News Pironman 5 Launching Soon: Raspberry Pi 5's Newest NVMe Case – Exclusive Discounts for Group Members!