Thursday, July 16, 2020

Set up Google Cloud VM

Setup up ssh

https://cloud.google.com/compute/docs/instances/adding-removing-ssh-keys

Note:
$ ssh-keygen -t rsa -f ~/.ssh/[KEY_FILENAME] -C [USERNAME]


Set [USERNAME] for the same user.

Change root password

$ sudo passwd


Change user password

$ sudo passwd [USERNAME]

Install zsh

https://ohmyz.sh/

Graphical user interface (GUI) for Google Compute Engine instance

https://medium.com/google-cloud/linux-gui-on-the-google-cloud-platform-800719ab27c5
https://medium.com/google-cloud/graphical-user-interface-gui-for-google-compute-engine-instance-78fccda09e5c
https://help.realvnc.com/hc/en-us/articles/360003474792-Why-does-VNC-Server-in-Virtual-Mode-on-Linux-appear-to-hang-show-a-gray-screen-or-not-start-at-all-#using-vnc-5-x-or-vnc-connect-6-0-6-1-or-on-a-different-version-of-linux--0-1

Steps:
1. sudo apt install xfce xfce4-goodies vnc4server
2. change .vnc/xstartup to

#!/bin/sh
DESKTOP_SESSION=xfce
export DESKTOP_SESSION
startxfce4
vncserver-virtual -kill $DISPLAY


3. start vncserver
$ vncserver

4. stop vncserver
$ vncserver -kill :1

5. set firewall on Google VM by adding a rule with tag "vnc-server": https://console.cloud.google.com/networking/firewalls/list?_ga=2.140666673.226794997.1594947656-1741100383.1594947656&project=covid-19-283520&folder=&organizationId=
6. add "vnc-server" in "Network tag" in the VM instance
7. On local machine, install RealVNC