# Installing Plex Media Server

Plex is the core of your media ecosystem. It scans your libraries, fetches metadata, organizes your content, and lets
you stream movies and shows from anywhere. While installing Plex is straightforward, **where you store its configuration
and metadata** is crucial for performance and longevity.

This guide covers:

- What Plex is and how it works
- Why Plex should *not* run inside Docker in this setup
- Why its configuration directory belongs on your external HDD
- What Plex stores and how large it can get
- The installation script used to set it all up

---

## 🎬 What Is Plex?

Plex Media Server is an application that:

- Indexes your media collection
- Fetches rich metadata like posters, backgrounds, cast info, and themes
- Streams content to TVs, phones, tablets, and browsers
- Transcodes media when needed for smooth playback
- Manages users, watch history, and personalized recommendations

With great power comes heavy disk usage.

---

## 🧱 Why Plex Runs *Outside* Docker

Though Docker is excellent for the ARR stack, Plex demands more and runs better directly on the host system.

Common problems running Plex inside Docker:

| Issue                            | Cause in Docker                                         |
|----------------------------------|---------------------------------------------------------|
| Hardware transcoding failures    | Containerization blocks VAAPI/V4L2/QuickSync access     |
| Slow scanning of large libraries | Overlay filesystem slows metadata read/write            |
| Network discovery issues         | Plex multicast/IGMP blocked by Docker network isolation |
| Large metadata directories       | Containers struggle with millions of tiny files         |

Practical experience shows Plex performs best installed natively on the OS.

---

## 🗃️ Why Move Plex Metadata to an External HDD?

Plex stores a huge amount of metadata—often tens to hundreds of gigabytes, depending on your library size.

Stored in its config directory are:

- Posters and artwork
- Backdrops
- Theme music
- Subtitles
- Optimization and transcoding caches
- Databases for libraries, watch history, video analysis, and intro detection

### 📌 Typical Metadata Sizes

- Small library (500 files): **5–10 GB**
- Medium library (2,000 files): **20–50 GB**
- Large library (10,000+ files): **100 GB+**

If this data stays on your system SD card or root SSD (e.g., `/var/lib/plexmediaserver`):

- The OS disk can fill up fast
- SD cards may wear out prematurely
- Plex performance will degrade

### ✔ Store metadata on your external HDD

- Access large, fast storage
- Protect your OS drive from filling
- Extend SD card lifespan
- Boost Plex scanning and caching speeds

This is why Plex config is relocated to:

```
/mnt/omnissiah-vault/configs/plex
```

---

## ⚙️ Installation Script

This tutorial uses an installation script that:

- Installs Plex Media Server from the official repository
- Stops the Plex service temporarily
- Moves the entire Plex metadata and config folder to your external HDD
- Creates a symbolic link so Plex finds its config in the expected place
- Fixes file ownerships for the `plex` user
- Restarts and enables Plex to run on boot

### 📥 Download Script

👉 **[install-plex.sh](../scripts/shell/install-plex.sh)**

---

## 🚀 After Installation

Once Plex is installed and its metadata moved:

- Open the Plex Web UI in your browser
- Sign in with your Plex account
- Add your media libraries pointing to `/mnt/omnissiah-vault/media`
- Run a full library scan

All ongoing metadata, caching, posters, and intro markers will safely reside on your external HDD.

---

## ➡️ Next Step: Install qBittorrent on the Host

After successfully installing Plex and configuring its metadata on your external HDD, it’s time to set up **qBittorrent
**, the torrent client responsible for downloading your media files automatically.

Proceed to the detailed installation and configuration instructions here:  
Go to 👉 **[Install qBittorrent](install-qbittorrent.md)**

---
