Before we begin, I want to thank my colleague @juanlu13 for providing the [original source](https://forums.plex.tv/t/plex-hw-acceleration-in-lxc-container-anyone-with-success/219289/34?utm_source=pocket_mylist) on which this manual is based.
In this guide, we will install the Nvidia drivers, the persistent service, and an optional patch to remove the maximum encoding sessions limit.
- We will install Nvidia drivers on the Proxmox host.
- We will configure the drivers for use in any LXC.
To perform the installation, we must:
1. Blacklist the "nouveau" driver if we haven't already. If we have already done this, we can skip this step.
We can check it like this:
```
cat /etc/modprobe.d/blacklist.conf
```
The example image shows that "blacklist nouveau" is already added to the blacklist.
(*If we have installed the post-installation script from [tteck](https://tteck.github.io/Proxmox/) or [xshok](https://github.com/extremeshok/xshok-proxmox), we can skip this step as it's not necessary since these repositories are already added.*)
```
nano /etc/apt/sources.list
```
## Proxmox 7
```
deb http://ftp.debian.org/debian bullseye main contrib
deb http://ftp.debian.org/debian bullseye-updates main contrib
deb http://security.debian.org/debian-security bullseye-security main contrib
deb http://download.proxmox.com/debian/pve bullseye pve-no-subscription
```
## Proxmox 8
```
deb http://ftp.debian.org/debian bookworm main contrib
deb http://ftp.debian.org/debian bookworm-updates main contrib
deb http://security.debian.org/debian-security bookworm-security main contrib
deb http://deb.debian.org/debian bookworm main contrib non-free-firmware
deb http://deb.debian.org/debian bookworm-updates main contrib non-free-firmware
# security updates
deb http://security.debian.org/debian-security bookworm-security main contrib non-free-firmware
```
Update the packages and Proxmox
```
apt update && apt dist-upgrade -y
```
Before we start, let's install two packages we'll need, git and the kernel headers to install the drivers:
```
apt-get install git
```
```
apt-get install -qqy pve-headers-`uname -r` gcc make
```
## 1 - Install Nvidia drivers on the Proxmox host
### - Driver:
To begin, we need to know what the latest stable driver available is:*
(*If we're going to install the patch to bypass the maximum encoding limit, we need to make sure that patch is available for the driver version we're going to install.*) We can check it [here](https://github.com/keylase/nvidia-patch).
Now as an option, we patch the nvidia driver to remove the maximum encoding sessions. According to the developer, the NVENC patch removes the restriction on the maximum number of simultaneous NVENC video encoding sessions imposed by Nvidia on consumer-level GPUs.