Prepare host OS - Ubuntu
Install Ubuntu
Ubuntu 20.04 is supported. Use the server edition without GUI.
Disable nouveau driver
nouveau
, the open-source driver for Nvidia GPUs is usually pre-loaded. It must be disabled to install Nvidia's own driver.
sudo modprobe -r nouveau
Prevent loading of the nouveau
kernel module at boot.
echo "blacklist nouveau" | sudo tee /etc/modprobe.d/blacklist.conf
Install Nvidia driver
This installs Nvidia headless driver (without GUI support).
sudo apt-get update
sudo apt install nvidia-headless-535 nvidia-utils-535 libnvidia-encode-535
sudo modprobe nvidia
Check Nvidia driver works
nvidia-smi
Install Docker CE
Install Docker CE by executing command
curl https://get.docker.com | sh && sudo systemctl --now enable docker
Use docker
command without sudo
docker
command without sudoThis allows running the docker command as a non-root user.
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker
Adding NVidia docker repository to your Ubuntu system
Before installing NVIDIA Container Toolkit, you might need to add 'nividia-docker' repository to your system:
sudo curl -s -L https://nvidia.github.io/nvidia-docker/ubuntu22.04/nvidia-docker.list > /etc/apt/sources.list.d/nvidia-docker.list sudo curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | apt-key add - sudo apt update
Install NVIDIA Container Toolkit
Follow the official Nvidia docs
Make sure to copy and paste commands from NVIDIA's guide above rigorously.
Our tip - before executing the command, paste it into a temporary document first to ensure its integrity.
Test NVIDIA Container ToolKit
Best practice is to test run the NVIDIA CTK after installation:
sudo docker run --rm --runtime=nvidia --gpus all ubuntu nvidia-smi
You should get the following response:
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.161.07 Driver Version: 535.161.07 CUDA Version: 12.2 |
|-----------------------------------------+----------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+======================+======================|
| 0 NVIDIA RTX A2000 Off | 00000000:43:00.0 Off | Off |
| 30% 30C P8 4W / 70W | 3739MiB / 6138MiB | 0% Default |
| | | N/A |
+-----------------------------------------+----------------------+----------------------+
+---------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=======================================================================================|
+---------------------------------------------------------------------------------------+
If the response you get is the following then there is a problem with the Nvidia CTK compatibility:
Failed to initialize NVML: Unknown Error"
If this is the case you must downgrade the Nvidia CTK with the following procedure:
#remove all running containers
sudo docker stop transcoder0
sudo docker rm transcoder0
sudo docker ps
docker --version
# then remove current nvidia-ctk
sudo apt remove --purge nvidia-container-toolkit
sudo apt update
sudo apt autoremove
sudo systemctl restart docker
# then list available CTKs
apt list -a "*nvidia-container-toolkit*"
# align with version on AWS, and check the version is truly installed
sudo apt install nvidia-container-toolkit=1.13.5-1 nvidia-container-toolkit-base=1.13.5-1
nvidia-ctk --version
# configure NVIDIA CTK Docker runtime
sudo nvidia-ctk runtime configure --runtime=docker
sudo systemctl restart docker
# test run
sudo docker run --rm --runtime=nvidia --gpus all ubuntu nvidia-smi
Setting up docker-compose
Docker is installed, but docker-compose is also needed. Let's install it by following these steps.
sudo curl -L https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
Check docker-compose works
You can check the docker-compose installation by running this command which should give you a meaningful output with the version number:
docker-compose version
Adjust firewall rules
Live Transcoder needs some firewall ports opened to work properly. Either open them by:
sudo ufw allow 22/tcp comment 'accept SSH'
sudo ufw allow 80/tcp comment 'accept HTTP & HLS'
sudo ufw allow 443/tcp comment 'accept HTTPS & HLS'
sudo ufw allow 5353:7999/tcp comment 'accept NDI TCP'
sudo ufw allow 5353:7999/udp comment 'accept NDI UDP'
sudo ufw allow 1024:65535/udp comment 'accept MPEG-TS UDP/RTP/SRT'
sudo ufw allow 1935/tcp comment 'accept RTMP inputs'
sudo ufw allow from 192.168.0.0/24 to 224.0.0.0/24 proto igmp comment 'accept IGMP'
sudo ufw enable
sudo ufw status
or disable the firewall completely by these. Disabling the firewall completely can improve performance in high-bitrate use cases.
sudo ufw disable
sudo ufw status
Disable mDNS on the host
The mDNS service mustn't be active in the host OS for NDI discovery to work. To remove it completely from the host OS:
sudo apt-get remove avahi-daemon
Increase max UDP kernel buffer size
To receive and send streams with high-bitrate codecs (e.g., JPEG2000 or JPEG-XS), Live Transcoder needs to increase the UDP kernel buffer size. However, the default maximum size is too low so it needs to be increased.
SYSCTL_CONF="/etc/sysctl.d/10-udp-buffer-size.conf"
sudo sh -c "echo '#kernel send a receive windows buffer sizes' > $SYSCTL_CONF"
sudo sh -c "echo 'net.core.rmem_max=262144000' >> $SYSCTL_CONF"
sudo sh -c "echo 'net.core.wmem_max=262144000' >> $SYSCTL_CONF"
sudo sh -c "echo 'net.core.rmem_default=262144000' >> $SYSCTL_CONF"
sudo sh -c "echo 'net.core.wmem_default=262144000' >> $SYSCTL_CONF"
sudo sh -c "echo '' >> $SYSCTL_CONF"
Now load the updated config file.
sudo sysctl -p $SYSCTL_CONF
Install systemd-coredump
It's needed for the creation of diagnostic packages when something goes wrong.
sudo apt install systemd-coredump
Updated 9 months ago