1093 字
5 分钟

Install NVIDIA GPU Drivers on Ubuntu 22.04

Based on Ubuntu 22.04

Prerequisites#

Hardware check

Verify that your system has a compatible NVIDIA GPU. If you do not know the exact GPU model in your system, run the following command:

Copy

Terminal window
lspci -v | egrep "NVIDIA"

This command should output one line for each installed NVIDIA GPU. Check whether your hardware is compatible on our Hardware Requirements page. Note that you can still install the CPU version of HEAVY.AI on machines without an NVIDIA GPU.

System update before installation

Upgrade the system and kernel, then reboot if needed.

Copy

Terminal window
sudo apt update

Copy

Terminal window
sudo apt upgrade -y
sudo reboot

Install kernel headers#

Install kernel headers and development packages.

Copy

Terminal window
sudo apt install linux-headers-$(uname -r)

Install additional packages.

Copy

Terminal window
sudo apt install pciutils

Install Vulkan libraries#

The HEAVY.AI rendering engine (available in the Enterprise Edition) requires drivers that support Vulkan and the Vulkan libraries. Without these components, the database itself might fail to start.

Use apt to install the Vulkan libraries and their dependencies.

Copy

Terminal window
sudo apt install libvulkan1

For more information on Vulkan troubleshooting, see the Vulkan Renderer section.

Install NVIDIA drivers#

Run this command to get a list of available driver versions:

Terminal window
apt list nvidia-driver-*

image.png

Use apt to install the desired driver version.

Copy

Terminal window
sudo apt install nvidia-driver-<version>

Post-install steps for NVIDIA drivers#

Reboot the system to ensure the new driver version is loaded.

Copy

Terminal window
sudo reboot

Verify that NVIDIA drivers are installed correctly#

Run nvidia-smi to verify that your drivers are installed correctly and that the GPUs in your environment are detected. Depending on your environment, you should see output similar to the following, confirming that your NVIDIA GPU and drivers are present.

image.png

Install Vulkan libraries#

The HEAVY.AI rendering engine requires drivers that support Vulkan and the Vulkan libraries. Without these components, the database itself cannot even start unless the backend renderer is disabled.

Use apt to install the Vulkan libraries and their dependencies.

Copy

Terminal window
sudo apt install libvulkan1

For more information on Vulkan troubleshooting, see the Vulkan Renderer section.

Install CUDA Toolkit#

If you installed the NVIDIA drivers using Option 1 above, the CUDA Toolkit is already installed; you can skip directly to the verification steps below.

Install the NVIDIA public repository GPG key.

Copy

Terminal window
distribution=$(. /etc/os-release;echo $ID$VERSION_ID | sed -e 's/\.//g')
sudo apt-key adv --fetch-keys \
https://developer.download.nvidia.com/compute/cuda/repos/$distribution/x86_64/3bf863cc.pub

Add the repository.

Copy

Terminal window
echo "deb http://developer.download.nvidia.com/compute/cuda/repos/$distribution/x86_64 /" \
| sudo tee /etc/apt/sources.list.d/cuda.list
apt update

List available CUDA Toolkit versions.

Terminal window
root@VM-8-208-ubuntu:~# apt list cuda-toolkit-* | grep -v config
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
Listing...
cuda-toolkit-11-7/unknown 11.7.1-1 amd64
cuda-toolkit-11-8/unknown 11.8.0-1 amd64
cuda-toolkit-12-0/unknown 12.0.1-1 amd64
cuda-toolkit-12-1/unknown 12.1.1-1 amd64
cuda-toolkit-12-2/unknown 12.2.2-1 amd64
cuda-toolkit-12-3/unknown 12.3.2-1 amd64
cuda-toolkit-12-4/unknown 12.4.1-1 amd64
cuda-toolkit-12-5/unknown 12.5.1-1 amd64
cuda-toolkit-12-6/unknown 12.6.3-1 amd64
cuda-toolkit-12/unknown 12.6.3-1 amd64

Use apt to install the CUDA Toolkit.

Copy

sudo apt install cuda-toolkit-<version>

Verification#

Check that everything is working properly and that the toolkit has been installed.

Copy

Terminal window
/usr/local/cuda/bin/nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2020 NVIDIA Corporation
Built on Mon_Nov_30_19:08:53_PST_2020
Cuda compilation tools, release 11.2, V11.2.67
Build cuda_11.2.r11.2/compiler.29373293_0
Terminal window
root@VM-8-208-ubuntu:~# echo 'export PATH=/usr/local/cuda/bin:$PATH' >> ~/.bashrc
root@VM-8-208-ubuntu:~# echo 'export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc
root@VM-8-208-ubuntu:~# source ~/.bashrc
root@VM-8-208-ubuntu:~# nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2024 NVIDIA Corporation
Built on Tue_Oct_29_23:50:19_PDT_2024
Cuda compilation tools, release 12.6, V12.6.85
Build cuda_12.6.r12.6/compiler.35059454_0

Install Clang#

If you use advanced features such as C++ user-defined functions and/or user-defined table functions to extend database functionality, you must install Clang. Use apt to install Clang and its LLVM dependencies.

Copy

Terminal window
sudo apt install clang

Verification#

Verify that the software is installed and available on the execution path.

Copy

Terminal window
root@VM-8-208-ubuntu:~# clang --version
Ubuntu clang version 14.0.0-1ubuntu1.1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

Install Docker#

Terminal window
apt install curl vim wget gnupg dpkg apt-transport-https lsb-release ca-certificates
curl -sS https://download.docker.com/linux/debian/gpg | gpg --dearmor > /usr/share/keyrings/docker-ce.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-ce.gpg] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu $(lsb_release -sc) stable" > /etc/apt/sources.list.d/docker.list
apt update && apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin
Terminal window
root@catcat:~# cat /etc/docker/daemon.json
{
"log-driver": "json-file",
"log-opts": {
"max-size": "20m",
"max-file": "3"
},
"experimental":true,
"data-root": "/root/docker_data",
"registry-mirrors": ["https://docker.1ms.run" ]
}
systemctl restart docker

Install GPU-Docker components#

Terminal window
Install gpu-docekr
apt-get install -y nvidia-docker2
nvidia-ctk runtime configure --runtime=docker
This modifies the daemon.json file to add the container runtime
root@VM-8-208-ubuntu:~# nvidia-ctk runtime configure --runtime=docker
INFO[0000] Loading config from /etc/docker/daemon.json
INFO[0000] Wrote updated config to /etc/docker/daemon.json
INFO[0000] It is recommended that docker daemon be restarted.
Terminal window
root@VM-8-208-ubuntu:~# cat /etc/docker/daemon.json
{
"data-root": "/root/docker_data",
"experimental": true,
"log-driver": "json-file",
"log-opts": {
"max-file": "3",
"max-size": "20m"
},
"registry-mirrors": [
"https://docker.1ms.run"
],
"runtimes": {
"nvidia": {
"args": [],
"path": "nvidia-container-runtime"
}
}
}

Verify the installation#

Terminal window
root@VM-8-208-ubuntu:~# systemctl restart docker
root@VM-8-208-ubuntu:~# docker run --rm -it --gpus all ubuntu:22.04 /bin/bash
root@cad0abb4936b:/# nvidia-smi
Tue Aug 1 00:57:29 2023
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 520.61.05 Driver Version: 520.61.05 CUDA Version: 11.8 |
|-------------------------------+----------------------+----------------------|
| 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 GeForce ... Off | 00000000:01:00.0 On | N/A |
| 0% 51C P8 21W / 160W | 528MiB / 6144MiB | 29% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
+-----------------------------------------------------------------------------+
root@cad0abb4936b:/#
Terminal window
root@l4d2-forward:~/TeamSpeak# docker logs teamspeak-teamspeak-1
2024-12-12 05:48:10.030543|INFO |ServerLibPriv | |TeamSpeak 3 Server 3.13.7 (2022-06-20 12:21:53)
2024-12-12 05:48:10.030628|INFO |ServerLibPriv | |SystemInformation: Linux 5.10.0-30-amd64 #1 SMP Debian 5.10.218-1 (2024-06-01) x86_64 Binary: 64bit
2024-12-12 05:48:10.030651|INFO |ServerLibPriv | |Using hardware aes
2024-12-12 05:48:10.030986|INFO |DatabaseQuery | |dbPlugin name: MariaDB plugin, version 3, (c)TeamSpeak Systems GmbH
2024-12-12 05:48:10.031040|INFO |DatabaseQuery | |dbPlugin version: 2
2024-12-12 05:48:18.453775|INFO |SQL | |db_CreateTables() tables created
------------------------------------------------------------------
I M P O R T A N T
------------------------------------------------------------------
Server Query Admin Account created
loginname= "serveradmin", password= "zKqn6Y0j"
apikey= "BAAUOSo-F8ADMyaE9BqtVukv89P60wlNvFykSGq"
------------------------------------------------------------------
2024-12-12 05:48:18.515954|WARNING |Accounting | |Unable to open licensekey.dat, falling back to limited functionality
2024-12-12 05:48:18.524291|INFO |Accounting | |Licensing Information
2024-12-12 05:48:18.524324|INFO |Accounting | |licensed to : Anonymous
2024-12-12 05:48:18.524344|INFO |Accounting | |type : No License
2024-12-12 05:48:18.524363|INFO |Accounting | |starting date : Tue Feb 1 00:00:00 2022
2024-12-12 05:48:18.524380|INFO |Accounting | |ending date : Thu Jul 1 00:00:00 2027
2024-12-12 05:48:18.524392|INFO |Accounting | |max virtualservers: 1
2024-12-12 05:48:18.524403|INFO |Accounting | |max slots : 32
2024-12-12 05:48:19.071662|INFO | | |Puzzle precompute time: 530
2024-12-12 05:48:19.072464|INFO |FileManager | |listening on 0.0.0.0:30033, [::]:30033
2024-12-12 05:48:19.077083|INFO |VirtualSvrMgr | |executing monthly interval
2024-12-12 05:48:19.077549|INFO |VirtualSvrMgr | |reset virtualserver traffic statistics
2024-12-12 05:48:19.084343|INFO |Query | |Using a query thread pool size of 2
2024-12-12 05:48:19.130955|INFO |VirtualServerBase|1 |listening on 0.0.0.0:9987, [::]:9987
2024-12-12 05:48:19.135106|WARNING |VirtualServer |1 |--------------------------------------------------------
2024-12-12 05:48:19.135139|WARNING |VirtualServer |1 |ServerAdmin privilege key created, please use the line below
2024-12-12 05:48:19.135158|WARNING |VirtualServer |1 |token=BK2xL7Bm4Q2NEq4hsYYUJm4N1pVFuyZn6s33Jr6x
2024-12-12 05:48:19.135173|WARNING |VirtualServer |1 |--------------------------------------------------------
------------------------------------------------------------------
I M P O R T A N T
------------------------------------------------------------------
ServerAdmin privilege key created, please use it to gain
serveradmin rights for your virtualserver. please
also check the doc/privilegekey_guide.txt for details.
token=BK2xL7Bm4Q2NEq4hsYYUJm4N1pVFuyZn6s33Jr6x
------------------------------------------------------------------
2024-12-12 05:48:19.135520|INFO |Query | |listening for query on 0.0.0.0:10011, [::]:10011
2024-12-12 05:48:19.135711|INFO |CIDRManager | |updated query_ip_allowlist ips: 127.0.0.1/32, ::1/128,
root@l4d2-forward:~/TeamSpeak#
Install NVIDIA GPU Drivers on Ubuntu 22.04
https://catcat.blog/en/2025/12/install-nvidia-gpu-drive.html
作者
猫猫博客
发布于
2025-12-01
许可协议
CC BY-NC-SA 4.0