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:
-
In Hyperstack navigate to the When Deploy Virtual Machine page.
-
Select the configuration and features of your virtual machine including a flavor, image, SSH key pair, and name for your VM.
-
Click the option to Auto-install Nvidia drivers.
-
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: