Install GUI (graphical desktop) on Amazon EC2 instances running Amazon Linux 2023 (AL2023)
Steps to install desktop environment, desktop manager and Amazon DCV high performance remote display protocol server on Amazon Linux 2023 (AL2023)
Overview
This article suggests how you can install GUI (Graphical User Interface) on Amazon EC2 instances running Amazon Linux 2023, and access it using Amazon DCV remote display protocol.
This article applies to AL2023 only. Similar articles are available for AL2, Ubuntu Linux, RHEL/Rocky Linux and SLES 15
NVIDIA GPU
The following options are available if you are using NVIDIA GPU EC2 instance:
- G7e, G6, G6e, G6f, Gr6, Gr6f, G5 or G4dn EC2 instance types: GPU-accelerated graphical desktop on Amazon Linux 2023 (AL2023) with NVIDIA GRID and Amazon DCV
- DLAMI: Deep Learning graphical desktop on Amazon Linux 2023 (AL2023) with AWS Deep Learning AMI (DLAMI)
- NVIDIA GPU instance: Install NVIDIA GPU driver first. Refer to Install NVIDIA GPU driver, CUDA toolkit, NVIDIA Container Toolkit on Amazon EC2 instances running Amazon Linux 2023 (AL2023) and NVIDIA drivers for your Amazon EC2 instance for options.
Notice
Your use of DCV is subject to DCV end user license agreement
Requirements
Supported OS versions
The following versions are supported by Amazon DCV server
- Amazon Linux 2023 (x86_64)
- Amazon Linux 2023 (arm64)
AL2023 release 2023.7 or higher is required. To verify release version
$ rpm -q system-release
Output should be a release number equal or higher than 2023.7
system-release-2023.7.20250331-0.amzn2023.noarch
Refer to documentation for upgrade instructions.
EC2 instance prerequisites
- EC2 instance with more than 2.4 GiB memory
- Attached security group allows inbound TCP and UDP port
8443from your IP - More than 3 GB free disk space to install graphical desktop components and DCV server
- Attached EC2 IAM role with the below policy for license validation. Replace
REGIONwith your instance AWS Region code. Alternatively, attach AmazonS3ReadOnlyAccess managed policy.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::dcv-license.REGION/*"
}
]
}
Installing DCV
Install desktop environment and desktop manager
Install GNOME desktop and disable Wayland protocol
sudo dnf groupinstall "Desktop" -y sudo sed -i '/^\[daemon\]/a WaylandEnable=false' /etc/gdm/custom.conf sudo systemctl set-default graphical.target
Install DCV server
Install DCV server, web client and virtual session support, and enable server daemon
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 systemctl enable dcvserver
Console session XDummy driver
Install and configure XDummy driver. Run NVIDIA xorg.conf configurator if NVIDIA GPU desktop drivers are installed.
sudo dnf install -y xorg-x11-drv-dummy sudo tee /etc/X11/xorg.conf > /dev/null << EOF Section "Device" Identifier "DummyDevice" Driver "dummy" Option "UseEDID" "false" VideoRam 512000 EndSection Section "Monitor" Identifier "DummyMonitor" HorizSync 5.0 - 1000.0 VertRefresh 5.0 - 200.0 Option "ReducedBlanking" EndSection Section "Screen" Identifier "DummyScreen" Device "DummyDevice" Monitor "DummyMonitor" DefaultDepth 24 SubSection "Display" Viewport 0 0 Depth 24 Virtual 4096 2160 EndSubSection EndSection EOF if [ -f /usr/bin/nvidia-xconfig ]; then sudo /usr/bin/nvidia-xconfig --preserve-busid --enable-all-gpus sudo dnf install -y vulkan-tools glx-utils fi
Configure DCV server
Configure console session, file transfer and printing support
USER=ec2-user sudo sed -i "/^\[session-management\/automatic-console-session/a owner=\"$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
Restart EC2 instance
sudo reboot
Set user password
Specify a strong password for login user
sudo passwd ec2-user
Verify installation
To verify
dcv list-sessions
You should get the below output indicating a console DCV session
Session: 'console' (owner:ec2-user type:console)
Access graphical desktop environment
Clients
DCV offers Windows, Linux, macOS and web browser clients.
You can connect to DCV server using web browser client at https://<EC2-IP>:8443 (where <EC2-IP> is your EC2 instance IP address).
Native clients provide better user experience and additional features, and can be downloaded from Amazon DCV site.
Login as ec2-user with your configured password
Do ensure that EC2 instance security group allow inbound TCP and UDP 8443 from your IP
Web browser client
EC2 Install Script
You can use the below as install script (or user data) on a new AL2023 EC2 instance.
Comment out the line sudo /usr/bin/nvidia-xconfig --preserve-busid --enable-all-gpus if you do not want NVIDIA GPU accelerated graphics or intend to switch between instance types
#!/bin/bash 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 systemctl enable dcvserver USER=ec2-user sudo sed -i "/^\[session-management\/automatic-console-session/a owner=\"$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 xorg-x11-drv-dummy sudo tee /etc/X11/xorg.conf > /dev/null << EOF Section "Device" Identifier "DummyDevice" Driver "dummy" Option "UseEDID" "false" VideoRam 512000 EndSection Section "Monitor" Identifier "DummyMonitor" HorizSync 5.0 - 1000.0 VertRefresh 5.0 - 200.0 Option "ReducedBlanking" EndSection Section "Screen" Identifier "DummyScreen" Device "DummyDevice" Monitor "DummyMonitor" DefaultDepth 24 SubSection "Display" Viewport 0 0 Depth 24 Virtual 4096 2160 EndSubSection EndSection EOF if [ -f /usr/bin/nvidia-xconfig ]; then sudo /usr/bin/nvidia-xconfig --preserve-busid --enable-all-gpus sudo dnf install -y vulkan-tools glx-utils fi sudo reboot
Do set ec2-user user password
Additional information
For help with DCV, refer to DCV Administrator Guide and User Guide
For help navigating graphical desktop, refer to Learn GNOME
DCV sessions
Amazon DCV on Linux offers two types of sessions: console sessions and virtual sessions. This article use console sessions, which has resolution limits especially on non GPU instances. Virtual sessions support custom resolution and multiple displays.
To switch to virtual session, connect to EC2 instance as ec2-user, disable console session, configure multi-user.target (optional) and reboot
sudo sed -i "s/^create-session/#create-session/g" /etc/dcv/dcv.conf sudo systemctl restart dcvserver sudo systemctl set-default multi-user.target sudo systemctl isolate multi-user.target sudo reboot
You will need to create a virtual session manually
USER=ec2-user dcv create-session $USER --owner $USER --storage-root %home% --type virtual
Verify that virtual session has been created
sudo dcv list-sessions
Output should be similiar to below
Session: 'ec2-user' (owner:ec2-user type:virtual)
Refer to Using the command line on a Linux Amazon DCV Server for more information
Other options
Consider managed EUC (End User Computing) services such as Amazon WorkSpaces
Install prerequisites including desktop environment and Amazon DCV Server from Amazon DCV Administrator Guide
To quickly get up and running with DCV for internal testing, you can use CloudFormation template at DCV CloudFormation page.
You can also explore amazon-ec2-nice-dcv-samples CloudFormation templates to provision your own EC2 instances with graphical desktop environment, DCV server and other features such as multiple virtual sessions support and GPU driver installation.
AMIs preconfigured with graphical desktop environment are available from AWS Marketplace.
- Topics
- Compute
- Language
- English
Relevant content
- asked 3 years ago
