Open In App

Beginner’s Guide to Using Ubuntu on Google Cloud Platform (GCP)

Ubuntu is one of the most famous Linux distributions, popular for cloud computing, with support for OpenStack. Ubuntu is built on Debian’s architecture and infrastructure and comprises Linux server, desktop, and discontinued phone and tablet operating system versions. Ubuntu is often considered as one of the user-friendly operating systems for beginners. Since its release in 2004, it has gained popularity. Ubuntu is open source and has a larger community for solving its issues. There are several versions of Ubuntu available in the market for use. Ubuntu is officially released in multiple editions: Desktop, Server, and Core for IOT devices.

There are several ways of using Ubuntu:



  1. Using Stand Alone Ubuntu PC.
  2. Installing Ubuntu alongside your existing Operating System.
  3. Installing Ubuntu on Virtual Box.

Now all of these ways need a computer with some good hardware. So there comes running Ubuntu on the Cloud platform. This gives the user the privilege of using Ubuntu on low-end specs and using Ubuntu on the go from anywhere.

How to use Ubuntu on Clouds?

In this section, we will see the detailed step-by-step solution to using Ubuntu on Clouds (GCP). So follow the below steps to use Ubuntu of Clouds without encountering any issues or problems.



Step 1: Select a Cloud Provider

Based on your location and budget explore cloud platforms available like Google Cloud Platform, Amazon Web Services(AWS), Microsoft Azure, Oracle Cloud, etc. Whichever looks good for your requirements choose and proceed with the following steps. Here we are going to use the Google Cloud Platform(GCP).

Step 2: Login to your cloud provider

On your web browser search for Google Cloud or simply visit cloud.google.com. Now login with your existing credentials or create your Google Cloud account. If you are using Chrome browser with your Google account logged in, you will be logged into Google Cloud automatically. Click on Go to Console on the homepage.

Step 3: Create a Virtual Machine

Click on the left sidebar and look for Compute Engine, In the Compute Engine click on VM instances.

After selecting the VM Instances, a list of suboptions will get opened, so from these suboptions, select the option “Create Instance”.

Make the configurations as mentioned below, (leave other settings unchanged).

Below are the boot disk configuration settings which should be done the same.

Once the configuration settings are done, click on Create Instance and wait for a couple of minutes, so that the VM instance gets ready for usage.

Step 4: Configure Ubuntu Desktop using SSH

SSH stands for Secure Shell, and it is a cryptographic network protocol used to secure communication over a computer network. It is typically used for remote access to command-line interfaces on Unix-like operating systems.

Click on the SSH (Secure Socket Shell) button next to your VM instance named ubuntu-desktop and it will open a terminal for you in a new tab.

Once the SSH Terminal window gets opened, then we need to install Ubuntu-Desktip by executing the below commands.

sudo apt-get update
sudo apt-get install ubuntu-desktop

The command sudo apt-get install ubuntu-desktop is used in Ubuntu Linux to install the Ubuntu Desktop environment. The Ubuntu Desktop package includes the default desktop environment for Ubuntu, which is GNOME. It will install the Ubuntu Desktop package along with its dependencies.

Step 5: Choose the Remote Connection Tool

You will need remote desktop software to run Ubuntu remotely on your local PC. There are many software available like Teamviewer, AnyDesk, Nomachine, etc. Choose the one that looks best to you. Here we are going to use Nomachine.

1. For Local PC:

Go to nomachine.com and download your operating system. The Latest version for Windows is 8.10.1 for now.

2. Configure For Ubuntu on the Cloud

On the same page click on Other operating systems option as shown in the below output screenshot.

Choose and machine for Linux and select a machine for Linux DEB amd64.

Now on the next page, Right Click on the download button and select Inspect. This feature allows developers to inspect and manipulate the HTML, CSS, and JavaScript of a webpage in real-time. Find the download link inside the <a> </a> tag and copy it.

Step 6: Configure Remote Desktop on Ubuntu

Once we copy the download link, then we need to navigate back to the SSH terminal and execute the below command in the terminal.

wget  https://download.nomachine.com/download/8.10/Linux/nomachine_8.10.1_1_amd64.deb

Once done, execute the following command to install the downloaded file. The apt install command is part of the Advanced Package Tool (APT) package management system, which simplifies the process of installing, updating, and removing software on Linux System.

apt install ./nomachine_8.10.1_1_amd64.deb

Step 7: Set Firewall Rule

On the VM instances page click on the three dots on the right side of your VM instance, and select View network details.

On the Network details page select Firewall from the left panel. Then click on Create new Firewall Rule.

Set the parameters as mentioned below:

Step 8: Set Firewall Rule for the Virtual Machine

Go back to the VM instances page click on ubuntu-desktop and then click on edit.

On the next page scroll down and find Network tags. Write machine and save.

Step 9: Set the password for your Virtual Machine

After configuring the Firewall successfully, navigate back to the SSH terminal and set the password for the VM by using the passwd command. The passwd command is used to change a user’s password. When you run the passwd command without any arguments, it changes the password for the current user.

passwd

To activate password authentication, open the sshd_config in the nano editor by executing the below command. /etc/ssh/sshd_config is the full path to the SSH server configuration file. This directory typically contains configuration files related to the OpenSSH server, and sshd_config specifically holds settings for the SSH daemon. Scroll down and find passwordAuthentication, and change no to yes.

nano /etc/ssh/sshd_config

Use CTR + X to save and exit from the nano editor.

Now create a user for the desktop by simply running the following command in the SSH terminal.

adduser username

Give the user details and set a password for the user. Now, give all permissions and privileges to the user

usermod -a -G sudo,adm geek

Once done, Reboot the server.

Step 10: Configure the remote desktop

Install the machine on your local PC from the setup file we have downloaded. Click on the .exe file and follow the steps to install. Once installation is done, Open Nomachine in your physical Computer system and click on add.

Name your Desktop and give the external IP from the VM instances tab on GCP. Give port no 4000.

The external IP address is the public-facing address that allows the VM to communicate with the external network, such as the Internet.

Save all and double-click on the icon “Ubuntu on Cloud” created to run Ubuntu on Google Cloud Platform. In the next step, when asked, enter the username and password you have created.

Wait until it connects with the server, and after a few seconds, you will be able to use your Ubuntu desktop running on the Cloud.

Conclusion

In conclusion, the above setup will allow us to remotely access and interact with the Ubuntu desktop environment on our VM, providing flexibility and accessibility from different locations. We can run applications, perform tasks, and manage the Ubuntu environment remotely. We have configured firewalls to restrict unauthorized access but still, we have to monitor and maintain the Ubuntu VM which will help ensure a secure remote desktop experience.


Article Tags :