4.7 KiB
4.7 KiB
Plex Server Setup
One-script setup for a Plex Media Server on Ubuntu or Linux Mint. Handles drive mounting and Plex installation in a single run.
Requirements
- OS: Ubuntu 20.04+ or Linux Mint 20+
- Plex .deb file: Downloaded from plex.tv to
~/Downloads/ - A media drive: Internal or external drive for storing your media
Quick Start
-
Download the Plex .deb from plex.tv/media-server-downloads
- Choose Linux
- Select Ubuntu (16.04+) / Debian (8+) →
.debpackage - Save to
~/Downloads/
-
Run the installer:
git clone https://github.com/28allday/Plex-Server-Setup.git
cd Plex-Server-Setup
chmod +x plexint.sh
sudo ./plexint.sh
- Access Plex at
http://<your-server-ip>:32400/web
What It Does
Part A: Drive Mount Setup
Mounts your media drive permanently so it survives reboots.
- Shows all available drives and partitions (
lsblk) - Asks you to select a device (e.g.
/dev/sdb1) - Detects the drive's UUID (unique identifier that won't change)
- Asks for a mount point (e.g.
/mnt/media) - Asks for the filesystem type (ext4, ntfs, xfs, exfat)
- Adds the mount to
/etc/fstaband mounts it immediately
Why UUID? Device paths like /dev/sdb1 can change if you add or remove drives. UUIDs are permanent identifiers tied to the filesystem itself.
Supported filesystems: ext4, ntfs, xfs, exfat, btrfs, and any other type supported by your kernel.
Part B: Plex Installation
- Installs prerequisites (
curl,apt-transport-https,gnupg) - Finds the Plex
.debfile in~/Downloads/ - Installs it with
dpkgand resolves any missing dependencies - Enables Plex to start on boot (
systemctl enable) - Starts Plex immediately
- Opens port 32400 in UFW firewall
After Installation
Initial Plex Setup
- Open
http://<server-ip>:32400/webin a browser - Sign in with your Plex account (or create one)
- Name your server
- Add your media library — point it to the mount point you chose (e.g.
/mnt/media) - Let Plex scan and organize your media
Organise Your Media
For best results, organise your media like this:
/mnt/media/
├── Movies/
│ ├── Movie Name (2024)/
│ │ └── Movie Name (2024).mkv
│ └── ...
├── TV Shows/
│ ├── Show Name/
│ │ ├── Season 01/
│ │ │ ├── Show Name - S01E01.mkv
│ │ │ └── ...
│ │ └── ...
│ └── ...
└── Music/
├── Artist Name/
│ ├── Album Name/
│ │ ├── 01 - Track Name.flac
│ │ └── ...
│ └── ...
└── ...
Files Modified
| Path | Purpose |
|---|---|
/etc/fstab |
Drive mount entry added (one line) |
Services
| Service | Port | Purpose |
|---|---|---|
plexmediaserver.service |
32400 | Plex Media Server web interface and streaming |
Troubleshooting
Can't access Plex web interface
- Check Plex is running:
sudo systemctl status plexmediaserver - Check firewall:
sudo ufw status— port 32400 should be ALLOW - Try
http://localhost:32400/webon the server itself first
Drive not mounting after reboot
- Check fstab syntax:
cat /etc/fstab - Test it:
sudo mount -a(mounts all fstab entries) - Check the UUID is correct:
sudo blkid
Plex can't see files on the media drive
- Check permissions:
ls -la /mnt/media - Plex runs as the
plexuser — it needs read access to your media:
Or add the plex user to your group:sudo chmod -R 755 /mnt/media sudo chown -R plex:plex /mnt/mediasudo usermod -aG your-username plex sudo systemctl restart plexmediaserver
"No .deb file found" error
- Make sure the file is in
~/Downloads/(not a subdirectory) - The filename must start with
plexmediaserver(e.g.plexmediaserver_1.40.0.1234_amd64.deb)
Updating Plex
Download the new .deb from plex.tv and install it:
sudo dpkg -i ~/Downloads/plexmediaserver*.deb
sudo systemctl restart plexmediaserver
Uninstalling
# Stop and remove Plex
sudo systemctl stop plexmediaserver
sudo systemctl disable plexmediaserver
sudo apt remove --purge plexmediaserver
# Remove firewall rule
sudo ufw delete allow 32400/tcp
# Remove the fstab entry (edit manually)
sudo nano /etc/fstab
# Delete the line this script added, then:
sudo umount /mnt/media
# Remove Plex data (WARNING: deletes all library metadata)
sudo rm -rf /var/lib/plexmediaserver
Credits
- Plex - Media server software
License
This project is provided as-is.