Install NVIDIA drivers on Linux instances - Amazon Elastic Compute Cloud
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China.

Install NVIDIA drivers on Linux instances

An instance with an attached NVIDIA GPU, such as a P3 or G4dn instance, must have the appropriate NVIDIA driver installed. Depending on the instance type, you can either download a public NVIDIA driver, download a driver from Amazon S3 that is available only to Amazon customers, or use an AMI with the driver pre-installed.

To install AMD drivers on a Linux instance with an attached AMD GPU, such as a G4ad instance, see Install AMD drivers instead. To install NVIDIA drivers on a Windows instance, see Install NVIDIA drivers on Windows instances.

Types of NVIDIA drivers

The following are the main types of NVIDIA drivers that can be used with GPU-based instances.

Tesla drivers

These drivers are intended primarily for compute workloads, which use GPUs for computational tasks such as parallelized floating-point calculations for machine learning and fast Fourier transforms for high performance computing applications.

GRID drivers

These drivers are certified to provide optimal performance for professional visualization applications that render content such as 3D models or high-resolution videos. You can configure GRID drivers to support two modes. Quadro Virtual Workstations provide access to four 4K displays per GPU. GRID vApps provide RDSH App hosting capabilities.

Gaming drivers

These drivers contain optimizations for gaming and are updated frequently to provide performance enhancements. They support a single 4K display per GPU.

NVIDIA control panel

The NVIDIA control panel is supported with GRID and Gaming drivers. It is not supported with Tesla drivers.

Supported APIs for Tesla, GRID, and gaming drivers

  • OpenCL, OpenGL, and Vulkan

  • NVIDIA CUDA and related libraries (for example, cuDNN, TensorRT, nvJPEG, and cuBLAS)

  • NVENC for video encoding and NVDEC for video decoding

Available drivers by instance type

The following table summarizes the supported NVIDIA drivers for each GPU instance type.

Instance type Tesla driver GRID driver Gaming driver
G2 Yes No No
G3 Yes Yes No
G4dn Yes Yes Yes
G5 Yes Yes Yes
G5g Yes ¹ No No
P2 Yes No No
P3 Yes Yes ² No
P4d Yes No No
P4de Yes No No

¹ This Tesla driver also supports optimized graphics applications specific to the ARM64 platform

² Using Marketplace AMIs only

Installation options

Use one of the following options to get the NVIDIA drivers required for your GPU instance.

Amazon and NVIDIA offer different Amazon Machine Images (AMI) that come with the NVIDIA drivers installed.

To update the driver version installed using one of these AMIs, you must uninstall the NVIDIA packages from your instance to avoid version conflicts. Use this command to uninstall the NVIDIA packages:

[ec2-user ~]$ sudo yum erase nvidia cuda

The CUDA toolkit package has dependencies on the NVIDIA drivers. Uninstalling the NVIDIA packages erases the CUDA toolkit. You must reinstall the CUDA toolkit after installing the NVIDIA driver.

The options offered by Amazon come with the necessary license for the driver. Alternatively, you can install the public drivers and bring your own license. To install a public driver, download it from the NVIDIA site as described here.

Alternatively, you can use the options offered by Amazon instead of the public drivers. To use a GRID driver on a P3 instance, use the Amazon Web Services Marketplace AMIs as described in Option 1. To use a GRID driver on a G5, G4dn, or G3 instance, use the Amazon Web Services Marketplace AMIs, as described in Option 1 or install the NVIDIA drivers provided by Amazon as described in Option 3.

To download a public NVIDIA driver

Log on to your Linux instance and download the 64-bit NVIDIA driver appropriate for the instance type from http://www.nvidia.com/Download/Find.aspx. For Product Type, Product Series, and Product, use the options in the following table.

Instance Product Type Product Series Product
G2 GRID GRID Series GRID K520
G3 Tesla M-Class M60
G4dn Tesla T-Series T4
G5 ¹ Tesla A-Series A10
G5g ² Tesla T-Series NVIDIA T4G
P2 Tesla K-Series K80
P3 Tesla V-Series V100
P4d Tesla A-Series A100
P4de Tesla A-Series A100

¹ G5 instances require driver version 470.00 or later

² G5g instances require driver version 470.82.01 or later. The operating systems is Linux aarch64

To install the NVIDIA driver on Linux

For more information about installing and configuring the driver, see the NVIDIA Driver Installation Quickstart Guide.

These downloads are available to Amazon customers only. By downloading, in order to adhere to requirements of the Amazon solution referred to in the NVIDIA GRID Cloud End User License Agreement (EULA), you agree to use the downloaded software only to develop AMIs for use with the NVIDIA A10G, NVIDIA Tesla T4, or NVIDIA Tesla M60 hardware. Upon installation of the software, you are bound by the terms of the NVIDIA GRID Cloud End User License Agreement.

Prerequisites

  • Install the Amazon CLI on your Linux instance and configure default credentials. For more information, see Installing the Amazon CLI in the Amazon Command Line Interface User Guide.

  • IAM users must have the permissions granted by the AmazonS3ReadOnlyAccess policy. For more information, see Amazon managed policy: AmazonS3ReadOnlyAccess in the Amazon Simple Storage Service User Guide.

  • G5 instances require GRID 13.1 or later (or GRID 12.4 or later).

  • G3 instances require Amazon provided DNS resolution for GRID licensing to work.

  • IMDSv2 is only supported with NVIDIA driver version 14.0 or greater.

To install the NVIDIA GRID driver on your instance

  1. Connect to your Linux instance. Install gcc and make, if they are not already installed.

  2. Update your package cache and get the package updates for your instance.

    [ec2-user ~]$ sudo yum update -y
  3. Reboot your instance to load the latest kernel version.

    [ec2-user ~]$ sudo reboot
  4. Reconnect to your instance after it has rebooted.

  5. Install the gcc compiler and the kernel headers package for the version of the kernel you are currently running.

    [ec2-user ~]$ sudo yum install -y gcc kernel-devel-$(uname -r)
  6. Download the GRID driver installation utility using the following command:

    [ec2-user ~]$ aws s3 cp --recursive s3://ec2-linux-nvidia-drivers/latest/ . --region us-east-1 --no-sign-request

    Multiple versions of the GRID driver are stored in this bucket. You can see all of the available versions using the following command.

    [ec2-user ~]$ aws s3 ls --recursive s3://ec2-linux-nvidia-drivers/ --region us-east-1 --no-sign-request
  7. Add permissions to run the driver installation utility using the following command.

    [ec2-user ~]$ chmod +x NVIDIA-Linux-x86_64*.run
  8. Run the self-install script as follows to install the GRID driver that you downloaded. For example:

    [ec2-user ~]$ sudo /bin/sh ./NVIDIA-Linux-x86_64*.run
    Note

    If you are using Amazon Linux 2 with kernel version 5.10, use the following command to install the GRID driver.

    [ec2-user ~]$ sudo CC=/usr/bin/gcc10-cc ./NVIDIA-Linux-x86_64*.run

    When prompted, accept the license agreement and specify the installation options as required (you can accept the default options).

  9. Reboot the instance.

    [ec2-user ~]$ sudo reboot
  10. Confirm that the driver is functional. The response for the following command lists the installed version of the NVIDIA driver and details about the GPUs.

    [ec2-user ~]$ nvidia-smi -q | head
  11. If you are using NVIDIA driver version 14.x or greater on the G4dn or G5g instances, disable GSP with the following commands. For more information, on why this is required visit NVIDIA’s documentation.

    sudo touch /etc/modprobe.d/nvidia.conf
    echo "options nvidia NVreg_EnableGpuFirmware=0" | sudo tee --append /etc/modprobe.d/nvidia.conf
  12. (Optional) Depending on your use case, you might complete the following optional steps. If you do not require this functionality, do not complete these steps.

    1. To help take advantage of the four displays of up to 4K resolution, set up the high-performance display protocol NICE DCV.

    2. NVIDIA Quadro Virtual Workstation mode is enabled by default. To activate GRID Virtual Applications for RDSH Application hosting capabilities, complete the GRID Virtual Application activation steps in Activate NVIDIA GRID Virtual Applications.

To install the NVIDIA GRID driver on your instance

  1. Connect to your Linux instance. Install gcc and make, if they are not already installed.

  2. Update your package cache and get the package updates for your instance.

    [ec2-user ~]$ sudo yum update -y
  3. Reboot your instance to load the latest kernel version.

    [ec2-user ~]$ sudo reboot
  4. Reconnect to your instance after it has rebooted.

  5. Install the gcc compiler and the kernel headers package for the version of the kernel you are currently running.

    [ec2-user ~]$ sudo yum install -y gcc kernel-devel-$(uname -r)
  6. Disable the nouveau open source driver for NVIDIA graphics cards.

    1. Add nouveau to the /etc/modprobe.d/blacklist.conf blacklist file. Copy the following code block and paste it into a terminal.

      [ec2-user ~]$ cat << EOF | sudo tee --append /etc/modprobe.d/blacklist.conf blacklist vga16fb blacklist nouveau blacklist rivafb blacklist nvidiafb blacklist rivatv EOF
    2. Edit the /etc/default/grub file and add the following line:

      GRUB_CMDLINE_LINUX="rdblacklist=nouveau"
    3. Rebuild the Grub configuration.

      [ec2-user ~]$ sudo grub2-mkconfig -o /boot/grub2/grub.cfg
  7. Download the GRID driver installation utility using the following command:

    [ec2-user ~]$ aws s3 cp --recursive s3://ec2-linux-nvidia-drivers/latest/ . --region us-east-1 --no-sign-request

    Multiple versions of the GRID driver are stored in this bucket. You can see all of the available versions using the following command.

    [ec2-user ~]$ aws s3 ls --recursive s3://ec2-linux-nvidia-drivers/ --region us-east-1 --no-sign-request
  8. Add permissions to run the driver installation utility using the following command.

    [ec2-user ~]$ chmod +x NVIDIA-Linux-x86_64*.run
  9. Run the self-install script as follows to install the GRID driver that you downloaded. For example:

    [ec2-user ~]$ sudo /bin/sh ./NVIDIA-Linux-x86_64*.run

    When prompted, accept the license agreement and specify the installation options as required (you can accept the default options).

  10. Reboot the instance.

    [ec2-user ~]$ sudo reboot
  11. Confirm that the driver is functional. The response for the following command lists the installed version of the NVIDIA driver and details about the GPUs.

    [ec2-user ~]$ nvidia-smi -q | head
  12. If you are using NVIDIA driver version 14.x or greater on the G4dn or G5g instances, disable GSP with the following commands. For more information, on why this is required visit NVIDIA’s documentation.

    sudo touch /etc/modprobe.d/nvidia.conf
    echo "options nvidia NVreg_EnableGpuFirmware=0" | sudo tee --append /etc/modprobe.d/nvidia.conf
  13. (Optional) Depending on your use case, you might complete the following optional steps. If you do not require this functionality, do not complete these steps.

    1. To help take advantage of the four displays of up to 4K resolution, set up the high-performance display protocol NICE DCV.

    2. NVIDIA Quadro Virtual Workstation mode is enabled by default. To activate GRID Virtual Applications for RDSH Application hosting capabilities, complete the GRID Virtual Application activation steps in Activate NVIDIA GRID Virtual Applications.

    3. Install the GUI desktop/workstation package.

      [ec2-user ~]$ sudo yum groupinstall -y "Server with GUI"

To install the NVIDIA GRID driver on your instance

  1. Connect to your Linux instance. Install gcc and make, if they are not already installed.

  2. Update your package cache and get the package updates for your instance.

    [ec2-user ~]$ sudo yum update -y
  3. Reboot your instance to load the latest kernel version.

    [ec2-user ~]$ sudo reboot
  4. Reconnect to your instance after it has rebooted.

  5. Install the gcc compiler and the kernel headers package for the version of the kernel you are currently running.

    [ec2-user ~]$ sudo dnf install -y make gcc elfutils-libelf-devel libglvnd-devel kernel-devel-$(uname -r)
  6. Download the GRID driver installation utility using the following command:

    [ec2-user ~]$ aws s3 cp --recursive s3://ec2-linux-nvidia-drivers/latest/ . --region us-east-1 --no-sign-request

    Multiple versions of the GRID driver are stored in this bucket. You can see all of the available versions using the following command.

    [ec2-user ~]$ aws s3 ls --recursive s3://ec2-linux-nvidia-drivers/ --region us-east-1 --no-sign-request
  7. Add permissions to run the driver installation utility using the following command.

    [ec2-user ~]$ chmod +x NVIDIA-Linux-x86_64*.run
  8. Run the self-install script as follows to install the GRID driver that you downloaded. For example:

    [ec2-user ~]$ sudo /bin/sh ./NVIDIA-Linux-x86_64*.run

    When prompted, accept the license agreement and specify the installation options as required (you can accept the default options).

  9. Reboot the instance.

    [ec2-user ~]$ sudo reboot
  10. Confirm that the driver is functional. The response for the following command lists the installed version of the NVIDIA driver and details about the GPUs.

    [ec2-user ~]$ nvidia-smi -q | head
  11. If you are using NVIDIA driver version 14.x or greater on the G4dn or G5g instances, disable GSP with the following commands. For more information, on why this is required visit NVIDIA’s documentation.

    sudo touch /etc/modprobe.d/nvidia.conf
    echo "options nvidia NVreg_EnableGpuFirmware=0" | sudo tee --append /etc/modprobe.d/nvidia.conf
  12. (Optional) Depending on your use case, you might complete the following optional steps. If you do not require this functionality, do not complete these steps.

    1. To help take advantage of the four displays of up to 4K resolution, set up the high-performance display protocol NICE DCV.

    2. NVIDIA Quadro Virtual Workstation mode is enabled by default. To activate GRID Virtual Applications for RDSH Application hosting capabilities, complete the GRID Virtual Application activation steps in Activate NVIDIA GRID Virtual Applications.

    3. Install the GUI workstation package.

      [ec2-user ~]$ sudo dnf groupinstall -y workstation

To install the NVIDIA GRID driver on your Linux instance

  1. Connect to your Linux instance. Install gcc and make, if they are not already installed.

  2. Update your package cache and get the package updates for your instance.

    [ec2-user ~]$ sudo yum update -y
  3. Reboot your instance to load the latest kernel version.

    [ec2-user ~]$ sudo reboot
  4. Reconnect to your instance after it has rebooted.

  5. Install the gcc compiler and the kernel headers package for the version of the kernel you are currently running.

    [ec2-user ~]$ sudo dnf install -y make gcc elfutils-libelf-devel libglvnd-devel kernel-devel-$(uname -r)
  6. Download the GRID driver installation utility using the following command:

    [ec2-user ~]$ aws s3 cp --recursive s3://ec2-linux-nvidia-drivers/latest/ . --region us-east-1 --no-sign-request

    Multiple versions of the GRID driver are stored in this bucket. You can see all of the available versions using the following command.

    [ec2-user ~]$ aws s3 ls --recursive s3://ec2-linux-nvidia-drivers/ --region us-east-1 --no-sign-request
  7. Add permissions to run the driver installation utility using the following command.

    [ec2-user ~]$ chmod +x NVIDIA-Linux-x86_64*.run
  8. Run the self-install script as follows to install the GRID driver that you downloaded. For example:

    [ec2-user ~]$ sudo /bin/sh ./NVIDIA-Linux-x86_64*.run

    When prompted, accept the license agreement and specify the installation options as required (you can accept the default options).

  9. Reboot the instance.

    [ec2-user ~]$ sudo reboot
  10. Confirm that the driver is functional. The response for the following command lists the installed version of the NVIDIA driver and details about the GPUs.

    [ec2-user ~]$ nvidia-smi -q | head
  11. If you are using NVIDIA driver version 14.x or greater on the G4dn or G5g instances, disable GSP with the following commands. For more information, on why this is required visit NVIDIA’s documentation.

    sudo touch /etc/modprobe.d/nvidia.conf
    echo "options nvidia NVreg_EnableGpuFirmware=0" | sudo tee --append /etc/modprobe.d/nvidia.conf
  12. (Optional) Depending on your use case, you might complete the following optional steps. If you do not require this functionality, do not complete these steps.

    1. To help take advantage of the four displays of up to 4K resolution, set up the high-performance display protocol NICE DCV.

    2. NVIDIA Quadro Virtual Workstation mode is enabled by default. To activate GRID Virtual Applications for RDSH Application hosting capabilities, complete the GRID Virtual Application activation steps in Activate NVIDIA GRID Virtual Applications.

To install the NVIDIA GRID driver on your instance

  1. Connect to your Linux instance. Install gcc and make, if they are not already installed.

  2. Update your package cache and get the package updates for your instance.

    $ sudo apt-get update -y
  3. Upgrade the linux-aws package to receive the latest version.

    $ sudo apt-get upgrade -y linux-aws
  4. Reboot your instance to load the latest kernel version.

    [ec2-user ~]$ sudo reboot
  5. Reconnect to your instance after it has rebooted.

  6. Install the gcc compiler and the kernel headers package for the version of the kernel you are currently running.

    $ sudo apt-get install -y gcc make linux-headers-$(uname -r)
  7. Disable the nouveau open source driver for NVIDIA graphics cards.

    1. Add nouveau to the /etc/modprobe.d/blacklist.conf blacklist file. Copy the following code block and paste it into a terminal.

      [ec2-user ~]$ cat << EOF | sudo tee --append /etc/modprobe.d/blacklist.conf blacklist vga16fb blacklist nouveau blacklist rivafb blacklist nvidiafb blacklist rivatv EOF
    2. Edit the /etc/default/grub file and add the following line:

      GRUB_CMDLINE_LINUX="rdblacklist=nouveau"
    3. Rebuild the Grub configuration.

      $ sudo update-grub
  8. Download the GRID driver installation utility using the following command:

    [ec2-user ~]$ aws s3 cp --recursive s3://ec2-linux-nvidia-drivers/latest/ . --region us-east-1 --no-sign-request

    Multiple versions of the GRID driver are stored in this bucket. You can see all of the available versions using the following command.

    [ec2-user ~]$ aws s3 ls --recursive s3://ec2-linux-nvidia-drivers/ --region us-east-1 --no-sign-request
  9. Add permissions to run the driver installation utility using the following command.

    [ec2-user ~]$ chmod +x NVIDIA-Linux-x86_64*.run
  10. Run the self-install script as follows to install the GRID driver that you downloaded. For example:

    [ec2-user ~]$ sudo /bin/sh ./NVIDIA-Linux-x86_64*.run

    When prompted, accept the license agreement and specify the installation options as required (you can accept the default options).

  11. Reboot the instance.

    [ec2-user ~]$ sudo reboot
  12. Confirm that the driver is functional. The response for the following command lists the installed version of the NVIDIA driver and details about the GPUs.

    [ec2-user ~]$ nvidia-smi -q | head
  13. If you are using NVIDIA driver version 14.x or greater on the G4dn or G5g instances, disable GSP with the following commands. For more information, on why this is required visit NVIDIA’s documentation.

    sudo touch /etc/modprobe.d/nvidia.conf
    echo "options nvidia NVreg_EnableGpuFirmware=0" | sudo tee --append /etc/modprobe.d/nvidia.conf
  14. (Optional) Depending on your use case, you might complete the following optional steps. If you do not require this functionality, do not complete these steps.

    1. To help take advantage of the four displays of up to 4K resolution, set up the high-performance display protocol NICE DCV.

    2. NVIDIA Quadro Virtual Workstation mode is enabled by default. To activate GRID Virtual Applications for RDSH Application hosting capabilities, complete the GRID Virtual Application activation steps in Activate NVIDIA GRID Virtual Applications.

    3. Install the GUI desktop/workstation package.

      [ec2-user ~]$ sudo apt-get install -y lightdm ubuntu-desktop

These drivers are available to Amazon customers only. By downloading them, you agree to use the downloaded software only to develop AMIs for use with the NVIDIA A10G and NVIDIA Tesla T4 hardware. Upon installation of the software, you are bound by the terms of the NVIDIA GRID Cloud End User License Agreement.

Prerequisites

  • Install the Amazon CLI on your Linux instance and configure default credentials. For more information, see Installing the Amazon CLI in the Amazon Command Line Interface User Guide.

  • IAM users must have the permissions granted by the AmazonS3ReadOnlyAccess policy. For more information, see Amazon managed policy: AmazonS3ReadOnlyAccess in the Amazon Simple Storage Service User Guide.

  • G3 instances require Amazon provided DNS resolution for GRID licensing to work.

  • IMDSv2 is only supported with NVIDIA driver version 495.x or greater.

To install the NVIDIA gaming driver on your instance

  1. Connect to your Linux instance. Install gcc and make, if they are not already installed.

  2. Update your package cache and get the package updates for your instance.

    [ec2-user ~]$ sudo yum update -y
  3. Reboot your instance to load the latest kernel version.

    [ec2-user ~]$ sudo reboot
  4. Reconnect to your instance after it has rebooted.

  5. Install the gcc compiler and the kernel headers package for the version of the kernel you are currently running.

    [ec2-user ~]$ sudo yum install -y gcc kernel-devel-$(uname -r)
  6. Download the gaming driver installation utility using the following command:

    [ec2-user ~]$ aws s3 cp --recursive s3://nvidia-gaming/linux/latest/ . --region us-east-1 --no-sign-request

    Multiple versions of the gaming driver are stored in this bucket. You can see all of the available versions using the following command:

    [ec2-user ~]$ aws s3 ls --recursive s3://nvidia-gaming/linux/ --region us-east-1 --no-sign-request
  7. Extract the gaming driver installation utility from the downloaded .zip archive.

    [ec2-user ~]$ unzip vGPUSW-*vGaming-Linux-Guest-Drivers.zip -d nvidia-drivers
  8. Add permissions to run the driver installation utility using the following command:

    [ec2-user ~]$ chmod +x nvidia-drivers/Linux/NVIDIA-Linux-x86_64*-grid.run
  9. Run the installer using the following command:

    [ec2-user ~]$ sudo ./nvidia-drivers/Linux/NVIDIA-Linux-x86_64*.run
    Note

    If you are using Amazon Linux 2 with kernel version 5.10, use the following command to install the NVIDIA gaming drivers.

    [ec2-user ~]$ sudo CC=/usr/bin/gcc10-cc ./NVIDIA-Linux-x86_64*.run

    When prompted, accept the license agreement and specify the installation options as required (you can accept the default options).

  10. Use the following command to create the required configuration file.

    [ec2-user ~]$ cat << EOF | sudo tee -a /etc/nvidia/gridd.conf vGamingMarketplace=2 EOF
  11. Use the following command to download and rename the certification file.

    • For version 460.39 or later:

      [ec2-user ~]$ sudo curl -o /etc/nvidia/GridSwCert.txt "https://nvidia-gaming.s3.amazonaws.com/GridSwCert-Archive/GridSwCertLinux_2021_10_2.cert"
    • For version 440.68 to 445.48:

      [ec2-user ~]$ sudo curl -o /etc/nvidia/GridSwCert.txt "https://nvidia-gaming.s3.amazonaws.com/GridSwCert-Archive/GridSwCert-Linux_2020_04.cert"
    • For earlier versions:

      [ec2-user ~]$ sudo curl -o /etc/nvidia/GridSwCert.txt "https://nvidia-gaming.s3.amazonaws.com/GridSwCert-Archive/GridSwCert-Linux_2019_09.cert"
  12. Reboot the instance.

    [ec2-user ~]$ sudo reboot
  13. If you are using NVIDIA driver version 510.x or greater on the G4dn or G5g instances, disable GSP with the following commands. For more information, on why this is required visit NVIDIA’s documentation.

    sudo touch /etc/modprobe.d/nvidia.conf
    echo "options nvidia NVreg_EnableGpuFirmware=0" | sudo tee --append /etc/modprobe.d/nvidia.conf
  14. (Optional) To help take advantage of a single display of up to 4K resolution, set up the high-performance display protocol NICE DCV.

To install the NVIDIA gaming driver on your instance

  1. Connect to your Linux instance. Install gcc and make, if they are not already installed.

  2. Update your package cache and get the package updates for your instance.

    [ec2-user ~]$ sudo yum update -y
  3. Reboot your instance to load the latest kernel version.

    [ec2-user ~]$ sudo reboot
  4. Reconnect to your instance after it has rebooted.

  5. Install the gcc compiler and the kernel headers package for the version of the kernel you are currently running.

    [ec2-user ~]$ sudo yum install -y unzip gcc kernel-devel-$(uname -r)
  6. Disable the nouveau open source driver for NVIDIA graphics cards.

    1. Add nouveau to the /etc/modprobe.d/blacklist.conf blacklist file. Copy the following code block and paste it into a terminal.

      [ec2-user ~]$ cat << EOF | sudo tee --append /etc/modprobe.d/blacklist.conf blacklist vga16fb blacklist nouveau blacklist rivafb blacklist nvidiafb blacklist rivatv EOF
    2. Edit the /etc/default/grub file and add the following line:

      GRUB_CMDLINE_LINUX="rdblacklist=nouveau"
    3. Rebuild the Grub configuration.

      [ec2-user ~]$ sudo grub2-mkconfig -o /boot/grub2/grub.cfg
  7. Download the gaming driver installation utility using the following command:

    [ec2-user ~]$ aws s3 cp --recursive s3://nvidia-gaming/linux/latest/ . --region us-east-1 --no-sign-request

    Multiple versions of the gaming driver are stored in this bucket. You can see all of the available versions using the following command:

    [ec2-user ~]$ aws s3 ls --recursive s3://nvidia-gaming/linux/ --region us-east-1 --no-sign-request
  8. Extract the gaming driver installation utility from the downloaded .zip archive.

    [ec2-user ~]$ unzip vGPUSW-*vGaming-Linux-Guest-Drivers.zip -d nvidia-drivers
  9. Add permissions to run the driver installation utility using the following command:

    [ec2-user ~]$ chmod +x nvidia-drivers/Linux/NVIDIA-Linux-x86_64*-grid.run
  10. Run the installer using the following command:

    [ec2-user ~]$ sudo ./nvidia-drivers/Linux/NVIDIA-Linux-x86_64*.run

    When prompted, accept the license agreement and specify the installation options as required (you can accept the default options).

  11. Use the following command to create the required configuration file.

    [ec2-user ~]$ cat << EOF | sudo tee -a /etc/nvidia/gridd.conf vGamingMarketplace=2 EOF
  12. Use the following command to download and rename the certification file.

    • For version 460.39 or later:

      [ec2-user ~]$ sudo curl -o /etc/nvidia/GridSwCert.txt "https://nvidia-gaming.s3.amazonaws.com/GridSwCert-Archive/GridSwCertLinux_2021_10_2.cert"
    • For version 440.68 to 445.48:

      [ec2-user ~]$ sudo curl -o /etc/nvidia/GridSwCert.txt "https://nvidia-gaming.s3.amazonaws.com/GridSwCert-Archive/GridSwCert-Linux_2020_04.cert"
    • For earlier versions:

      [ec2-user ~]$ sudo curl -o /etc/nvidia/GridSwCert.txt "https://nvidia-gaming.s3.amazonaws.com/GridSwCert-Archive/GridSwCert-Linux_2019_09.cert"
  13. Reboot the instance.

    [ec2-user ~]$ sudo reboot
  14. If you are using NVIDIA driver version 510.x or greater on the G4dn or G5g instances, disable GSP with the following commands. For more information, on why this is required visit NVIDIA’s documentation.

    sudo touch /etc/modprobe.d/nvidia.conf
    echo "options nvidia NVreg_EnableGpuFirmware=0" | sudo tee --append /etc/modprobe.d/nvidia.conf
  15. (Optional) To help take advantage of a single display of up to 4K resolution, set up the high-performance display protocol NICE DCV. If you do not require this functionality, do not complete this step.

To install the NVIDIA gaming driver on your instance

  1. Connect to your Linux instance. Install gcc and make, if they are not already installed.

  2. Update your package cache and get the package updates for your instance.

    [ec2-user ~]$ sudo yum update -y
  3. Reboot your instance to load the latest kernel version.

    [ec2-user ~]$ sudo reboot
  4. Reconnect to your instance after it has rebooted.

  5. Install the gcc compiler and the kernel headers package for the version of the kernel you are currently running.

    [ec2-user ~]$ sudo yum install -y unzip gcc kernel-devel-$(uname -r)
  6. Download the gaming driver installation utility using the following command:

    [ec2-user ~]$ aws s3 cp --recursive s3://nvidia-gaming/linux/latest/ . --region us-east-1 --no-sign-request

    Multiple versions of the gaming driver are stored in this bucket. You can see all of the available versions using the following command:

    [ec2-user ~]$ aws s3 ls --recursive s3://nvidia-gaming/linux/ --region us-east-1 --no-sign-request
  7. Extract the gaming driver installation utility from the downloaded .zip archive.

    [ec2-user ~]$ unzip vGPUSW-*vGaming-Linux-Guest-Drivers.zip -d nvidia-drivers
  8. Add permissions to run the driver installation utility using the following command:

    [ec2-user ~]$ chmod +x nvidia-drivers/Linux/NVIDIA-Linux-x86_64*-grid.run
  9. Run the installer using the following command:

    [ec2-user ~]$ sudo ./nvidia-drivers/Linux/NVIDIA-Linux-x86_64*.run

    When prompted, accept the license agreement and specify the installation options as required (you can accept the default options).

  10. Use the following command to create the required configuration file.

    [ec2-user ~]$ cat << EOF | sudo tee -a /etc/nvidia/gridd.conf vGamingMarketplace=2 EOF
  11. Use the following command to download and rename the certification file.

    • For version 460.39 or later:

      [ec2-user ~]$ sudo curl -o /etc/nvidia/GridSwCert.txt "https://nvidia-gaming.s3.amazonaws.com/GridSwCert-Archive/GridSwCertLinux_2021_10_2.cert"
    • For version 440.68 to 445.48:

      [ec2-user ~]$ sudo curl -o /etc/nvidia/GridSwCert.txt "https://nvidia-gaming.s3.amazonaws.com/GridSwCert-Archive/GridSwCert-Linux_2020_04.cert"
    • For earlier versions:

      [ec2-user ~]$ sudo curl -o /etc/nvidia/GridSwCert.txt "https://nvidia-gaming.s3.amazonaws.com/GridSwCert-Archive/GridSwCert-Linux_2019_09.cert"
  12. Reboot the instance.

    [ec2-user ~]$ sudo reboot
  13. If you are using NVIDIA driver version 510.x or greater on the G4dn or G5g instances, disable GSP with the following commands. For more information, on why this is required visit NVIDIA’s documentation.

    sudo touch /etc/modprobe.d/nvidia.conf
    echo "options nvidia NVreg_EnableGpuFirmware=0" | sudo tee --append /etc/modprobe.d/nvidia.conf
  14. (Optional) To help take advantage of a single display of up to 4K resolution, set up the high-performance display protocol NICE DCV.

To install the NVIDIA gaming driver on your instance

  1. Connect to your Linux instance. Install gcc and make, if they are not already installed.

  2. Update your package cache and get the package updates for your instance.

    [ec2-user ~]$ sudo yum update -y
  3. Reboot your instance to load the latest kernel version.

    [ec2-user ~]$ sudo reboot
  4. Reconnect to your instance after it has rebooted.

  5. Install the gcc compiler and the kernel headers package for the version of the kernel you are currently running.

    [ec2-user ~]$ sudo dnf install -y unzip gcc make elfutils-libelf-devel libglvnd-devel kernel-devel-$(uname -r)
  6. Download the gaming driver installation utility using the following command:

    [ec2-user ~]$ aws s3 cp --recursive s3://nvidia-gaming/linux/latest/ . --region us-east-1 --no-sign-request

    Multiple versions of the gaming driver are stored in this bucket. You can see all of the available versions using the following command:

    [ec2-user ~]$ aws s3 ls --recursive s3://nvidia-gaming/linux/ --region us-east-1 --no-sign-request
  7. Extract the gaming driver installation utility from the downloaded .zip archive.

    [ec2-user ~]$ unzip vGPUSW-*vGaming-Linux-Guest-Drivers.zip -d nvidia-drivers
  8. Add permissions to run the driver installation utility using the following command:

    [ec2-user ~]$ chmod +x nvidia-drivers/Linux/NVIDIA-Linux-x86_64*-grid.run
  9. Run the installer using the following command:

    [ec2-user ~]$ sudo ./nvidia-drivers/Linux/NVIDIA-Linux-x86_64*.run

    When prompted, accept the license agreement and specify the installation options as required (you can accept the default options).

  10. Use the following command to create the required configuration file.

    [ec2-user ~]$ cat << EOF | sudo tee -a /etc/nvidia/gridd.conf vGamingMarketplace=2 EOF
  11. Use the following command to download and rename the certification file.

    • For version 460.39 or later:

      [ec2-user ~]$ sudo curl -o /etc/nvidia/GridSwCert.txt "https://nvidia-gaming.s3.amazonaws.com/GridSwCert-Archive/GridSwCertLinux_2021_10_2.cert"
    • For version 440.68 to 445.48:

      [ec2-user ~]$ sudo curl -o /etc/nvidia/GridSwCert.txt "https://nvidia-gaming.s3.amazonaws.com/GridSwCert-Archive/GridSwCert-Linux_2020_04.cert"
    • For earlier versions:

      [ec2-user ~]$ sudo curl -o /etc/nvidia/GridSwCert.txt "https://nvidia-gaming.s3.amazonaws.com/GridSwCert-Archive/GridSwCert-Linux_2019_09.cert"
  12. Reboot the instance.

    [ec2-user ~]$ sudo reboot
  13. If you are using NVIDIA driver version 510.x or greater on the G4dn or G5g instances, disable GSP with the following commands. For more information, on why this is required visit NVIDIA’s documentation.

    sudo touch /etc/modprobe.d/nvidia.conf
    echo "options nvidia NVreg_EnableGpuFirmware=0" | sudo tee --append /etc/modprobe.d/nvidia.conf
  14. (Optional) To help take advantage of a single display of up to 4K resolution, set up the high-performance display protocol NICE DCV.

To install the NVIDIA gaming driver on your instance

  1. Connect to your Linux instance. Install gcc and make, if they are not already installed.

  2. Update your package cache and get the package updates for your instance.

    $ sudo apt-get update -y
  3. Upgrade the linux-aws package to receive the latest version.

    $ sudo apt-get upgrade -y linux-aws
  4. Reboot your instance to load the latest kernel version.

    [ec2-user ~]$ sudo reboot
  5. Reconnect to your instance after it has rebooted.

  6. Install the gcc compiler and the kernel headers package for the version of the kernel you are currently running.

    $ sudo apt-get install -y unzip gcc make linux-headers-$(uname -r)
  7. Disable the nouveau open source driver for NVIDIA graphics cards.

    1. Add nouveau to the /etc/modprobe.d/blacklist.conf blacklist file. Copy the following code block and paste it into a terminal.

      [ec2-user ~]$ cat << EOF | sudo tee --append /etc/modprobe.d/blacklist.conf blacklist vga16fb blacklist nouveau blacklist rivafb blacklist nvidiafb blacklist rivatv EOF
    2. Edit the /etc/default/grub file and add the following line:

      GRUB_CMDLINE_LINUX="rdblacklist=nouveau"
    3. Rebuild the Grub configuration.

      $ sudo update-grub
  8. Download the gaming driver installation utility using the following command:

    [ec2-user ~]$ aws s3 cp --recursive s3://nvidia-gaming/linux/latest/ . --region us-east-1 --no-sign-request

    Multiple versions of the gaming driver are stored in this bucket. You can see all of the available versions using the following command:

    [ec2-user ~]$ aws s3 ls --recursive s3://nvidia-gaming/linux/ --region us-east-1 --no-sign-request
  9. Extract the gaming driver installation utility from the downloaded .zip archive.

    [ec2-user ~]$ unzip vGPUSW-*vGaming-Linux-Guest-Drivers.zip -d nvidia-drivers
  10. Add permissions to run the driver installation utility using the following command:

    [ec2-user ~]$ chmod +x nvidia-drivers/Linux/NVIDIA-Linux-x86_64*-grid.run
  11. Run the installer using the following command:

    [ec2-user ~]$ sudo ./nvidia-drivers/Linux/NVIDIA-Linux-x86_64*.run

    When prompted, accept the license agreement and specify the installation options as required (you can accept the default options).

  12. Use the following command to create the required configuration file.

    [ec2-user ~]$ cat << EOF | sudo tee -a /etc/nvidia/gridd.conf vGamingMarketplace=2 EOF
  13. Use the following command to download and rename the certification file.

    • For version 460.39 or later:

      [ec2-user ~]$ sudo curl -o /etc/nvidia/GridSwCert.txt "https://nvidia-gaming.s3.amazonaws.com/GridSwCert-Archive/GridSwCertLinux_2021_10_2.cert"
    • For version 440.68 to 445.48:

      [ec2-user ~]$ sudo curl -o /etc/nvidia/GridSwCert.txt "https://nvidia-gaming.s3.amazonaws.com/GridSwCert-Archive/GridSwCert-Linux_2020_04.cert"
    • For earlier versions:

      [ec2-user ~]$ sudo curl -o /etc/nvidia/GridSwCert.txt "https://nvidia-gaming.s3.amazonaws.com/GridSwCert-Archive/GridSwCert-Linux_2019_09.cert"
  14. Reboot the instance.

    [ec2-user ~]$ sudo reboot
  15. If you are using NVIDIA driver version 510.x or greater on the G4dn or G5g instances, disable GSP with the following commands. For more information, on why this is required visit NVIDIA’s documentation.

    sudo touch /etc/modprobe.d/nvidia.conf
    echo "options nvidia NVreg_EnableGpuFirmware=0" | sudo tee --append /etc/modprobe.d/nvidia.conf
  16. (Optional) To help take advantage of a single display of up to 4K resolution, set up the high-performance display protocol NICE DCV. If you do not require this functionality, do not complete this step.

Install an additional version of CUDA

After you install an NVIDIA graphics driver on your instance, you can install a version of CUDA other than the version that is bundled with the graphics driver. The following procedure demonstrates how to configure multiple versions of CUDA on the instance.

To install the CUDA toolkit

  1. Connect to your Linux instance.

  2. Open the NVIDIA website and select the version of CUDA that you need.

  3. Select the architecture, distribution, and version for the operating system on your instance. For Installer Type, select runfile (local).

  4. Follow the instructions to download the install script.

  5. Add run permissions to the install script that you downloaded using the following command.

    [ec2-user ~]$ chmod +x downloaded_installer_file
  6. Run the install script as follows to install the CUDA toolkit and add the CUDA version number to the toolkit path.

    [ec2-user ~]$ sudo downloaded_installer_file --silent --override --toolkit --samples --toolkitpath=/usr/local/cuda-version --samplespath=/usr/local/cuda --no-opengl-libs
  7. (Optional) Set the default CUDA version as follows.

    [ec2-user ~]$ ln -s /usr/local/cuda-version /usr/local/cuda