Tux the penguin watching movies on a Linux server

Plex Media Server on Debian Bookworm, Synology NAS

After mistakes were made with a previous installation, I had to completely reinstall the Linux server that I use to run Plex Media Server. For the sake of familiarity, I am using the latest version of Debian (at time of writing: Debian 12.9 “bookworm”). All media is stored on a Synology NAS, shared to the Linux server via a few NFS mounts – this adds a few extra complications that are worth being aware of.

Here are the notes I took during set up – sharing them here in case they are useful to anyone else:

Networking

Make sure that both the Linux server and the Synology NAS have fixed IP addresses and are able to communicate with each other. I’ve got mine set up on the same subnet using fixed DHCP leases, but whatever works for you.

Synology NFS sharing

Make sure the Synology NAS has the folders with your media shared via NFS. There are other options available, but NFS is probably the easiest. First, enable NFS:

Control Panel > File Services > NFS

  • Check Enable NFS service
  • Maximum NFS protocol: NFSv4.1

Then, for each of the folders you want Plex Media Server to have access to:

Control Panel > Shared Folder > select folder > Edit > NFS Permissions > Create

  • Enter IP of the Linux server
  • Check Enable asyncronous
  • Check Allow connections from non-privileged ports
  • Take note of the Mount path at the bottom of the window

Linux NFS mounts

Next, you need to be able to have the NFS mounts come up on boot. Keep in mind this is Debian 12 with no GUI – if you have another distribution, or if you have a GUI – there may be a better way to do this.

Create the relevant directories in /media – I used /media/nfs/TV Shows and /media/nfs/Movies

Edit the /etc/fstab file and add in the following (you’ll need to make changes to suit your environment)

# NFS mounts for Plex Media Server
192.168.x.x:/volume1/TV\040Shows        /media/nfs/TV\040Shows   nfs     x-systemd.automount,x-systemd.requires=network-online.target    0       0
192.168.x.x:/volume1/Movies    /media/nfs/Movies       nfs     x-systemd.automount,x-systemd.requires=network-online.target    0       0

A few notes:

  • The IP address before the : is the Synology NAS
  • The folder after the : is the mount point you noted earlier
  • If you have spaces in the directory name, use \040 in place of the space character

Reboot, make sure that you have all of the media mounted and accessible in the relevant folders before continuing.

Find out what all of the unit names for the mounts are called – run the following command:

sudo systemctl list-units -t mount

That should show you something like the following:

  UNIT                            LOAD   ACTIVE SUB     DESCRIPTION                                        
  server-nfs-Movies.mount         loaded active mounted /media/nfs/Movies
  server-nfs-TV\x20Shows.mount    loaded active mounted /media/nfs/TV Shows

You’ll need the unit names in the next step.

Install Plex Media Server

Install as per the Server Installation instructions for Linux / Ubuntu – but don’t go to the URL to complete setup yet! The installation should have created a Plex Media Server service; it needs to be updated before the next reboot – I really recommend doing this part before completing the setup.

Stop the existing server first, if needed:

sudo systemctl stop plexmediaserver.service

Add a custom Unit section to the startup script to ensure Plex Media Server is started after the NFS mounts are available:

sudo systemctl edit plexmediaserver.service

Add the following in the section indicated at the top of the file:

[Unit]
Description=Plex Media Server
After=network.target network-online.target server-nfs-Movies.mount server-nfs-TV\x20Shows.mount

Basically – add the unit names with spaces in between each for the mount points after network.target and network-online.target. Save, then start the Plex Media Server service:

sudo systemctl start plexmediaserver.service

Enable the service on startup:

sudo systemctl enable plexmediaserver.service

Finally, go to the server’s URL to complete setup. Expect this to take a while if you have a lot of media to index and create thumbnails for; the server may also crash and need a reboot a time or two – but it will settle down after the indexing is complete.

Leave a Reply

Your email address will not be published. Required fields are marked *

62 − = 57

This site uses Akismet to reduce spam. Learn how your comment data is processed.