1. Help Center
  2. Virtual Machines
  3. Operating systems and drivers

How do I automatically install the latest Nvidia drivers on my virtual machine?

In Hyperstack enable "Auto-install Nvidia drivers" during VM deployment, or use a Nvidia driver install cloud-init script if utilizing the API.

To automatically install Nvidia drivers on Linux-based virtual machines:

In Hyperstack:

  1. In Hyperstack navigate to the When Deploy Virtual Machine page.

  2. Select the configuration and features of your virtual machine including a flavorimageSSH key pair, and name for your VM.

  3. Click the option to Auto-install Nvidia drivers.

    Auto install drivers

  4. Click Deploy to create your virtual machine with automatically installed Nvidia drivers.

Using Infrahub API:

Include the following cloud-init script within the user_data field of the request body when creating a new virtual machine using the Infrahub API.

Generic Nvidia driver installation script:
#cloud-config
write_files:
- path: /tmp/download_and_run_script_nvidia.sh
permissions: '0755'
content: |
#!/bin/bash
set -e

# Download the script
echo "Downloading the init script..."
SCRIPT_URL="https://api.nexgencloud.com:8080/public/nvidia/installer_script_main.sh"
SCRIPT_NAME=$(basename "\${SCRIPT_URL}")

# Use wget if available, otherwise use curl
if command -v wget >/dev/null 2>&1; then
wget -O "/tmp/\${SCRIPT_NAME}" "\${SCRIPT_URL}"
else
curl -o "/tmp/\${SCRIPT_NAME}" "\${SCRIPT_URL}"
fi

# Make the downloaded script executable
chmod +x "/tmp/\${SCRIPT_NAME}"
echo "Running the init script..."
/tmp/\${SCRIPT_NAME}

runcmd:
- /tmp/download_and_run_script_nvidia.sh
- [ shutdown, -r, now ]
 

References:

 

For further assistance, don't hesitate to reach out to us at:

Support Email: [email protected]

Sales Contact: [email protected]

Phone: +44 (0) 203 475 3402


nexgen logo

Please check out our Website and Social Media