Saturday, June 5, 2021

Creating a Proxmox Container for Plex

 This is a long and involved process. Some of the steps may not be neccessary. For my particular application I decided I needed 2 things.

  1. GPU Passthrough
  2. CIFS mounts in the container

The GPU Passthrough may not be necessary on a privileged container, but I tackled this first before I realized I needed to upgrade the container to privileged.

GPU Passthrough

This is an excellent writeup on the plex forums for GPU Passthrough in Proxmox.

https://forums.plex.tv/t/plex-hw-acceleration-in-lxc-container-anyone-with-success/219289/35

Again note this may not be completely necessary in a privileged container. My container does have cgroups and nvidia devices listed in the conf file.

lxc.cgroup.devices.allow: c 195:* rwm
lxc.cgroup.devices.allow: c 236:* rwm
lxc.mount.entry: /dev/nvidia0 dev/nvidia0 none bind,optional,create=file
lxc.mount.entry: /dev/nvidiactl dev/nvidiactl none bind,optional,create=file
lxc.mount.entry: /dev/nvidia-modeset dev/nvidia-modeset none bind,optional,create=file
lxc.mount.entry: /dev/nvidia-uvm dev/nvidia-uvm none bind,optional,create=file
lxc.mount.entry: /dev/nvidia-uvm-tools dev/nvidia-uvm-tools none bind,optional,create=file

In the container double check that all the nvidia devices exist after installing drivers.

ll /dev/nv*

CIFS Mounts

Because fuser is a kernel level process, containers need to be privileged to execute "mount" commands. I decided that this was an acceptable trade off for a plex server that is internal to my network.

The container needs to be privileged, and Nesting and CIFS enabled in the "Options" -> "Features" menu.

After the container is set up, we can create automount rules in the usual way.

apt install cifs-utils
apt install autofs
echo "/mnt/hostname /etc/auto.hostname --timeout 0" >> /etc/auto.master
echo "mountname -fstype=cifs,rw,guest ://192.168.1.X/mountname" >> /etc/auto.hostname
automount -v

Plex Install

It may be a good idea to create a non-root user for our plex container.

useradd -G sudo -m plex -s /bin/bash
passwd plex

Now we can use the unprivileged user to SSH to the container if needed.

At this point we can continue with the plex install, which is fairly well documented.
https://support.plex.tv/articles/200288586-installation/

On ubuntu this involves downloading the .deb installer and running apt on that file

apt install /home/user/Downloads/plexmediaserver_1.20....._amd64.deb

If migrating plex, there is a guide here:
https://support.plex.tv/articles/201370363-move-an-install-to-another-system/

No comments:

Post a Comment