Media Server Installation & Configuration (Ubuntu 22.04)#

1 Plex Media Server#

1.1 Installation#

Install the official Plex repository to ensure the server stays updated via apt.

2026-03-30 Install commands must be updated

# Update and add Plex GPG key
apt-get update
curl -fsSL [https://downloads.plex.tv/plex-keys/PlexSign.key](https://downloads.plex.tv/plex-keys/PlexSign.key) | sudo gpg --dearmor -o /usr/share/keyrings/plex.gpg

# Add the repository
echo "deb [signed-by=/usr/share/keyrings/plex.gpg] [https://downloads.plex.tv/repo/deb](https://downloads.plex.tv/repo/deb) public main" | sudo tee /etc/apt/sources.list.d/plexmediaserver.list

# Install Plex
apt update && apt install plexmediaserver -y

# Management
systemctl enable plexmediaserver
systemctl start plexmediaserver
systemctl status plexmediaserver

Web UI Access: http://10.1.2.231:32400/web

1.2 Claiming the Server#

If setting up remotely or on a different subnet, you must “claim” the server.

  1. Get a claim code (valid for a few minutes): plex.tv/claim
  2. Run the claim script:
apt install unzip curl -y
wget [https://github.com/uglymagoo/plex-claim-server/archive/refs/heads/master.zip](https://github.com/uglymagoo/plex-claim-server/archive/refs/heads/master.zip)
unzip master.zip && cd plex-claim-server-master && chmod +x plex-claim-server.sh

# Claim the server
sudo -u plex ./plex-claim-server.sh "YOUR_CLAIM_CODE_HERE"

# Restart to apply
systemctl restart plexmediaserver

1.3 Advanced: Run as Root & RAM Transcoding#

To avoid permission issues with local mounts or to utilize RAM for transcoding:

Change Service User:

systemctl edit plexmediaserver

Add these lines:

[Service]
User=root
Group=root
systemctl daemon-reload
reboot

Transcode in RAM: In the Web UI (Settings > Transcoder), set the temporary directory to: /dev/shm

Clear Cache:

sudo rm -r "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Cache"

2 How to Import a Navidrome Playlist into Plex#

Plex does not have a native web interface for importing .m3u playlists. Instead, you must use a hidden Plex API endpoint to inject the playlist directly into the database.

This process assumes Navidrome and Plex share the same underlying media files, but accounts for differences in how their Docker containers mount the directories.

2.1 Prerequisites#

  1. Plex Token: Open Plex web, view the XML info of any track, and copy the X-Plex-Token=xxxxxxxxxxxx from the end of the URL. (See 1password)
  2. Library Section ID: In that same XML file, locate the librarySectionID="X" near the top. Note this number (usually 3 for Music). (See 1Password)
  3. Playlist File: Export your playlist from Navidrome as an .m3u file. The file is already at /mnt/Musique/Favoris.m3u. The file is used by Navidrome.

2.2 Step 1: Stage the File#

Transfer the downloaded .m3u file to your server and place it in the music directory that Plex has access to. Rename it to something simple without spaces.

Example: Place the file at /mnt/Musique/import.m3u.

2.3 Step 2: Sanitize the M3U File#

Navidrome exports playlists with extended #EXTINF metadata and absolute paths. Plex’s primitive importer will fail if it encounters this metadata, Windows-style line endings, or paths that do not exactly match its internal container structure.

Run these commands on your Docker host to strip the metadata, fix line endings, and convert the absolute paths into relative paths.

# 1. Strip out all metadata lines (lines starting with #)
grep -v "^#" /mnt/Musique/import.m3u > /mnt/Musique/clean.m3u

# 2. Remove any hidden Windows carriage returns
sed -i 's/\r$//' /mnt/Musique/clean.m3u

# 3. Strip the leading container path to make all track paths relative to the playlist file
sed -i 's|^/Musique/||g' /mnt/Musique/clean.m3u

2.4 Step 3: Inject via Plex API#

Execute the API call via curl from your host machine.

Important variables to change:

  • IP Address: Ensure this points to your Plex server (e.g., 10.1.2.231).
  • sectionID: Replace 3 with your actual Library Section ID.
  • path: This MUST be the path to the file as Plex sees it inside the container, not the host path. (e.g., /Musique/clean.m3u).
  • X-Plex-Token: Insert your actual token.
curl -X POST "[http://10.1.2.231:32400/playlists/upload?sectionID=3&path=/Musique/clean.m3u&X-Plex-Token=YOUR_PLEX_TOKEN](http://10.1.2.231:32400/playlists/upload?sectionID=3&path=/Musique/clean.m3u&X-Plex-Token=YOUR_PLEX_TOKEN)"

2.5 Step 4: Verification and Cleanup#

  1. Open the Plex web interface and navigate to the Playlists tab.
  2. Locate the new playlist (it will be named clean based on the filename).
  3. Verify the track count and duration match your original Navidrome playlist.
  4. Rename the playlist in Plex to your desired title.
  5. Delete import.m3u and clean.m3u from your server.

3 Migrating a Plex Playlist (Tautulli to MacStudio)#

Plex does not have a native export function, but you can extract a playlist using Tautulli and then use the native Plex API to inject it into a different Plex server.

This guide covers exporting from a Linux/Proxmox server via Tautulli and importing it directly into a macOS-hosted Plex server.

3.1 Export the Playlist from Tautulli#

  1. Open your Tautulli web interface.
  2. Navigate to the Playlists tab (or find it under your specific user profile).
  3. Locate the playlist you want to migrate and click the Export button.
  4. Select the m3u format.
  5. Save the downloaded file to your Mac (e.g., /Users/marc/Downloads/).

3.2 Sanitize and Translate Paths for macOS#

The exported .m3u file contains internal file paths from the source server (e.g., /Musique/). We need to translate these paths to match how the destination Mac server mounts its storage (e.g., /Volumes/Musique/), and rename the file to remove spaces that might break the API command.

Open the macOS Terminal and run the following commands:

# 1. Rename the downloaded file to remove spaces and brackets
mv "/Users/marc/Downloads/Playlist - Favoris [86624].m3u" /Users/marc/Downloads/mac_import.m3u

# 2. Translate the source paths to the new macOS volume paths
# Note: macOS requires the '' after the -i flag for sed
sed -i '' 's|^/Musique/|/Volumes/Musique/|g' /Users/marc/Downloads/mac_import.m3u

3.3 Inject into the MacStudio Plex Server#

You will need your Plex Token and the Music Library Section ID from the destination server.

  • To find these, open Plex Web on the Mac, view the XML info of any music track, and copy the X-Plex-Token from the URL and the librarySectionID from the XML body.

Run the API call via curl from your Mac Terminal to push the file to the local Plex database.

Important variables to change:

  • sectionID: Replace 3 with your Mac server’s actual Library Section ID.
  • path: Use the absolute path to the .m3u file on your Mac.
  • X-Plex-Token: Insert your actual token.
curl -X POST "http://localhost:32400/playlists/upload?sectionID=3&path=/Users/marc/Downloads/mac_import.m3u&X-Plex-Token=YOUR_PLEX_TOKEN"

3.4 Verification and Cleanup#

  1. Open the Plex web interface on your MacStudio and navigate to the Playlists tab.
  2. Locate the newly imported playlist (it will be named mac_import based on the filename).
  3. Verify the track count and duration are correct.
  4. Rename the playlist to its proper title using the pencil icon in Plex.
  5. You can now safely delete the mac_import.m3u file from your Downloads folder.

4 Emby Server#

Simple installation using the .deb package.

cd /var/lib
wget [https://github.com/MediaBrowser/Emby.Releases/releases/download/4.8.8.0/emby-server-deb_4.8.8.0_amd64.deb](https://github.com/MediaBrowser/Emby.Releases/releases/download/4.8.8.0/emby-server-deb_4.8.8.0_amd64.deb)
dpkg -i emby-server-deb_4.8.8.0_amd64.deb
systemctl status emby-server

Web UI Access: http://10.1.2.233:8096


5 Jellyfin#

Jellyfin shares port 8096 with Emby. To run both, Jellyfin must be moved to 8097.

# Stop Emby temporarily if on same machine to prevent conflict during setup
systemctl stop emby-server

# Install Jellyfin
curl [https://repo.jellyfin.org/install-debuntu.sh](https://repo.jellyfin.org/install-debuntu.sh) | sudo bash

Change Port to 8097:

  1. Access UI: http://10.1.2.233:8096
  2. Dashboard > Advanced > Networking
  3. Set Local HTTP port number to 8097.
  4. Restart and re-enable Emby:
systemctl restart jellyfin
systemctl enable emby-server
systemctl start emby-server

Web UI Access: http://10.1.2.233:8097

5.1 Maintenance#

  • Uninstall: apt purge jellyfin

6 Plex Repository Update Migration#

Plex has migrated to a new repository system. To continue receiving updates via apt, you must remove the old repository configuration and add the new one.

6.1 Migration & Update Commands#

Run these commands in order. Do not copy any brackets or parentheses around the links.

1.1 Clean Up Old Repository Files#

rm -fv /etc/apt/sources.list.d/plex*
apt update
apt upgrade

1.2 Install Dependencies - Configure the New Repository#

# Make sure that curl and gnupg2 are installed
sudo apt update
sudo apt install -y curl gnupg2

curl -L https://downloads.plex.tv/plex-keys/PlexSign.v2.key | sudo gpg --yes --dearmor -o /etc/apt/keyrings/plexmediaserver.v2.gpg

echo "deb [signed-by=/etc/apt/keyrings/plexmediaserver.v2.gpg] https://repo.plex.tv/deb/ public main" | sudo tee /etc/apt/sources.list.d/plex.list

1.4 Re-install#

sudo apt update
sudo apt install -y plexmediaserver
dpkg -s plexmediaserver | grep Version

2 Maintenance#

Moving forward, you can update Plex normally:

sudo apt update && sudo apt upgrade
dpkg -s plexmediaserver | grep Version
systemctl status plexmediaserver