Start your journey to the next level of remote computing
By combining NoMachine software with Google Cloud Platform (GCP) infrastructure, you can jumpstart your own remote access and desktop delivery solution for employees, partners and customers alike. Or if it's just for your own use, by installing NoMachine you can get remote access to your own personal desktop hosted in GCP and get the same benefits as you would as if the physical hardware was really yours. Google Cloud Platform is the Google's cloud-computing service. It provides resizable compute capacity in the cloud, suitable for any organization or individual which needs flexible cloud hosting services. Virtual hosts can be fired up on many OS’s and configurations according to specific needs. This particular tutorial will concentrate on the Linux desktop.
Getting started with your Google Cloud instance
- GCP Linux instances do not come with a GUI, so by default, you need terminal access for all application configuration to get started. Most of the developers/sysadmins working with Linux prefer the command line over Graphical User Interface. But users who are new to Linux will feel more comfortable with a GUI for installing and managing their applications. We will show you how to configure a graphical user interface (GUI) for a GCP Linux instance and then access that GUI using NoMachine.
- We're going to install NoMachine Free Edition on a virtual Linux host, and then access the desktop of this virtualized Linux OS. You can of course install any of the enterprise-oriented products as well. For this tutorial, we'll install it on Ubuntu 14.04 LTS. NoMachine can be installed on literally any of the Linux flavors, though some of the steps might change depending on what you choose to use. To get started you're going to need SSH to let you remotely log in and administer the Linux VM. Once NoMachine is installed, you'll be able to access the remote desktop securely via NX.
Logging in to GCP
Fig. 1 - Go to https://cloud.google.com/gcp/
Choosing a Google Cloud VM Instance
- Remember you can also refer to their Getting Started Guide: https://cloud.google.com/gcp/getting-started.
- Once logged-in, click on "Console". You will see the Google Cloud Platform dashboard. Click on "Google Cloud Platform" on the top left side, choose "Compute Engine" and click on "VM instances" (Fig. 2).
Fig. 2 - Click on "VM instances"
- Choose a Virtual Machine (VM). You can use 'Marketplace' to find the VM instance with the OS of your needs. For this tutorial we've chosen Ubuntu 14.04 (Fig. 3).
Fig. 3 - Once you've chosen the VM type, click on "Create instance" to proceed to create the new VM
Configuring the virtual machine
- In the first step, you need to configure the base details and features for your VM: name, region, machine type. There are plenty of possible configurations and you will be asked about creating machine’s type/size, name, username, login method and others.
- To enable access to your instance, be sure to choose 'Allow default access' in the 'Access scopes' configuration (Fig. 3).
- The default way of accessing the VM instance is using SSH keys. You will find detailed explanation here: https://cloud.google.com/compute/docs/instances/connecting-to-instance.
- In this tutorial, we use project-wide SSH keys that provide access and work with all the machines in the same project (because we are constantly deploying many VM’s and it’s simply much more comfortable to do it this way). Alternatively, you can use your own SSH key. In order to do that you need to choose 'Block project-wide SSH key' and paste your public key into the appropriate text area 'Enter entire key data' (Fig. 4).
Fig. 4 - Copy your SSH public key into the 'Enter entire key data' field if you want to use your own SSH key for this VM instance only
Preparing the virtual machine
- Once completed the configuration, click on "Create" and wait a few minutes until your virtual machine is deployed. Your VM is almost ready! The new VM will be displayed in the list of VM instances in the GCP dashboard (Fig. 5).
Fig. 5 - Your VM is almost ready
- Copy the machine’s public IP address, shown on the right side of instance’s details ("External IP", Fig. 5), you will need it later. In this example, the IP is: 184.108.40.206.
- Click on the menu button for your VM instance and go to the "View network details" of the new VM to configure firewall settings and enable incoming connections on tcp port 4000 which is the default NoMachine port for connections by NX protocol.
- Now log-in by SSH to your VM instance. Click "SSH" in the row of the VM (Fig. 5). You will be authenticated to the VM by using the SSH keys pair previously set (Fig. 6).
Fig. 6 - Connecting to the VM by SSH and key-based authentication
- You are now connected to your VM instance. Next steps will be updating the system, creating the new user nomachine, editing the SSHD configuration to enable password-based authentication and install a desktop environment on the VM since by default it is in a headless mode (Fig. 7).
Fig. 7 - Connected to the Virtual Machine
- When you are connected to the remote Virtual Machine via SSH, update the Operating System:
sudo apt-get update
sudo apt-get upgrade -y
Create the nomachine user (also set a password):
sudo adduser nomachine
Install a desktop environment to provide a graphical interface on it:
sudo apt-get install ubuntu-desktop
Configure the system SSHD on the VM to enable password-based authentication.
Edit /etc/ssh/sshd_config by changing "PasswordAuthentication" line from "No" to "Yes".
Go back to the GCP Dashboard, stop and start your VM.
Wait until it reboots (Fig. 8).
Fig. 8 - Stop and then start the Virtual Machine
- Download and save the NoMachine package suitable for the Operating System of your Virtual Machine on your local computer. Then send it to your GCP VM instance via SCP. In our case, the external IP of the VM instance is 35.224.148 (Fig. 9).
Fig. 9 - SCP the NoMachine package to the Virtual Machine
Connecting to your desktop via NoMachine
- Close the terminal and go back to GCP Dashboard. Now you're ready to use your NoMachine desktop on GCP Ubuntu 14.04. On your local machine open the NoMachine User Interface and click 'Add'. Create a connection by specifying the NX protocol and the IP address of the remote host on GCP (Fig. 10).
Fig. 10 - Select NX as protocol and insert the the IP of the VM hosted on GCP
- You can give an appropriate name to this connection in this panel if you wish. You should also check that in 'Configuration' the authentication type is password-based (Fig. 11) after which click 'Connect'. Provide the appropriate credentials to login to the VM on GCP when requested. Here we log-in to as the 'nomachine' user (Fig. 12). Welcome screens appear once you are connected.
Fig. 11 - Check that authentication is 'Password' and click 'Connect'
Fig. 12 - Provide username and password to log-in to the GCP's VM
Fig. 13 - NoMachine Welcome panel
- Your NoMachine session is started: pass through the Welcome panels for quick hints on NoMachine features and configuration. You're now connected to the desktop of your Virtual Machine on GCP. Choose the user and enter the username. It’s all done, enjoy your new desktop!
Fig. 14 - You're in!