This guide enables desktop mode in Ubuntu 16.04 (Xenial Xerus) running off an AWS EC2.
- Launch an EC2 instance with Ubuntu 16.04 (should work on all versions greater too)
- Ensure a security group is configured, that allows ingress on ports 22 (SSH) and 5901 (VNC, 5900+N, where N is the display number)
- SSH into the instance, update the system, install the XFCE desktop and the lightweight VNC server:
sudo apt-get update
sudo apt install xfce4 xfce4-goodies tightvncserver
- Now, initialize. Assign a password to login in via remote desktop. Finally, kill VNC server.
vncserver
vncserver -kill :1
- To reconfigure VNC:
mv ~/.vnc/xstartup ~/.vnc/xstartup.bak
nano ~/.vnc/xstartup
- Add in the following to the xstartup config.
#!/bin/bash
xrdb $HOME/.Xresources
startxfce4 &
- Make xstartup an executable script and start the VNC server
sudo chmod +x ~/.vnc/xstartup
vncserver
Once setup is complete, you can remote desktop into your instance with GUI.
- On OS X, use screen sharing
vnc://<instance_ip>:5901
- On Linux, use krdc, remmima etc
- [EC2-VNC] (https://help.ubuntu.com/community/EC2-VNC)
- [How to Install and Configure VNC on Ubuntu 16.04] (https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-vnc-on-ubuntu-16-04)
For my particular Lightsail instance, I ran into the following error re: dbus-launch after connecting with VNC. To resolve it, I installed dbus:
Also, note that dbus-x11 has to be installed before vncserver is started, if you're going through this the first time.
OS details:
This was on a node.js template on AWS Lightsail.