Making your own media server with Plex

Screw Netflix, let's build your own media server with the contents you like at home

Making your own media server with Plex

I used to watch movies on Netflix but I cancelled my account since Netflix decided to apply strict rules on shared account, and it made unable to use on my TV at home. So I built my own media server at home.

You can easily find various choices of tools to do this such as Plex, Jellyfin, Emby, etc and I went with Plex because of its simplicity in use and neat, modern look on cross all devices.

What you can do with Plex?

  • Media Organization: Automatically organize your media files with rich metadata, including cover art, plot summaries, and cast details.
  • Streaming: Stream your media content to any device, including smartphones, tablets, smart TVs, and computers, both within your home network and remotely.
  • User Management: Create multiple user profiles and manage permissions, making it perfect for families or shared households.
  • Mobile Sync: Sync your media to your mobile devices for offline viewing
  • Live TV & DVR: Watch and record live TV by integrating a compatible tuner and antenna.
  • Plugins and Channels: Enhance your Plex experience with various plugins and channels that provide additional content and functionalities.
  • Plex Pass: Access premium features like offline syncing, live TV, and early access to new features with a Plex Pass subscription.

Installing Plex Server with Docker Compose and Portainer

Taking a quick look into the download options of Plex, we can see basically it can be installed on all kinds of OS (or at least all popular OS)

Plex Server download options

I'm using Portainer to manage Docker containers and so I will start with Docker.

version: '3.7'
services:

  plex:
    image: plexinc/pms-docker
    restart: unless-stopped
    container_name: plexms
    ports:
      - "32400:32400/tcp"
      - "3005:3005/tcp"
      - "8324:8324/tcp"
      - "32469:32469/tcp"
      - "1900:1900/udp"
      - "32410:32410/udp"
      - "32412:32412/udp"
      - "32413:32413/udp"
      - "32414:32414/udp"

    environment:
      - PUID=${PUID}
      - PGID=${PGID}
      - TZ=Europe/London
      - PLEX_CLAIM=${PLEX_CLAIM}
      - HOSTNAME=PlexServerHomeLab

    volumes:
      - ${USERDIR}/docker/plexms/config:/config
      - ${USERDIR}/docker/plexms/transcodes:/transcode
      - /home/user/Downloads:/media

docker-compose.yml to install Plex Server

Environment variables

  • ${PUID} User ID that the Plex server will run as. (a random number is acceptable)
  • ${PGID} Group ID that the Plex server will run as (a random number is acceptable)
  • TZ: Time zone setting for the container. Europe/London sets the time zone to London, UK.
  • ${PLEX_CLAIM}: This is used to claim the Plex server to your Plex account. You have to log in to Plex and access Plex Claim website to get the code
  • HOSTNAME: Sets the hostname of the container
  • ${USERDIR}: The host directory for volumes mapping. For example you want all volumes of Plex go under /home/user/Documents/Softwares/plex then that's the value of ${USERDIR}

Volumes

  • config: contains all configurations of Plex Server
  • transcode: The path where you would like Plex Media Server to store its transcoder temp files
  • media: The path where you save media assets (video, audio)

Access Plex UI

By default Plex UI can be access via http://localhost:32400. Currently, you can set up the Plex client on various devices to connect to your established server. If you need access to the Plex Server from a different network, you'll need to configure network access on both the Plex Server and your Internet modem. This involves port forwarding through virtual server settings or using DMZ (which offers less security).

Summary

With your Plex Server up and running, you can manage your own media library. By using qBittorrent on your home server, you can effortlessly fill it with all the content you like.