Skip to main content

Command Palette

Search for a command to run...

Deploying Plex Home Media Streaming on Ubuntu 24.04

Step-by-step guide to deploy Plex Media Server with Docker Compose and Traefik on Ubuntu 24.04, with persistent storage and automatic HTTPS for streaming your media library.

Updated
2 min read
Deploying Plex Home Media Streaming on Ubuntu 24.04
S
A Developer Advocate with a focus on improving the developer experience through clear communication, technical enablement, and community engagement.
A
DevOps Engineer with experience in Kubernetes, automation, cloud infrastructure, and observability. I work in Developer Relations, contribute to technical documentation, and collaborate on engineering-focused projects.

Plex is a personal media server that organizes and streams your movies, TV shows, music, and photos to clients on every major platform, with metadata, transcoding, and remote access built in. This guide deploys Plex using Docker Compose with Traefik handling automatic HTTPS, claimed against your Plex account at first run, following home media streaming deployment practices documented in Vultr Docs.

Prerequisite: Get a Plex claim token from plex.tv/claim. It's valid for 4 minutes, so generate it just before starting the stack.


Set Up the Directory Structure

1. Create the project directory structure:

mkdir -p ~/plex-media-server/{config,transcode,media}
cd ~/plex-media-server

2. Create the environment file:

nano .env
TZ=YOUR_TIMEZONE
PLEX_CLAIM=YOUR_PLEX_CLAIM_TOKEN
DOMAIN=plex.example.com
LETSENCRYPT_EMAIL=admin@example.com

Deploy with Docker Compose

1. Create the Docker Compose manifest:

nano docker-compose.yaml
services:
  traefik:
    image: traefik:v3.6
    container_name: traefik
    command:
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
      - "--entrypoints.websecure.address=:443"
      - "--entrypoints.web.http.redirections.entrypoint.to=websecure"
      - "--entrypoints.web.http.redirections.entrypoint.scheme=https"
      - "--certificatesresolvers.letsencrypt.acme.httpchallenge=true"
      - "--certificatesresolvers.letsencrypt.acme.httpchallenge.entrypoint=web"
      - "--certificatesresolvers.letsencrypt.acme.email=${LETSENCRYPT_EMAIL}"
      - "--certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json"
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - "letsencrypt:/letsencrypt"
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
    restart: unless-stopped

  plex:
    image: plexinc/pms-docker:latest
    container_name: plex
    hostname: plex
    expose:
      - "32400"
    volumes:
      - "./config:/config"
      - "./transcode:/transcode"
      - "./media:/data"
    environment:
      - TZ=${TZ}
      - PLEX_CLAIM=${PLEX_CLAIM}
      - ADVERTISE_IP=https://${DOMAIN}:443/
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.plex.rule=Host(`${DOMAIN}`)"
      - "traefik.http.routers.plex.entrypoints=websecure"
      - "traefik.http.routers.plex.tls.certresolver=letsencrypt"
      - "traefik.http.services.plex.loadbalancer.server.port=32400"
    restart: unless-stopped

volumes:
  letsencrypt:

2. Start the services:

docker compose up -d

3. Verify the services are running:

docker compose ps
docker compose logs

Configure Plex Media Server

  1. Open https://plex.example.com in a browser.

  2. Sign in with the Plex account that generated the claim token.

  3. Name the server and add libraries pointing to folders under /data (your ./media mount).

  4. Let Plex scan and fetch metadata. Install client apps on your devices to start streaming.


Next Steps

Plex is running and streaming securely over HTTPS. From here you can:

  • Add Movies, TV, Music, and Photos libraries with custom agents and scanners

  • Enable hardware-accelerated transcoding with a Plex Pass subscription

  • Set up managed users and parental controls for shared access

For the full guide with additional tips, visit the original article on Vultr Docs.

The Self-Hosted Stack

Part 30 of 50

The Self-Hosted Stack is a developer-focused series exploring open-source tools you can deploy, run, and manage on your own infrastructure. From AI platforms and databases to developer tools, observability stacks, and authentication systems, each guide walks through deploying production-ready open-source software on Vultr cloud infrastructure.

Up next

Deploying RabbitMQ Message Broker System on Ubuntu 24.04

Step-by-step guide to deploy RabbitMQ with Docker Compose and Traefik on Ubuntu 24.04, with persistent storage and automatic HTTPS for the management UI.

More from this blog

V

Vultr

71 posts

Vultr is a global cloud infrastructure provider trusted by developers and businesses in 185+ countries. We publishe hands-on guides spanning Linux administration, server configuration, DevOps, networking, open source stacks, AI code agents, and Vultr product walkthroughs, all tested against real cloud environments and built for engineers who ship.