How to Install Plex Media Server on Debian 12/11/10

Plex Media Server is a powerful and versatile software solution that transforms your personal computer, NAS, or other compatible devices into a full-fledged home media center. Say goodbye to juggling multiple streaming platforms and devices, as Plex streamlines your digital content management and playback experience like never before. In this introduction, we’ll cover the unique features of Plex Media Server that make it the go-to choice for media enthusiasts everywhere.

📚 Key Features:

  • 🌐 Unified Media Library: Plex brings together movies, TV shows, music, photos, and more from your personal media collection and various streaming services, all organized neatly in one place.
  • 💡 Intelligent Organization & Search: Plex automatically fetches metadata for your content, including cover art, descriptions, and ratings. Its powerful search capabilities make finding the media you want to watch a breeze.
  • 📺 Beautiful Interface: Plex’s visually appealing interface delivers an immersive and user-friendly experience, making browsing and discovering content a joy.
  • 🌟 Plex Pass Subscription: Enhance your Plex experience with features such as Live TV & DVR, Mobile Sync, Parental Controls, and more with a Plex Pass subscription.
  • 📱 Device Compatibility: Stream your content on a wide range of devices, including smartphones, tablets, smart TVs, and gaming consoles, ensuring you can enjoy your media wherever you go.
  • 🌍 Remote Access: Access your Plex library anytime, anywhere with an internet connection, making it perfect for travelers and those on-the-go.
  • 🤝 Content Sharing: Share your Plex library with friends and family, creating a personalized media experience for everyone involved.
  • 💬 Community Plugins: Extend the functionality of Plex Media Server with a vast array of community-built plugins, adding new features and integrations.

This guide will demonstrate how to install Plex Media Server on Debian 12 Bookworm, Debian 11 Bullseye, or Debian 10 Buster using the Plex APT repository for the latest up-to-date version. Get ready to embark on an incredible journey into the world of digital media, all at your fingertips! 🚀

Section 1: Install Plex Media Server on Debian

Step 1: Update the Debian System

Start by updating your Debian system to ensure a smooth installation process. This ensures all existing packages are up to date:

sudo apt update && sudo apt upgrade

Step 2: Install the Required Packages

Plex installation requires some additional packages. Install them by running the following command:

sudo apt install dirmngr ca-certificates software-properties-common apt-transport-https curl -y

These packages will provide the necessary tools for handling the Plex repository, including secure connections and GPG key management.

Step 3: Import Plex Repository

To install Plex from the official source, you need to add the Plex repository to your Debian system. This ensures you install and update the software directly from the official repository using the APT package manager.

First, open your terminal and import the Plex GPG key with the following command:

curl -fsSL | gpg --dearmor | sudo tee /usr/share/keyrings/plex.gpg > /dev/null

This command downloads the Plex GPG key, which is used to verify the authenticity of the packages from the repository.

Next, add the Plex repository to your system:

echo "deb [signed-by=/usr/share/keyrings/plex.gpg] public main" | sudo tee /etc/apt/sources.list.d/plexmediaserver.list

This command creates a new file in the sources.list.d directory with the necessary information about the Plex repository.

Step 4: Install Plex Media Server

Before installing Plex, update your package index to include the newly added Plex repository:

sudo apt update

Now you can install Plex Media Server on Debian using the following command:

sudo apt install plexmediaserver -y

During the installation, you may see a prompt asking if you want to replace the imported repository list with Plex. Type “N” to proceed with the installation, as you do not want to replace the imported repository list. This is because the correct signed-by GPG key is already in place.

Step 5: Verify Plex Media Server

By default, the Plex Media service should start automatically. To verify this, use the following systemctl command to check the status:

systemctl status plexmediaserver

If the service is not active, use the following command to start Plex Media Server:

sudo systemctl start plexmediaserver

To ensure Plex Media Server starts automatically on system boot, enable the service with this command:

sudo systemctl enable plexmediaserver

If you need to restart the Plex Media Server service for any reason, use the following command:

sudo systemctl restart plexmediaserver

Section 2: Configure UFW Firewall for Plex Media Server on Debian

Securing your Plex Media Server is crucial, especially when you plan to access it remotely or allow others to access it. UFW (Uncomplicated Firewall) is a great way to protect your server.

Step 1: Enable UFW Firewall

First, check if UFW is installed on your system. If not, install it using the following command:

sudo apt install ufw -y

Next, enable UFW with this command:

sudo ufw enable

Step 2: Add Plex Media Server Port Rules

Add the default Plex Media Server port (32400) to the UFW rules. You can customize the port later if you wish. Make sure to delete this rule and add a new one if you change the port in the Plex Media Server dashboard.

sudo ufw allow 32400

Step 3: Additional UFW Rules for Plex

Plex Media Server uses several additional ports for different services and connections. To allow them through the UFW firewall, use the following commands:

sudo ufw allow 1900/udp
sudo ufw allow 3005/tcp
sudo ufw allow 5353/udp
sudo ufw allow 8324/tcp
sudo ufw allow 32410:32414/udp

Here’s a brief explanation of the ports and their purposes:

  • 1900/udp: Used for the discovery of Plex Media Server by clients over the network.
  • 3005/tcp: Required for Plex Companion, a feature that allows you to control Plex playback from a mobile device.
  • 5353/udp: Used for mDNS (Multicast Domain Name System) to help Plex discover devices on the local network.
  • 8324/tcp: Required for the Plex DLNA server.
  • 32410:32414/udp: Used for media streaming to clients.

Remember to adjust your UFW rules if you customize any of the ports mentioned above. By configuring the UFW firewall for your Plex Media Server, you can ensure a more secure and protected media hub experience on your Debian system.

Section 4: Configure Plex Headless Server SSH on Debian

If you’ve installed Plex Media Server on a remote headless server or another Debian desktop that you don’t always have local access to, you’ll need to set up an SSH tunnel on your local computer for the initial setup. This allows outside connections to access the Plex server.

Step 1: Set up the SSH Tunnel

Replace {server-ip-address} with the actual IP address of your server, for example,


ssh {server-ip-address} -L 8888:localhost:32400

If you’re new to SSH and haven’t installed it yet, you can do so with the following commands:

sudo apt install openssh-server -y
sudo systemctl enable ssh --now

Step 2: Access Plex Media Server via SSH Tunnel

Now you can access the Plex Media Server by opening the following address in your web browser:


Or use the alternative address if the above one does not work:


The HTTP request will be redirected to http://localhost:32400/web on the remote server through the SSH tunnel.

Step 3: Access Plex Media Server Remotely

Once you’ve completed the initial setup, you can access your Plex Media Server using your remote server’s IP address:


Section 5: Configuring Plex Media Server in WebUI on Debian

Now that Plex is installed on your system, you must configure and complete the setup through the WebUI. The WebUI enables you to manage your media library and customize your server settings. Follow the steps below to access and configure the Plex Media Server in WebUI:

Step 1: Access the WebUI

To access the WebUI, open your preferred internet browser and navigate to one of the following addresses:



If these two do not work, try using the following address:


Now, you can log in using an existing social media account listed above or with your email to register a new account if you are new to Plex. Once logged in, you will begin the initial configuration setup.

Step 2: Understanding Plex

The first configuration page briefly explains what Plex is and how it works. Click GOT IT! to proceed to the next page.

Note: Depending on your internet browser, Firefox users may see a message prompting them to enable DRM. This choice is necessary; without it, Plex WebUI may not work correctly.

Click GOT IT! to proceed.

Step 3: Optional Plex Pass

Next, you will be prompted to upgrade to Plex Pass, which is optional. Plex Pass offers benefits like HDR options and access to beta builds. If you want to skip this, click the X in the top right-hand corner. You can always set this up later.

Step 4: Server Setup

Configure your server name, which can be anything you desire. You also have the option to disable Allow me to access my media outside my home. By default, access to outside media is enabled; untick the feature if you don’t plan to do so.

Once configured, click the NEXT button.

Step 5: Media Library

The Media Library page gives you the option to pre-add your media directories. If you have a media drive or folder ready, click the ADD LIBRARY button.

plex media server with debian linux - click add library optionally to pre set up mediaPin

Now select the type of media you want your folders to be organized into, such as TV shows, movies, music, etc. Click the NEXT button to proceed to add folders.

Click the BROWSE FOR MEDIA FOLDER button and select the media directory. Once the folder is added, the Advanced options will appear, where you can further customize Plex to your liking.

When you’re done, click ADD LIBRARY to continue to the Finish tab.

Step 6: Finishing up

Next, hit the NEXT button to finish the initial setup, with or without adding a Media Library. The next screen informs you that you’re all set. Click the DONE button to proceed to the Plex Dashboard.

Section 6: Configuring Media Files & Folders Permissions on Debian

During the initial setup, you may have noticed that your media did not appear. You may have problems adding content that will not be picked up, with Plex refusing to find the content on your existing internal and external secondary hard drives. This is partly due to Plex creating a dedicated user account named plex, which needs read and execute permission on your media directories.

Debian permissions can be set using chown or setfacl; both are effective. Below are some examples of how to apply these commands to ensure proper access for Plex.

Step 1: Set permissions using setfacl

To set permissions using setfacl, execute the following commands, replacing /media/yourfolder/ with the path to your media directory:

setfalc way example:

sudo setfacl -R -m u:plex:rx /media/yourfolder/
sudo setfacl -R -m u:plex:rx /media/yourfolder/tv
sudo setfacl -R -m u:plex:rx /media/yourfolder/movies

Step 2: Set permissions using chown

To set permissions using chown, execute the following commands, replacing /media/yourfolder/ with the path to your media directory:

sudo chown -R plex:plex /media/yourfolder/

Or set permissions for individual files in the hard drive if other folders are present that you do not want Plex to access:

sudo chown -R plex:plex /media/yourfolder/tv
sudo chown -R plex:plex /media/yourfolder/movies

Step 3: Install ACL package (if necessary)

If the commands above are not working, you may need to reinstall the ACL package if it is missing from your system:

sudo apt install acl -y

Section 7: Configuring Nginx Reverse Proxy for Plex Media Server on Debian

Setting up a reverse proxy allows you to access Plex Media Server from a remote computer or network. In this example, we will set up an Nginx proxy server.

Step 1: Install Nginx

First, install Nginx with the following command:

sudo apt install nginx -y

By default, Nginx should be enabled. If it is not activated, use the following command:

sudo systemctl start nginx

Now check to make sure Nginx is activated and has no errors:

sudo systemctl enable nginx

Now check to make sure Nginx is activated and has no errors:

systemctl status nginx

Step 2: Create a Server Block

Create a new server block as follows:

sudo nano /etc/nginx/conf.d/plex.conf

You will need an active domain name and need to create a sub-domain. Once done, add the following to the server block file:

server {
      listen 80;

      location / {
          proxy_set_header Host $host;
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

          #upgrade to WebSocket protocol when requested
          proxy_set_header Upgrade $http_upgrade;
          proxy_set_header Connection "Upgrade";

Save the file (CTRL+O), then exit (CTRL+X).

Step 3: Test Nginx Configuration

Perform a dry run to ensure there are no errors in the Nginx configuration or your server block:

sudo nginx -t

If everything is working correctly, the example output should be:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Reload Nginx for the change to take effect:

sudo systemctl reload nginx

If you have set up your domain and DNS records to point to your server IP, you can now access your Plex Media Server at

Step 4: Secure Reverse Proxy with Let’s Encrypt SSL Free Certificate

It is recommended to run your Nginx on HTTPS using an SSL certificate. You can use Let’s Encrypt, a free, automated, and open certificate authority run by the nonprofit Internet Security Research Group (ISRG).

First, install the certbot package as follows:

sudo apt install python3-certbot-nginx -y

Once installed, run the following command to start creating your certificate:

sudo certbot --nginx --agree-tos --redirect --hsts --staple-ocsp --email -d

This setup includes force HTTPS 301 redirects, a Strict-Transport-Security header, and OCSP Stapling. Make sure to adjust the email and domain name to your requirements.

Now your URL will be instead of If you use the old HTTP URL, it will automatically redirect to HTTPS.

Step 5: Set Up Automatic Certificate Renewal

Optionally, you can set a cron job to renew the certificates automatically. Certbot offers a script that does this automatically. First, test to make sure everything is working by performing a dry run:

sudo certbot renew --dry-run

If everything is working, open your crontab window using the following terminal command:

sudo crontab -e

Next, specify the time when the certificate should auto-renew. This should be checked daily at a minimum, and if the certificate needs to be renewed, the script will update the certificate. If you need help finding a good time to set, use the free tool.

Add the following line to your crontab:

00 00 */1 * * /usr/sbin/certbot-auto renew

This command will check for certificate renewal daily at midnight. If a certificate is due for renewal, it will automatically update it. This ensures that your SSL certificate stays up to date and your reverse proxy remains secure.

Section 8: Getting Started with Plex Media Server on Debian Linux

In this section, we will cover some tips and tricks to enhance your experience with Plex Media Server on Debian Linux. These tips are specifically tailored to Debian users and will help you get the most out of your Plex setup.

General Tips

  • Organize your media: Use a consistent naming and folder structure for your media files. This makes it easier for Plex to recognize and categorize your content. Check the Plex Naming Guide for more information.
  • Optimize database performance: Regularly optimize the Plex database to improve performance and reduce the chance of issues. To do this, go to Settings > Server > Scheduled Tasks and enable Optimize Database and Clean Bundles.


  • Customize your Dashboard: Tailor the Plex Dashboard to your preferences by pinning or unpinning libraries, adding or removing sections, and reordering items. To customize your Dashboard, click on the Customize button in the top-right corner.
  • Enable or disable automatic media analysis: Plex automatically analyzes your media files for quality, duration, and other information. If you prefer to control this process manually, go to Settings > Server > Library and toggle Analyze media files.
  • Adjust video quality settings: To optimize video playback quality and performance, go to Settings > Quality and adjust the streaming quality settings based on your network conditions and device capabilities.

Other Tips

  • Use keyboard shortcuts: Learn and use Plex keyboard shortcuts to quickly navigate and control playback. Some common shortcuts include:
    • Spacebar: Play/PauseF: Full-screen toggleS: Stop playbackM: Mute/Unmute
  • Enable subtitles: Plex supports subtitles in various formats, such as SRT, SSA, and ASS. To enable subtitles, click on the speech bubble icon during playback and select the desired subtitle track.
  • Control Plex with your smartphone: Download the Plex mobile app to control playback and manage your server from your smartphone. The Plex mobile app is available for both Android and iOS.

By following these tips, you’ll be able to get the most out of your Plex Media Server on Debian Linux. Enjoy your media collection and happy streaming!

Section 9: Additional Commands & Tips for Debian

Updating Plex Media Server

Keep your Plex Media Server up to date to ensure you have the latest features, bug fixes, and security patches. You can update Plex Media Server using the standard apt update and upgrade commands.

Step 1: Check for updates

To check for updates, run the following command:

sudo apt update

Step 2: Upgrade Plex Media Server

If an update is available, use the upgrade command to update Plex Media Server:

sudo apt upgrade plexmediaserver

Or update all packages at once along with Plex Media Server:

sudo apt upgrade

Removing (Uninstalling) Plex Media Server

If you no longer wish to use Plex and want to remove it from your Debian system, follow these steps.

Step 1: Uninstall Plex Media Server

Execute the following command to remove Plex Media Server from your system:

sudo apt remove plexmediaserver

Step 2: Disable Nginx reverse proxy (if applicable)

If you installed the Nginx reverse proxy, don’t forget to disable it and, if needed, delete the configuration file associated with your domain.

To disable the Nginx reverse proxy, run the following command:

sudo systemctl disable nginx --now

To remove the configuration file, use the following:

sudo rm /etc/apt/sources.list.d/plexmediaserver.list

Finally, reload Nginx to apply the changes:

sudo rm usr/share/keyrings/plex.gpg

Conclusion: Installing Plex Media Server on Debian

In conclusion, installing Plex Media Server on Debian Linux is a straightforward process that enables you to create a powerful and flexible media server for your home or organization. By following the steps outlined in this guide, you can have a fully functioning Plex Media Server up and running in no time. Remember to keep your server updated and maintained to ensure optimal performance and security.

Additional Resources and Links

To help you further enhance your Plex Media Server experience on Debian, we’ve compiled a list of official resources and documentation:

  • Plex Official Website: The official Plex website is a great starting point for learning more about Plex, its features, and available plans.
  • Plex Support: Visit Plex Support for answers to common questions, troubleshooting tips, and in-depth articles on various topics related to Plex.
  • Plex Forums: Join the Plex community in the official forums to discuss and share ideas, ask questions, and get help from other Plex users and experts.
  • Plex Media Server Documentation: Dive into the official Plex Media Server documentation to learn more about the installation, configuration, and management of your Plex server.
  • Debian Wiki: The Debian Wiki is an invaluable resource for all things related to Debian Linux, including guides, tutorials, and troubleshooting tips.

Comments are closed.

Share to...