How to Install Plex Media Server on Debian 10 Buster Server or Desktop

This tutorial will be showing you how to install Plex media server on Debian 10 Buster server/desktop. Plex is a free piece of software that allows you to organize your movies, TV shows, music and photos in one beautiful interface and stream those media files on your PC, tablet, phone, TV, Roku, etc on the network or over the Internet. Plex can run on Linux, FreeBSD, MacOS, Windows and various NAS systems.

Install Plex Media Server on Debian 10 Buster

First, go to Plex server download page, select Linux and choose Ubuntu (16.04+) / Debian (8+)with 32-bit or 64-bit.

plex debian 10 buster

 

If you are going to install Plex on a headless Debian 10 Buster server, then you can go to your browser’s download history, then copy the Plex download link and use wget to download Plex from command line like below.

wget https://downloads.plex.tv/plex-media-server-new/1.16.5.1488-deeb86e7f/debian/plexmediaserver_1.16.5.1488-deeb86e7f_amd64.deb

Once the Plex deb package is downloaded, cd to the download directory. For example, my Plex is downloaded to the Downloads directory under Home, so I run the following command. The tilde (~) represents home directory.

cd ~/Downloads

On Debian based Linux distros (Ubuntu, Linux Mint, etc), dpkg  is the standard command line tool to install deb packages. So run the following command to install the Plex deb package.

sudo dpkg -i plexmediaserver_1.16.5.1488-deeb86e7f_amd64.deb

The -i is short for --install. Note that when you type the following

sudo dpkg -i plex

You can press the Tab key, which will autocomplete the filename.

plex debian install

Now Plex media server is installed. We can check its status with:

systemctl status plexmediaserver

As you can see, it’s running on my Debian 10 Buster system. (Press Q to take back control of terminal.)

debian server plex guide

If Plex media server isn’t running, you can start it with:

sudo systemctl start plexmediaserver

Enable Plex Repository

By enabling the official Plex repo, you can update Plex on Debian with apt package manager. The Plex deb package ships with a source list file. To see a list of files installed from a package, run dpkg with -L flag.

dpkg -L plexmediaserver

Open this file with a command line text editor, such as Nano.

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

By default, its content is commented out. Uncomment the last line to enable this repository. (Remove the beginning # symbol).

plex debian repo

Then save and close the file. To save a file in Nano text editor, press Ctrl+O, the press Enter to confirm. To exit, press Ctrl+X.  After that, run the following command to import Plex public key to apt package manager.

wget -q https://downloads.plex.tv/plex-keys/PlexSign.key -O - | sudo apt-key add -

Now update software repository index.

sudo apt update

Plex Media Server Initial Setup

If you run the following command:

sudo netstat -lnpt | grep Plex

You can see that Plex media server is listening on 0.0.0.0:32400 and 127.0.0.1:32401.

install plex media server debian 10 buster

The web-based management interface is available at port 32400. The first time you configure Plex, you must visit Plex via 127.0.0.1:32400/web or localhost:32400/web. If you installed Plex on your Debian 10 Buster desktop, then you can search Plex Media Manager in your application menu. It will take you to Plex web interface, which in turn will take you to https://app.plex.tv because you need to sign in with a plex.tv account.

plex on debian server
Note that if Plex is installed on a remote Debian 10 Buster server, you need to set up a SSH tunnel by executing the following command on your local computer. Replace 12.34.56.78 with the IP address of the remote Debian server.

ssh 12.34.56.78 -L 8888:localhost:32400

Then you can access Plex web interface via the following URL.

http://localhost:8888/web

This SSH tunnel is only needed for the initial setup. After the initial setup, you can access Plex web interface via server-ip-address:32400. Replace server-ip-address with your real server IP address.

You will be redirected to the plex.tv URL to sign in. Once signed in, you will need to complete the initial setup. (If you don’t see the setup wizard, you can enter localhost:32400/web/index.html#!/setup in the address bar to launch it.)

plex media server initial setup

On the next screen, enter a name for your Plex server. Make sure Allow me to access my media outside my home is checked. Then click Next.

plex debian 10 repository

Now you can add libraries. Click Add Library button.

plex media server add library

Select a library type, then click browse for media folder button to add your media folders.

plex-media-server-debian-buster-setup-guide

Note that the plex user needs to have read and execute permission on your media directories. For example, my 2T external hard drive is mounted under /media/linuxbabe/ , which is owned by root. Users not in group root can’t access it, so I run the following command to give user plex read and execute permission. (I do not recommend changing ownership with chown or chgrp command. Using the setfacl command will suffice.)

sudo setfacl -m u:plex:rx /media/linuxbabe/

You may also need to assign permission on individual media directories like below.

sudo setfacl -m u:plex:rx /media/linuxbabe/directory-name

It can be tempting to add the recursive flag (-R), which gives plex read and execute permission on every file and sub-directory on the drive.

sudo setfacl -R -m u:plex:rx /media/linuxbabe/

If your external hard drive is only used for storing media files, then you can do so, but if you have sensitive files on the external hard drive, don’t do it.

Once you finish adding your media folders, click Next and then click Done.  You can always add more libraries later.

Redo the Initial Setup

If you made a mistake in the initial setup, you can delete the Preferences.xml file and start it over.

sudo rm /var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Preferences.xml

sudo systemctl restart plexmediaserver

Now visit localhost:32400/web again. Plex will tell you there’s an unclaimed server. Click claim it now.

Where to Download Movie and TV Shows

  1. Use a torrenting client like Deluge.
  2. Learn how to download from Usenet.

Advantages of Usenet

  1. It gives you better privacy because others can’t see what you are downloading.
  2. Superfast download speed.
  3. Files on Usenet are usually kept much longer than torrent files. For example, Newsdemon stores files for 4430 days (more than 12 years), so you can download old content at a very fast speed.

Create Nginx Reverse Proxy.

If you prefer to use a domain name rather than typing http://localhost:32400 to access your Plex media server, then you need to set up a reverse proxy. We can use Nginx for this purpose. Install Nginx from the default Debian software repository.

sudo apt install nginx

Then create a server block file for Plex.

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

Put the following lines into the file. Replace plex.example.com with your own domain name. Remember to create an A record for the sub-domain in your DNS manager. (If your ISP gives you a dynamic IP address rather than a static IP address, you need to set up dynamic DNS and port forwarding, or use PageKite. )

server {
      listen 80;
      server_name plex.example.com;

      location / {
          proxy_pass http://127.0.0.1:32400;
          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 and close this file. Then test Nginx configuration.

sudo nginx -t

If the test is successful, reload Nginx for the change to take effect.

sudo systemctl reload nginx

Now you can access Plex media server via plex.example.com.

Create Apache Reverse Proxy

If you prefer Apache over Nginx, then install Apache web server by using the following command.

sudo apt install apache2

To use Apache as a reverse proxy, we need to enable the proxy modules and the header module.

sudo a2enmod proxy proxy_http headers proxy_wstunnel

Then create a virtual host file for Plex.

sudo nano /etc/apache2/sites-available/plex.conf

Put the following configurations into the file. Replace plex.example.com with your actual domain name. Don’t forget to create DNS A record for this sub-domain.

<VirtualHost *:80>
   ServerName plex.example.com
   ErrorDocument 404 /404.html

   #HTTP proxy
   ProxyPass / http://localhost:32400/
   ProxyPassReverse / http://localhost:32400/

   #Websocket proxy
   SSLProxyEngine on
   <Location /:/websockets/notifications>
        ProxyPass wss://localhost:32400/:/websockets/notifications
        ProxyPassReverse wss://localhost:32400/:/websockets/notifications
   </Location>

   Header always unset X-Frame-Options
</VirtualHost>

Save and close the file. Then enable this virtual host.

sudo a2ensite plex.conf

Restart Apache

sudo systemctl restart apache2

Now you can access Plex media server using the domain name.

Enable HTTPS

To encrypt the HTTP traffic when you visit Plex server from outside, we can enable HTTPS by installing a free TLS certificate issued from Let’s Encrypt. Run the following command to install Let’s Encrypt client (certbot) on Debian 10 Buster.

sudo apt install certbot

If you use Nginx web server, you also need to install the Certbot Nginx plugin.

sudo apt install python3-certbot-nginx

Then run the following command to obtain and install TLS certificate.

sudo certbot --nginx --agree-tos --redirect --hsts --staple-ocsp --email [email protected] -d plex.example.com

If you use Apache web server, you also need to install the Certbot Apache plugin.

sudo apt install python3-certbot-apache

Then run the following command to obtain and install TLS certificate.

sudo certbot --apache --agree-tos --redirect --hsts --staple-ocsp --email [email protected] -d plex.example.com

Where:

  • --nginx: Use the nginx plugin.
  • --apache: Use the Apache plugin.
  • --agree-tos: Agree to terms of service.
  • --redirect: Force HTTPS by 301 redirect.
  • --hsts: Add the Strict-Transport-Security header to every HTTP response. Forcing browser to always use TLS for the domain. Defends against SSL/TLS Stripping.
  • --staple-ocsp: Enables OCSP Stapling. A valid OCSP response is stapled to the certificate that the server offers during TLS.

The certificate should now be obtained and automatically installed.

home media server plex

And you can access Plex web interface via HTTPS.

install-plex-media-server-debian-10-buster-letsencrypt-https

How to Upgrade Plex on Debian 10 Buster

When a new version of Plex media server comes out, you can upgrade it by executing the following commands.

sudo apt update

sudo apt upgrade

Then restart Plex.

sudo systemctl restart plexmediaserver

Wrapping Up

I hope this tutorial helped you install Plex media server on Debian 10 Buster. As always, if you found this post useful, then subscribe to our free newsletter to get more tips and tricks. Take care 🙂

Rate this tutorial
[Total: 5 Average: 4.8]

16 Responses to “How to Install Plex Media Server on Debian 10 Buster Server or Desktop

  • Thank you for the tutorial. I have several questions :
    1. What’s the use of the “claim”?
    2. After installing, I used a google login, and it seem that I can use any google login to acess the server. Is it possible to configure an invite-only system so only people I choose can access it ?
    Thanks !

  • Nicholas Barnes
    5 years ago

    Sadly your instructions are incomplete – I go to http://:32400/web and sign into my Plex account and that’s it – just the Plex web player home screen with no option to accept terms, no option to add or name the local server and no way of accessing files on the local server. Delete the configuration XML file and… no difference. The file’s re-created, but there’s no way of configuring the server.

  • Nicholas Barnes
    5 years ago

    And, after much searching, the answer is to visit:
    http://[IP]:32400/manage/index.html#!/setup
    But you must be on the same logical network as the server.
    Apparently it’s how things are if you, at some point in the past, have had a Plex server. In my case it was ten or so years ago!

    • Xiao Guoan (Admin)
      5 years ago

      This is likely because of changes made in recent versions of Plex. If you don’t see the setup wizard, you need to manually enter the address http://[IP]:32400/web/index.html#!/setup

      As I said in this article, if you are not on the same logical network as the server, you need to set up SSH tunnel.

  • Thanks! just installed this on a raspberry pi 4 exactly as stated above and works fine. (although i used the armv7 version)

    Only had to go here: http://[IP]:32400/web/ signed in and worked ok!

    Thanks again

  • Jungack
    5 years ago

    Hello,
    Thanks for the tutorial ! However, I had some troubles with the access using the Android app for example. Remotely, It works sometimes, but it can unexpectedly stop working : I wasn’t able to connect to the server using neither the Android app remotely nor on app.plex.tv, but was able to use my own domain. The only solution is to restart the server, but the problem reappears some hours or days later.
    To solve this, I needed to go to Seetings / Network / Custom server access URLs and put my custom URL in this field.
    Is it mandatory or my configuration is bad? If yes, I think It can be helpful to add It to your tutorial !

  • Thanks for the tutorial, just installed Plex on a VPS with NFS share from a remote NAS and it works great! But I had to “chown plex:debian-user” on my mounted NFS, google told me that ACL are not working with mounted NFS.

  • Matthew B
    4 years ago

    I setup Plex on my debian 10 machine just like the steps said. Still unable to see my 4TB HDD which has my media on it. I went to the permissions of each folder and added “RWX” to the user “plex”. rebooted server several times and removed plex twice to run the steps again. Still no luck. where else should I be looking?

  • Very nice, detailed instructions. I followed these detailed instructions hoping it would solve my issue, having had plex running since 2014 on a headless rpi. I noticed when I migrated to the official release, I could no longer use localip:32400/web to access the server, and yet remote access and local access through plex apps worked just fine. I assumed the migration was the problem, so re-installed twice following these instructions but sadly, the same problem each time: the service is running when checking through terminal and listening on 32400, however when I go to localip:32400/web, the url changes to setup and then hangs on the plex logo, forever trying to load the page until it gives up, leaving me unable to claim the server. Any ideas? It’s the same on every browser including incognito etc.

    • The latest plex update got me past my initial problem and the web page loads. However, when I click on claim server, it fails to let me claim it 🙁

  • In the SSH tunnel… use your username with the server ip address username@server-ip … if you just use the server ip it wont work

  • Hi, i have OpenMediaVault v5 installed with plex media server as guide. I tried to mount the /dev/sdb1 drive but just cant get it mount correctly. ls -l doesnt show any directory? can someone assist me what command to mount this /dev/sdb1 (hdd) and the folder in this sdb1 name media. search google but their setup is different and wont works. plex was installed as deb for ubuntu, it can go to the plex add library page but doenst shown any folder
    thanks

    • Xiao Guoan (Admin)
      4 years ago

      The article linked below might be helpful.
      How To Automount File Systems on Linux

      From your screenshot, it says /dev/sdb1 is mounted under /srv/dev-disk-by-lable-data/, so you need to go to that directory then run the ls command.

      cd /srv/dev-disk-by-lable-data/
      
      ls
      
  • very cool. tnx.

  • thank u, fantastic tutorial

Leave a Comment

  • Comments with links are moderated by admin before published.
  • Your email address will not be published.
  • Use <pre> ... </pre> HTML tag to quote the output from your terminal/console.
  • Please use the community (https://community.linuxbabe.com) for questions unrelated to this article.
  • I don't have time to answer every question. Making a donation would incentivize me to spend more time answering questions.

The maximum upload file size: 2 MB. You can upload: image. Links to YouTube, Facebook, Twitter and other services inserted in the comment text will be automatically embedded. Drop file here