One great thing about cloud computing is that it provides you an opportunity to easily run other operating systems — for example, I have a Mac laptop but often need Ubuntu — but unfortunately, getting access to the GUI for things like the browser or other non-command-line tasks often isn’t available out of the box. Fortunately, it’s straightforward if you know what you need to do.
Here’s a tutorial video of how to access the desktop GUI for an Ubuntu cloud server if you would like to follow along.
How to access the GUI on a cloud Ubuntu instance
Start by making sure the machine itself is up to date:
sudo apt update sudo apt upgrade
Install a Ubuntu desktop manager
You’ll need an actual desktop manager, so let’s go ahead and install ubuntu-mate-desktop:
sudo apt install ubuntu-mate-desktop
When it asks you for the Default display manager, choose gdm3.
Install VNC Server
The last thing you need on the server is an instance of VNC Server, which you’ll use to view the actual desktop:
sudo apt install tightvncserver
Start the VNC Server
Finally, start the server:
Set a password and choose whether to create a read only user.
If you need to stop or restart VNC, you can do it by killing the server:
vncserver -kill :1
Access the VNC Server using a VNC Client
Now you need to get ready to access the VNC server, which will provide you access to the desktop. To do that, download the VNC viewer from https://www.realvnc.com/en/connect/download/viewer/ and choose File->New Connection. The actual address for the server is the IP address followed by :1, as in:
Now, keep in mind that despite what it looks like, the server isn’t actually running on port 1, but rather on port 5901, so check your inbound security rules to make sure that port 5901 is open.
If you are in AWS, for example, you can make sure this port is available by going into the Security options, then Security Group, and then edit the inbound rules. Then add a rule that allows access to port 5901 to everyone, or your particular IP address.
Finally, to access the server, double-click it in your list of servers:
Note that in this case we’re not encrypting the data that passes between your local machine and the server, so if this is acceptable, choose Continue when it asks about the Unencrypted Connection. From there, you will see the desktop:
From here you should be able to do everything you could do if you were working on the cloud machine locally. For example, you could install and run the Lens IDE and work with your Kubernetes clusters from a cloud-based Ubuntu environment.