How to access & install desktop GUI for Ubuntu cloud servers
Here's a tutorial video of how to access the desktop GUI for an Ubuntu cloud server if you would like to follow along.[youtubevideo url="https://youtu.be/Mwt8DAIOKRI"]
How to access the GUI on a cloud Ubuntu instanceStart by making sure the machine itself is up to date:
sudo apt update
sudo apt upgrade
Install a Ubuntu desktop managerYou'll need an actual desktop manager, so let's go ahead and install ubuntu-mate-desktop:
sudo apt install ubuntu-mate-desktopWhen it asks you for the Default display manager, choose gdm3.
Install VNC ServerThe 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 ServerFinally, start the server:
vncserver :1Set 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 ClientNow 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.