Plex in an LXC on Proxmox

Neil Pathare
4 min readFeb 18, 2021

This guide provides an overview for getting started with Plex on Proxmox, split in two sections: one deals with getting a container setup to serve SMB/CIFS shares & another container that has the Plex install. This way you keep your Plex container separate from your container for shares.

SMB/CIFS Container

Using the Proxmox GUI, create an unprivileged container. I used the latest Ubuntu template. Most options can be left at their defaults. I switched my network settings to be DHCP instead of the default static. My resources were set to 1 CPU, 8 GB storage, 512 MB RAM. As this container is for serving shares, it shouldn’t really need much more in terms of resource allocation.

Console into your container & run:

apt update && apt upgrade -y
apt install net-tools #Needed for ifconfig, etc.
apt install samba

That should get you up-to-date on the software side of things. To confirm that Samba is installed, run: whereis samba the output should show you the installed locations, samba: /usr/sbin/samba /usr/lib/samba /etc/samba /usr/share/samba /usr/share/man/man7/samba.7.gz /usr/share/man/man8/samba.8.g.

After installing the service, we will need to create a user that can manage the shares & enable it to use the service

adduser --system smbusr
smbpasswd -a smbusr

Next, create a directory to share, eg: mkdir /mnt/Data/Share& own it as smbusr by running: chown -R smbusr /mnt/Data/Share .

Now edit your SMB configuration, nano /etc/samba/smb.conf, by adding at the end your share details:

[Share]
comment = Share on the Data Pool
path = /mnt/Data/Share
read only = no
writeable = yes
browsable = yes
force user = smbusr

Last, restart the service & allow it through the firewall.

service smbd restart
ufw allow samba

You will want to note down the SMB user’s ID for later (to enable mounting these shares on other containers) by running id -u smbusr. Mine was 110.

Run ip a to find out the IP address of your SMB container. Mine was 192.168.0.194.

Reference: https://ubuntu.com/tutorials/install-and-configure-samba#1-overview

Plex LXC Setup

Using the Proxmox GUI, create a container using the latest Ubuntu template. Most options at default should be fine. Ensure this is a privileged container if you want to mount shares from other containers, otherwise it can be an unprivileged container. Set DHCP instead of static (or go the static route if you know what you’re doing).

Assuming you’ve created a privileged container, go to the “Options” pane for your container from the Proxmox GUI & under “Features”, edit the list to check “CIFS”.

Go to https://www.plex.tv/media-server-downloads/ to grab the download link for the latest Plex version. It should look something like this: https://downloads.plex.tv/plex-media-server-new/1.21.3.4021-5a0a3e4b2/debian/plexmediaserver_1.21.3.4021-5a0a3e4b2_amd64.deb

Console into your container to update software & install Plex:

apt update && apt upgrade -ycs /home && wget https://downloads.plex.tv/plex-media-server-new/1.21.3.4046-3c1c83ba4/debian/plexmediaserver_1.21.3.4046-3c1c83ba4_amd64.debdpkg -i plexmediaserver_1.21.3.4046-3c1c83ba4_amd64.deb

Repository updating is a possibility, see this Plex support article: https://support.plex.tv/articles/235974187-enable-repository-updating-for-supported-linux-server-distributions/

In short, run:

echo deb https://downloads.plex.tv/repo/deb public main | sudo tee /etc/apt/sources.list.d/plexmediaserver.listcurl https://downloads.plex.tv/plex-keys/PlexSign.key | sudo apt-key add -

Then, by running apt-get update, the Plex Media Server repository will be enabled on the OS.

But this process does not support Plex Pass, so I use wget to grab the latest from https://www.plex.tv/media-server-downloads/ (ensure the radio button for Plex pass is enabled). dpkg will automatically update the package when you download a new version so you don’t need to uninstall the previous version to install the new one. The one drawback is to manually clean up old downloaded DEB files.

Run ip a to find out the IP address of the Plex container. Mine was 192.168.0.35.

If you have an external NAS, from Proxmox’s GUI, go to the resources tab of your container & add one or more mount points. If you’re trying to mount a share from another container, first ensure you’re able to see the shares (you’ll need smbclient installed)

apt-get install smbclient && smbclient -L //<Container-IP>

Next, install cifs-utils & mount your share from your other container using:

apt-get install cifs-utils && mkdir /mnt/Share && mount -t cifs -o uid=110,username=smbusr //192.168.0.194/Share /mnt/Share/

These mount points will be the folders on your data store where your media resides.

NOTE: Disk size on the mount point creation is more or less an estimate (see: https://forum.proxmox.com/threads/mount-point-disk-size.51086/).

From your main machine on the network, navigate to this IP at Plex’s port, eg: http://192.168.0.35:32400/web/index.html. You will be redirected to app.plex.tv to log in.

As a part of the setup, you will need to add folders to your library. You should see the folders in the selection window that match the mount point(s) created earlier.

Unfortunately, the mount point created from the SMB container will be lost on a reboot of the Plex container. To have this mount auto-mounted at boot, we will need to edit the fstab entry for the container (nano /etc/fstab) & add:

//192.168.0.194/Share /mnt/Share cifs _netdev,x-systemd.automount,x-systemd.requires=network-online.target,uid=110,username=smbusr,password=smbpass,iocharset=utf8 0 0

This line tells fstab that there is a mount & provides all the connection details for the mount. Saving the password in the fstab isn’t recommended, you’ll want to do something like:

nano /root/.credentials/smbcredentials# Add to this file:
# username=smbusr
# password=smbpass
chmod 600 /root/.credentials/my-credentials# Replace the username & password parameters from the command above with:
# credentials=/root/.credentials/smbcredentials

Once that’s done, we can add a crontab job to perform an auto-mount on reboot. Run crontab -e & add at the end, @reboot mount -a .

That’s all. You should now have a running Plex server that serves media from a CIFS mount. The mount & Plex should spin up on a reboot.

References:

--

--