Here's a summary of the steps to configure an NVIDIA GPU in an Ubuntu VM running on VMware ESXi:
-
Disable the Nouveau kernel driver:
sudo nano /etc/modprobe.d/blacklist-nouveau.conf
Add the following lines:
blacklist nouveau options nouveau modeset=0
Update the initramfs and reboot:
sudo update-initramfs -u sudo reboot
-
Remove the Intel Microcode package:
sudo dpkg -l | grep intel sudo apt purge intel-microcode sudo update-grub sudo shutdown -h 0
-
Add
hypervisor.cpuid.v0=FALSE
to the VM Configuration Parameters (VM options ➝ Advanced ➝ Configuration Parameters). -
Update Ubuntu and install required packages:
sudo apt update sudo apt install gcc make build-essential libglvnd-dev pkg-config
-
Download the appropriate NVIDIA driver for your GPU from the NVIDIA website.
-
Stop the X server and switch to a text console:
sudo service lightdm stop sudo init 3
-
Make the NVIDIA driver installer executable and run it with the
-m=kernel-open
parameter:chmod +x file_name.run sudo su ./file_name.run -m=kernel-open
Choose the default options during the installation.
-
Check for the existence of the
nvidia.conf
file in/etc/modprobe.d/
. If it doesn't exist, create it and add the following line:To create and edit the file, use:
sudo nano /etc/modprobe.d/nvidia.conf
options nvidia NVreg_OpenRmEnableUnsupportedGpus=1
-
Reboot the virtual machine.
-
Check the GPU status and driver version using
nvidia-smi
.
This process should enable the NVIDIA GPU in your Ubuntu VM running on VMware ESXi.
Optional
- Setup CUDA
wget https://developer.download.nvidia.com/compute/cuda/11.7.0/local_installers/cuda_11.7.0_515.43.04_linux.run
sudo sh cuda_11.7.0_515.43.04_linux.run
- Add cuda path
nano ~/.bashrc
export PATH=/usr/local/cuda/bin${PATH:+:${PATH}}$
export LD_LIBRARY_PATH=/usr/local/cuda/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
- install cudnn
tar -xvf cudnn-11.0-linux-x64-v8.0.5.39.tg
sudo cp cuda/include/cudnn*.h /usr/local/cuda/include
sudo cp -P cuda/lib64/libcudnn* /usr/local/cuda/lib64
sudo chmod a+r /usr/local/cuda/include/cudnn*.h /usr/local/cuda/lib64/libcudnn*
check installation
nvcc --version
- Install nvdia-docker
sudo apt-get update \ && sudo apt-get install -y nvidia-container-toolkit-base