Ongoing service disruptions
For the most recent update on ongoing service disruptions affecting the AWS Middle East (UAE) Region (ME-CENTRAL-1), refer to the AWS Health Dashboard. For information on AWS Service migration, see How do I migrate my services to another region?
GPU-accelerated graphical desktop on Amazon Linux 2023 (AL2023) with NVIDIA GRID and Amazon DCV
Setup a GPU-accelerated workstation on AL2023 that supports up to four 4K displays and audio playback
Overview
This article describes how to setup a GPU-accelerated graphical desktop on Amazon EC2 instances running Amazon Linux 2023 (AL2023) with NVIDIA GRID driver, and access it using Amazon DCV high performance remote desktop protocol.
This article applies to AL2023 only. Similar articles are available for Ubuntu and Windows.
Other install options
- Consider managed EUC (End User Computing) services such as Amazon WorkSpaces
- Use this repository CloudFormation templates to automate setup on AL2023, Ubuntu, Windows or other OSs
- Setup Deep Learning workstation with AWS Deep Learning AMIs
- Install NVIDIA Tesla driver and graphical desktop
- Install desktop environment, NVIDIA GRID driver and Amazon DCV Server from documentation
- Amazon Machine Images (AMIs) with NVIDIA GRID drivers installed are available from AWS MarketPlace
Prerequisites
Verify that the On-Demand Instance quota value for Running On-Demand G and VT instances in your desired AWS Region is equal or greater than your desired instance size vCPUs count. Request a quota increase if otherwise.
Do not proceed until your applied quota value is equal or higher than your desired instance type vCPUs count
Launch EC2 instance
Launch a new EC2 instance with the following attributes
- Amazon Linux 2023
G7e, G6, G6e, G6f, Gr6, Gr6f, G5 or G4dnEC2 instance type- Security group that allows inbound TCP and UDP port
8443from your IP - More than 15 GB EBS volume size
- EC2 IAM role with AmazonS3ReadOnlyAccess managed policy attached for DCV license validation
Connect to the instance as ec2-user
Installation
Run the below commands
Prepare AL2023
Update OS
sudo dnf update -y
Optional: you may want to upgrade to latest release version (if available) and disable deterministic upgrade
sudo dnf upgrade --releasever=latest
echo latest | sudo tee /etc/dnf/vars/releasever
Restart your EC2 instance
sudo reboot
Install GNOME desktop and Amazon DCV server
sudo dnf clean all
sudo dnf groupinstall "Desktop" -y
sudo sed -i '/^\[daemon\]/a WaylandEnable=false' /etc/gdm/custom.conf
sudo systemctl set-default graphical.target
cd /tmp
sudo rpm --import https://d1uj6qtbmh3dt5.cloudfront.net/NICE-GPG-KEY
curl -L -O https://d1uj6qtbmh3dt5.cloudfront.net/nice-dcv-amzn2023-$(arch).tgz
tar -xvzf nice-dcv-amzn2023-$(arch).tgz && cd nice-dcv-*-amzn2023-$(arch)
sudo dnf install -y ./nice-dcv-server-*.rpm
sudo dnf install -y ./nice-dcv-web-viewer-*.rpm
sudo dnf install -y ./nice-xdcv-*.rpm
sudo dnf install -y ./nice-dcv-gltest-*.rpm
sudo systemctl enable dcvserver
sudo sed -i "/^\[session-management\/automatic-console-session/a owner=\"ec2-user\"\nstorage-root=\"%home%\"" /etc/dcv/dcv.conf
sudo sed -i "s/^#create-session/create-session/g" /etc/dcv/dcv.conf
sudo dnf install -y cups
sudo usermod -a -G sys dcv
sudo systemctl enable --now cups
Use of DCV is subject to DCV EULA (end user license agreement)
Install NVIDIA GRID driver
We will install NVIDIA GRID (also known as NVIDIA RTX Virtual Workstation (vWS)) driver. NVIDIA GRID drivers are certified to provide optimal performance for professional visualization applications that render content such as 3D models or high-resolution videos, and provide access to four 4K displays per GPU.
sudo dnf clean all
sudo dnf install -y vulkan-devel libglvnd-devel elfutils-libelf-devel xorg-x11-server-Xorg
sudo dnf install -y glx-utils vulkan-tools
sudo dnf install -y dkms
sudo systemctl enable --now dkms
KVER=$(uname -r)
case $KVER in
6.18.*)
sudo dnf install -q -y kernel6.18-headers-$(uname -r) kernel6.18-devel-$(uname -r) kernel6.18-modules-extra-$(uname -r) kernel6.18-modules-extra-common-$(uname -r) --allowerasing
;;
6.12.*)
sudo dnf install -q -y kernel6.12-headers-$(uname -r) kernel6.12-devel-$(uname -r) kernel6.12-modules-extra-$(uname -r) kernel6.12-modules-extra-common-$(uname -r) --allowerasing
;;
*)
sudo dnf install -q -y kernel-headers-$(uname -r) kernel-devel-$(uname -r) kernel-modules-extra-$(uname -r) kernel-modules-extra-common-$(uname -r) --allowerasing
;;
esac
cd /tmp
aws s3 cp --recursive s3://ec2-linux-nvidia-drivers/latest/ . --no-sign-request
chmod +x NVIDIA-Linux-x86_64*.run
sudo ./NVIDIA-Linux-x86_64*.run -s
echo "options nvidia NVreg_EnableGpuFirmware=0" | sudo tee --append /etc/modprobe.d/nvidia.conf
sudo nvidia-xconfig --enable-all-gpus --connected-monitor=DFP-0,DFP-1,DFP-2,DFP-3
Note that NVIDIA GRID driver is available for AWS customers only. By downloading and installing the software, you are bound by the terms of the NVIDIA GRID Cloud EULA (End User License Agreement).
Start X Windows and DCV server
sudo systemctl isolate multi-user.target && sudo systemctl isolate graphical.target
sudo systemctl restart dcvserver
Configure password
Configure a strong ec2-user password
sudo passwd ec2-user
Optional: GPU-accelerated container workloads
Besides GPU-accelerated graphics, you may want to run GPU-accelerated container workloads.
Install Docker and NVIDIA Container Toolkit
sudo dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/amzn2023/x86_64/cuda-amzn2023.repo
sudo dnf install -y docker
sudo systemctl enable docker
sudo usermod -aG docker ec2-user
sudo dnf install -y nvidia-container-toolkit
sudo nvidia-ctk runtime configure --runtime=docker
sudo systemctl restart docker
Refer to Install NVIDIA GPU driver, CUDA toolkit, NVIDIA Container Toolkit on Amazon EC2 instances running Amazon Linux 2023 (AL2023) (method 1, option 1) for more details including CUDA toolkit and other NVIDIA software installation.
Connect to AL2023 using DCV client
Download and install native client from https://www.amazondcv.com/.
Connect your macOS , Windows or Linux client to your EC2 instance public IP address. Login as ec2-user.
While you can connect using web browser client, native clients provide better user experience with additional features such as QUIC UDP transport protocol, multi-channel audio, and up to four 4K displays support.
Using Amazon DCV
Refer to DCV User Guide for usage guidance, e.g. transferring files.
EC2 Install Script
You can use the below as install script (or user data) to install NVIDIA GRID driver, docker with NVIDIA Container Toolkit, and Amazon DCV server on a new AL2023 GPU instance preferably with latest updates applied and with at least 15 GB storage.
#!/bin/bash
sudo dnf clean all
sudo dnf groupinstall "Desktop" -y
sudo sed -i '/^\[daemon\]/a WaylandEnable=false' /etc/gdm/custom.conf
sudo systemctl set-default graphical.target
cd /tmp
sudo rpm --import https://d1uj6qtbmh3dt5.cloudfront.net/NICE-GPG-KEY
curl -L -O https://d1uj6qtbmh3dt5.cloudfront.net/nice-dcv-amzn2023-$(arch).tgz
tar -xvzf nice-dcv-amzn2023-$(arch).tgz && cd nice-dcv-*-amzn2023-$(arch)
sudo dnf install -y ./nice-dcv-server-*.rpm
sudo dnf install -y ./nice-dcv-web-viewer-*.rpm
sudo dnf install -y ./nice-xdcv-*.rpm
sudo dnf install -y ./nice-dcv-gltest-*.rpm
sudo systemctl enable dcvserver
sudo sed -i "/^\[session-management\/automatic-console-session/a owner=\"ec2-user\"\nstorage-root=\"%home%\"" /etc/dcv/dcv.conf
sudo sed -i "s/^#create-session/create-session/g" /etc/dcv/dcv.conf
sudo dnf install -y cups
sudo usermod -a -G sys dcv
sudo systemctl enable --now cups
sudo dnf install -y vulkan-devel libglvnd-devel elfutils-libelf-devel xorg-x11-server-Xorg
sudo dnf install -y glx-utils vulkan-tools
sudo dnf install -y dkms
sudo systemctl enable --now dkms
KVER=$(uname -r)
case $KVER in
6.18.*)
sudo dnf install -q -y kernel6.18-headers-$(uname -r) kernel6.18-devel-$(uname -r) kernel6.18-modules-extra-$(uname -r) kernel6.18-modules-extra-common-$(uname -r) --allowerasing
;;
6.12.*)
sudo dnf install -q -y kernel6.12-headers-$(uname -r) kernel6.12-devel-$(uname -r) kernel6.12-modules-extra-$(uname -r) kernel6.12-modules-extra-common-$(uname -r) --allowerasing
;;
*)
sudo dnf install -q -y kernel-headers-$(uname -r) kernel-devel-$(uname -r) kernel-modules-extra-$(uname -r) kernel-modules-extra-common-$(uname -r) --allowerasing
;;
esac
cd /tmp
aws s3 cp --recursive s3://ec2-linux-nvidia-drivers/latest/ . --no-sign-request
chmod +x NVIDIA-Linux-x86_64*.run
sudo ./NVIDIA-Linux-x86_64*.run -s
echo "options nvidia NVreg_EnableGpuFirmware=0" | sudo tee --append /etc/modprobe.d/nvidia.conf
sudo nvidia-xconfig --enable-all-gpus --connected-monitor=DFP-0,DFP-1,DFP-2,DFP-3
sudo dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/amzn2023/x86_64/cuda-amzn2023.repo
sudo dnf install -y docker
sudo systemctl enable docker
sudo usermod -aG docker ec2-user
sudo dnf install -y nvidia-container-toolkit
sudo nvidia-ctk runtime configure --runtime=docker
sudo systemctl restart docker
sudo reboot
Do set ec2-user user password and reboot EC2 instance before using.
- Topics
- Compute
- Language
- English
Relevant content
- asked a year ago
- asked 2 years ago
AWS OFFICIALUpdated 2 years ago
AWS OFFICIALUpdated 10 months ago