I am testing a Google Compute Engine, and I created a VM with Ubuntu OS. When I connect to it, by clicking this Connect SSH button, it opens a console window.
Is that the connection you get?
How do I open a real screen with a GUI on it? I don't want the console.
You need to forward the X11 session from the VM to your local machine. This has been covered in the Unix and Linux stack site before:
https://unix.stackexchange.com/questions/12755/how-to-forward-x-over-ssh-from-ubuntu-machine
Since you are connecting to a server that is expected to run compute tasks there may well be no X11 server installed on it. You may need to install X11 and similar. You can do that by following the instructions here:
https://help.ubuntu.com/community/ServerGUI
Since I have needed to do this recently, I am going to briefly write up the required changes here:
Configure the Server
Ensure that
X11Forwarding yes
is present. Restart the ssh daemon if you change the settings:Configure the Client
Ensure that
ForwardX11 yes
is present for the host. For example:Forwarding X11
Trusted X11 Forwarding
http://dailypackage.fedorabook.com/index.php?/archives/48-Wednesday-Why-Trusted-and-Untrusted-X11-Forwarding-with-SSH.html
You may wish to enable trusted forwarding if applications have trouble with untrusted forwarding.
You can enable this permanently by using
ForwardX11Trusted yes
in the~/.ssh/config
file.You can enable this for a single connection by using the
-Y
argument in place of the-X
argument.These instructions are for setting up Ubuntu 16.04 LTS with LXDE (I use SSH port forwarding instead of opening port 5901 in the VM instance firewall)
1. Build a new Ubuntu VM instance using the GCP Console
2. connect to your instance using google cloud shell
3. install the necessary packages
4. setup vncserver (you will be asked to provide a password for the vncserver)
6. Reboot your instance (this returns you to the Google cloud shell prompt)
7. Use the google cloud shell download file facility to download the auto-generated private key stored at $HOME/.ssh/google_compute_engine and save it in your local machine*****
8. From your local machine SSH to your VM instance (forwarding port 5901) using your private key (downloaded at step 7)
9. Run the vncserver in your VM instance
10. In your local machine's Remote Desktop Client (e.g. Remmina) set Server to
localhost:5901
and Protocol toVNC
Note 1: to check if the vncserver is working ok use:
Note 2: to restart the vncserver use:
***** When first connected via the Google cloud shell the public and private keys are auto-generated and stored in the cloud shell instance at
$HOME/.ssh/
The public key should be added to the
home/*user_id*/.ssh/authorized_keys
in the VM instance (this is done automatically when you first SHH to the VM instance from the google cloud shell, i.e. in step 2) you can confirm this in the instance metadataMuch better solution from Google themselves:
https://medium.com/google-cloud/linux-gui-on-the-google-cloud-platform-800719ab27c5
Check out this google tutorial to use it with Compute Engine : https://cloud.google.com/solutions/chrome-desktop-remote-on-compute-engine