Skip to content
🧮 Is Lifetime with ZapX Pass worth it? Work it out for your own servers in 30 seconds. Open the Lifetime calculator →

Set Up Plex on a Linux Server – Stream Your Personal Media Library

Set up your own private Plex server on Linux as a one-click app or with Docker Compose, with HTTPS, media libraries, and access through Plex apps.

2 December 202615 min read53 Views0 helpful

Introduction

Plex is a platform for managing and streaming media such as movies, TV shows, music, and photos from one central location. With Plex Media Server, you organize your libraries, Plex automatically downloads cover art, descriptions, and cast information, and streams everything to your browser, smartphone, smart TV, or streaming box.

In this guide, we’ll show you two ways to get started: the easy way, using the One-Click App, which makes Plex available over HTTPS in just a few clicks and links it directly to your Plex account, and manual installation using Docker Compose. We’ll then show you how to upload media, connect the Plex apps, and explain the limitations of running a Plex server in a data center.

When it makes sense to run Plex on a server

A Plex Media Server on a VPS or Dedicated Server is especially useful if:

  • You want your media collection to be available around the clock, without leaving a computer or NAS running at home.
  • Your home internet connection doesn’t have enough upload bandwidth to stream while you’re away or to multiple people at the same time. The server streams over the data center’s network connection.
  • You want to share your libraries with family or friends, each with their own Plex account.
  • You want to play music and photos from anywhere, for example with Plexamp.

A data center server is less suitable if you mainly watch content at home on your own network: Plex considers anything outside your local network to be remote access, and playing your own videos remotely has required a paid subscription since April 29, 2025 (see “Limitations of running Plex on a server” below for details). A VPS without a graphics card can also quickly reach its limits if your videos often need to be converted, such as 4K files for older devices.

Plex or Jellyfin?

In addition to Plex, Jellyfin is a popular choice for hosting your own media server. Both are available as One-Click Apps.

PlexJellyfin
CostServer is free; remote video playback requires Plex Pass or Remote Watch PassCompletely free and open source
AccountPlex account required; sign in through plex.tvNo account with a provider; users are stored on your server
AppsPlex apps for smartphones, smart TVs, consoles, and streaming boxesJellyfin apps for Android, iOS, smart TVs, and streaming devices
Hardware transcodingRequires Plex Pass and a compatible graphics unitNo subscription required, but also needs a compatible graphics unit

If you already have Plex Pass or want to use the Plex apps on your devices, Plex is the obvious choice. If you want to stream videos over the internet without a subscription, Jellyfin is a better fit.

Which server should you choose for Plex: VPS or Dedicated Server?

The best server for Plex mainly depends on one question: can your devices play the files directly, or does Plex need to convert them during playback (transcoding)?

  • Direct play: If your devices can play the file format, Plex only sends the data and the CPU has very little to do. A VPS is then sufficient; storage space is the deciding factor.
  • Transcoding: If Plex needs to convert videos, for example 4K files for older devices, the CPU sets the limit. Use the PassMark scores recommended by Plex as a guide: around 2,000 for each simultaneous 1080p file conversion and 12,000 to 17,000 for each 4K file. If several people watch 4K at the same time, a Dedicated Server with a powerful CPU is the better choice.
  • Storage space: Allow space for your media files and an additional 50 GB or more for the Plex database if you have a large collection.
  • Hardware transcoding: Requires Plex Pass and a compatible graphics unit. A VPS doesn’t have a graphics card, so Plex always uses the CPU for transcoding.

You can find minimum requirements and recommendations in the table under “Manual installation.” Prefer to use Windows? Follow Set up Plex on a Windows Server.

Easy option: Plex as a One-Click App

The quickest way to get your own Plex Media Server is through the One-Click Apps on your VPS or Dedicated Server. The app uses the Plex image from LinuxServer.io, is accessible directly over HTTPS with a domain, and is linked to your Plex account during installation. You don’t need access through 127.0.0.1 or an SSH tunnel.

Requirements

  • A Linux VPS or Dedicated Server (Debian or Ubuntu) with One-Click Apps set up. See Set up One-Click Apps for instructions.
  • A free Plex account.
  • Enough resources and storage for your media: refer to the table under the requirements for manual installation.

Get a claim code

You need a claim code so Plex can link the new server to your account. Sign in at plex.tv/claim with your Plex account and copy the code shown. It starts with claim-. The code is valid for only 4 minutes, so get it only after the installation form is open.

Install

  1. Open your server in the ZapX dashboard and switch to the One-Click Apps tab.
  2. Search the app catalog for Plex and click Install app.
  3. Use your own subdomain or zap.cloud is already selected, with a randomly generated name. Leave this option enabled or enter your own name: you’ll use the domain to access Plex Web over HTTPS.
  4. Open App configuration and enter your claim code in PLEX_CLAIM. TZ is already set to Europe/Berlin. Change the value only if you’re in a different time zone.
  5. Click Queue installation. Plex will be ready in a few minutes.
Tip: Code expired or forgotten?

As long as the server hasn’t been linked to an account yet, simply get a new code. Enter it in the app settings (gear icon), under App environment, in PLEX_CLAIM, then click Save. When Plex restarts, it will link the server to your account.

First launch

Open the app’s Access link. Your browser will open Plex Web, where you can sign in with your Plex account. Plex will then guide you through setup: give your server a name and create your first libraries.

Access URL for the Plex apps

Behind the One-Click Apps HTTPS proxy, Plex initially knows only its internal server address. So that the Plex apps on your smartphone, smart TV, or streaming box can still find your server, the One-Click App automatically adds its domain with port 443 as an access URL in Plex as soon as the server is linked to your Plex account. If you change the app’s domain later, the app updates the address the next time it starts. Any address you entered yourself in Plex will remain unchanged.

You only need to enter the address manually if you installed Plex before November 28, 2026, or if the Plex apps can’t find your server. Here’s how to check the setting:

  1. In Plex Web, open Settings (the wrench in the upper-right corner), select Network, and click Show Advanced.
  2. Under Custom server access URLs, check whether your domain and port are listed, for example, https://plex.example.com:443. If the field is empty, enter the address in this format.
  3. Click Save Changes.

Plex will then publish the address on plex.tv, and your apps will connect to your server through it.

Updates and backup

Update Plex in the app settings (gear icon), under App update. Click Check for updates, then install a new version with Apply update. If Plex notifies you that a new server version is available, don’t install it in Plex itself; use App update instead. Your settings, libraries, and media are stored in separate volumes and will be preserved.

The database and settings are in the volume whose name ends in plex-config; your media is in plex-movies and plex-tv. Back up these volumes or use your server’s backups in the web interface.

Manual installation

The rest of this guide covers manual installation of Plex Media Server through the console using Docker Compose. For example, you might want to manage Plex alongside other services yourself or store your media in custom folders. This guide is based on the LinuxServer.io Plex image documentation.

Requirements

  • A Linux server running Debian or Ubuntu, with SSH access. See First connection via SSH.
  • Docker and Docker Compose. See Install Docker. Verify the installation with docker --version and docker compose version.
  • A free Plex account.
  • For HTTPS: a domain or subdomain whose A record points to your server’s IP address (e.g. plex.example.com).
HardwareMinimumZAP-Hosting recommendation
CPU4 vCPU cores8 vCPU cores
RAM4 GB8 GB
Storage25 GB plus space for your media25 GB plus space for your media

According to Plex, 4 GB of RAM is enough for most installations. CPU load, however, depends heavily on whether Plex needs to convert videos during playback (transcoding). As rough guidelines, Plex recommends a PassMark score of around 2,000 for each simultaneous conversion of a 1080p file (H.264, 10 Mbit/s) and around 12,000 to 17,000 for 4K files (HEVC). The Plex database, including cover art and thumbnails, can take up 50 GB or more for large collections.

Prepare the firewall

A new Plex Media Server isn’t linked to an account yet. So leave port 32400 closed for now and allow only SSH and the ports required by the reverse proxy. With ufw, this looks like:

Code
ufw allow OpenSSH
ufw allow 80/tcp
ufw allow 443/tcp
ufw enable

You’ll make the first connection using an SSH tunnel, then access Plex over HTTPS. Open 32400/tcp only if you want the Plex apps to connect directly without a reverse proxy. See “Plex apps and remote access” below. For more information about ufw, see Firewall management on Linux.

Install with Docker Compose

Create directories for the configuration and your media, then switch to the new directory:

Code
mkdir -p /opt/plex/config /opt/plex/media/movies /opt/plex/media/tv
chown -R 1000:1000 /opt/plex
cd /opt/plex

Get a claim code at plex.tv/claim and create the Compose file with nano docker-compose.yml. The code is valid for only 4 minutes, so enter it now:

Code
services:
  plex:
    image: lscr.io/linuxserver/plex:latest
    container_name: plex
    network_mode: host
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Berlin
      - VERSION=docker
      - PLEX_CLAIM=claim-XXXXXXXXXXXX
    volumes:
      - ./config:/config
      - ./media/tv:/tv
      - ./media/movies:/movies
    restart: unless-stopped

Here’s what the entries mean:

  • network_mode: host: Plex uses the server’s network directly, as recommended by LinuxServer.io. The server’s firewall applies without Docker exceptions, so port 32400 remains blocked from the outside.
  • PUID and PGID: Plex runs with user and group ID 1000. That’s why the directories above belong to this user.
  • VERSION=docker: Plex is updated only by pulling a new image, not from inside the running container.
  • PLEX_CLAIM: Links the server to your Plex account on first startup. You don’t need this entry afterward.
  • ./config:/config: The database, settings, and metadata are stored in /opt/plex/config.
  • ./media/movies:/movies and ./media/tv:/tv: Your movies and TV shows. In Plex, you’ll later select /movies and /tv as the folders.

Start the container:

Code
docker compose up -d

Check whether it’s running with docker compose ps, and view the logs with docker compose logs -f.

Tip: Plex without Docker

Plex also offers packages for Debian and Ubuntu at plex.tv/media-server-downloads. The web interface, firewall rules, and reverse proxy work as described here. You can install updates using the package manager.

First launch

Because port 32400 is blocked, you’ll access Plex through an SSH tunnel the first time. Run this command on your own computer:

Code
ssh -L 32400:localhost:32400 root@SERVER_IP

Replace SERVER_IP with your server’s IP address and open http://localhost:32400/web in your browser. Sign in with your Plex account. Plex will guide you through setup: give your server a name and create your first libraries. If you didn’t enter a claim code or it had already expired, you can link the server to your account through the tunnel now, because Plex treats the tunnel connection as local.

Access via HTTPS through a reverse proxy

To access Plex through your domain, set up a reverse proxy with an SSL certificate in front of Plex. For the basics, see Set up a reverse proxy with nginx and Create an SSL certificate (Let's Encrypt).

Plex Web uses WebSockets, so the proxy must pass them through. Here’s a server block for nginx:

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

    location / {
        proxy_pass http://127.0.0.1:32400;
        proxy_set_header Host $host;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_buffering off;
    }
}

Then get the certificate with certbot --nginx -d plex.example.com. Certbot will add HTTPS and HTTP redirection to the block.

Next, add the domain to Plex as an access URL so the Plex apps know to use the proxy too: Settings > Network > Show Advanced > Custom server access URLs, for example, https://plex.example.com:443, then click Save Changes.

Tip: Caddy instead of nginx

Caddy makes this shorter: it obtains the certificate itself and automatically passes WebSockets through. Just add plex.example.com { reverse_proxy 127.0.0.1:32400 } to the Caddyfile. Add the access URL in Plex the same way.

Back up your data

Everything that makes up your Plex installation is in /opt/plex/config: the database, settings, sharing permissions, and metadata. Your media is stored separately under /opt/plex/media. Briefly stop the container to create a backup, then archive the configuration directory. You can leave out the cache directory; Plex will recreate it:

Code
cd /opt/plex
docker compose stop
tar -czf plex-backup-$(date +%F).tar.gz --exclude='config/Library/Application Support/Plex Media Server/Cache' config
docker compose start

Download the backup regularly or also use your server’s backups in the web interface. To restore it, put the config directory back and restart the container.

Update Plex

With VERSION=docker, you update Plex by pulling a new image. You can’t install a notification about a new server version directly from Plex Web inside the container. Get the new version as follows:

Code
cd /opt/plex
docker compose pull
docker compose up -d

Your database and settings in the config directory will remain intact.

Media, libraries, and Plex apps

The following steps apply to both installation methods.

Upload media and create a library

Upload your files to the media folders using SFTP. See Connect via SFTP for instructions.

  • Manual installation: Store movies in /opt/plex/media/movies and TV shows in /opt/plex/media/tv.
  • One-Click App: The app includes two folders, /movies for movies and /tv for TV shows. Each is stored in its own volume. Run this command over SSH to find the path to the movies folder on the server:
bash
docker volume inspect $(docker volume ls -q | grep plex-movies) --format '{{ .Mountpoint }}'

For TV shows, replace plex-movies with plex-tv.

Put each movie in its own folder named with the title and release year, for example, Big Buck Bunny (2008)/Big Buck Bunny (2008).mp4. This helps Plex find the right information and cover art. Then, in Plex, open Settings (the wrench in the upper-right corner), select Libraries, and click Add Library. Choose a type, such as Movies, then add the /movies folder using Browse for media folder. Plex will scan for new files during its next scan. To scan immediately, select Scan Library Files from the library menu.

Set the language, subtitles, and time zone

  • Plex Web language: Open Settings in Plex Web and select General in the Plex Web section. Set the interface language under Language.
  • Metadata language: Each library has its own language for information Plex downloads from the internet, including titles, descriptions, and cover art. Select the language under Language when you create the library. If you change it later in the library settings, it will apply only to content you add afterward.
  • Audio and subtitles: In Plex Web, open the user menu in the upper-right corner, select Account Settings, and scroll to Audio & Subtitle Settings. Enable automatic audio track selection and set your preferred audio and subtitle languages. Each person you share libraries with must set this in their own account.
  • Time zone: TZ sets Plex to your local time, for example, for scheduled tasks and logs. Enter your location’s time zone in the Region/City format, such as Europe/Berlin, Europe/Madrid, or America/New_York. For the One-Click App, change TZ in the app settings (gear icon), under App environment, then click Save. For manual installation, edit the TZ line in docker-compose.yml and run docker compose up -d.

Plex apps and remote access

The Plex apps on your smartphone, smart TV, console, or streaming box sign in with your Plex account and find your server through plex.tv. There are two ways to connect:

  • Through your domain (recommended): If your HTTPS address is listed under Custom server access URLs, the apps will connect through it. This is how the One-Click App and the reverse proxy above work.
  • Directly through port 32400: Open the port with ufw allow 32400/tcp and enable remote access in Plex under Settings > Remote Access. Plex will then check whether the server is reachable from outside.

Private Plex server: share libraries with family and friends

Your Plex server is private: only people you invite can access it. Here’s how to share your libraries:

  1. In Plex Web, open Settings and select Manage Library Access. Click Grant Library Access.
  2. Enter the person’s Plex username or email address. If they don’t have a Plex account yet, they can create one for free when they accept the invitation.
  3. Select your server and choose only the libraries you want to share, such as movies and TV shows, but not your photos.
  4. Send the invitation. The person will receive it by email, or you can send them the invitation link another way.
  • Invited users and managed accounts: Invited users sign in with their own Plex account and see only the libraries you share with them. You create managed accounts (Managed Accounts) yourself in your Plex Home, for example, for children. They don’t need a username, email address, or password, but they can’t sign in on their own either: a regular member of your Plex Home must sign in first, then switch to the managed account.
  • Videos for invited users: Plex considers anyone accessing content from a data center server to be streaming remotely. Therefore, video playback requires Plex Pass on your admin account (which applies to all users of your server), or Plex Pass or Remote Watch Pass on the individual user’s account. This doesn’t apply to music and photos.
  • Keep your server private: Keep port 32400 closed and access the server only via HTTPS (One-Click App or reverse proxy) or an SSH tunnel.

Limitations of running Plex on a server

  • Remote video playback requires a paid subscription: Since April 29, 2025, playing your own videos from a server outside your local network has required Plex Pass for the server’s admin account (which then applies to all users of the server), or Plex Pass or Remote Watch Pass for your own account. According to Plex, this affects, among others, mobile apps, many TV and console apps, and Plex Web in a browser. Plex always considers a data center server to be “remote.” This doesn’t apply to music (for example, using Plexamp) and photos. See Requirements for remote playback of personal media for details.
  • Transcoding uses the CPU only: If a device can’t play a video directly, Plex converts it during playback. A VPS doesn’t have a graphics card, so the CPU handles the conversion. Hardware-accelerated transcoding also requires Plex Pass. The least demanding option is for your devices to play files directly.

Conclusion

You’ve now installed Plex on your server, uploaded your media, and connected the Plex apps. The One-Click App is the quickest option and includes HTTPS out of the box, while manual installation with Docker Compose gives you full control over folders, the proxy, and updates. If you want to stream videos over the internet without a subscription, take a look at Jellyfin too.

For more information, see:

Do you have specific questions that aren’t answered here? Our team is available every day to answer your questions and provide support—just get in touch! 🙂

Free tools

Related tools for servers and developers

View all

FAQ

Frequently asked questions

The One-Click App is the quickest option: set up a domain, HTTPS, and link your Plex account with a claim code in just a few minutes. Install updates in the app settings under App update. Manual installation with Docker Compose is a good choice if you want to manage media folders, the reverse proxy, and updates yourself, or integrate Plex into an existing server environment.
For videos, usually yes. Since April 29, 2025, playing your own videos outside your local network has required Plex Pass for the server’s admin account, or Plex Pass or Remote Watch Pass for your account. Plex always considers a data center server to be remote, and this also affects Plex Web and the mobile apps. You can still stream music and photos for free. Plex Media Server itself is free.
Yes, but it uses the CPU because a VPS doesn’t have a graphics card. Plex recommends a PassMark score of around 2,000 for each simultaneous 1080p file conversion and 12,000 to 17,000 for 4K files. The least demanding option is for your devices to play files directly.

Feedback

Was this article helpful?

Your feedback helps us prioritize and improve content.

0 of 0 people found this article helpful.

Personal support

Need more help than the guide provides?

Our ZAP-Hosting support team knows your product — briefly describe your issue and we'll help you personally.

Zappy knows this guide and answers you right in the chat.