Install NVIDIA GPU drivers on N-Series VMs running Linux

Install NVIDIA GPU drivers on N-Series VMs running Linux

NVIDIA GPU Driver for Linux N-Series VMs

Requirements

  1. Domain Allowlisting:
    1. microsoft.com
    2. developer.download.nvidia.com
    3. archive.ubuntu.com
  2. N-series VM running Ubuntu20 or Ubuntu22.
  3. GCC C-compiler installed on the Linux VM.
    After installing the NVIDIA driver, these domains can be removed from the allowlist.

    There are two possibilities for installing the drivers, either through the VM itself, or through the Azure portal. The latter can only be performed by a Support Team member.

    1. Installation instructions for VM type NC4as_T4_v3

    If the GCC C-compiler is not already installed, you can do this by doing the following. Note that this works the same for both Ubuntu 20 and Ubuntu 22.
    1. sudo apt update
    2. sudo apt install build-essential
    To verify if this was success, run the following command:
    1. gcc --version
    Assuming the installation of GCC was successful, you can proceed to the installation steps for either Ubuntu 20 or 22 as described below.

    Ubuntu 20
    1. wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-keyring_1.1-1_all.deb
    2. sudo dpkg -i cuda-keyring_1.1-1_all.deb
    3. sudo apt-get update
    4. sudo apt-get -y install cuda

    Ubuntu 22
    1. wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb
    2. sudo dpkg -i cuda-keyring_1.1-1_all.deb
    3. sudo apt-get update
    4. sudo apt-get -y install cuda

    For different OS, Architecture, Distribution and Version check out this Link

    Verify driver installation

    1. nvidia-smi
    2. sudo lshw  -c display

    CUDA driver updates

    We recommend that you periodically update CUDA drivers after deployment.
    1. sudo apt-get update
    2. sudo apt-get upgrade -y
    3. sudo apt-get dist-upgrade -y
    4. sudo apt-get install cuda-drivers
    5. sudo reboot
    For more information, visit this Microsoft website.

    2. Alternative installation through the Azure portal

    The VM needs to be allocated when installing extensions! These installation steps can only be performed by a Support Team member.

    1. Navigate to the VM in the Azure portal.

    2. Go to Settings > Extensions + Applications

    3. Press + Add

    4. Search for ‘NVIDIA’. The ‘NVIDIA GPU Driver Extension’ should appear. Select this option.

    5. Press Review + Create > Create. The extensions will be installed onto the VM. This might take a few minutes.