Skip to main content

Travel Linux Desktop in Google Cloud

I'm travelling from Tokyo to Singapore and I don't want to lug a laptop with me. I want a full desktop through my Android phone.

So I'm going to:

  1. Provision a Debian Linux VM
     - (Google Cloud Compute Engine VM Instance)
  2. Install Remote Desktop
     - (Chrome Remote Desktop on PC and Android)
  3. Move the VM from Tokyo to Singapore

References

The article 'Launch Ubuntu Desktop on Google Cloud' was very helpful, as was this old article from Google. However their descriptions of the Google Cloud interface are slightly out of date.

Furthermore, Debian (without sound support) was easier to set up, with fewer issues, and is cheaper than Ubuntu Pro (i.e. free).

Wanna do this with me? Let's go!

UPDATE: It cost about AUD$9 to faff about setting up (2 days) and use the VM in Singapore (1 full day), or it would have, had I not been using Free Trial credits. Free compute!

You Will Need ...

  • PC with Chrome
  • Google Account
  • ... to have signed into Google Cloud
  • Android phone with Google Play
  • Internet Connection

Provision VM

Create Project

Create a New Project in Google Cloud Console.

Enable Compute VMs in Project

In the project Dashboard, enable Compute Engine as a 'resource'

This will add Compute Engine to your Dashboard.

If you haven't already, you will be asked to set up Billing.

Create a VM

Click 'Create Instance'

A configuration screen will appear. I'll go through some of my options below.

The standard e2 option is fine.

The only thing I changed was to go from a 10GB to a 20GB disk because I'm a windowing system hoarder 😁. I also need to use big office software like Chrome and Thunderbird.

In terms of OS, Ubuntu 24.10 free version had some hassles, and I wasn't prepared to pay for Pro. Debian just worked out of the box.

In 'Advanced', you can choose 'Spot' pricing, which means a reduced rate with the risk of getting booted if demand spikes. I'd pick that if I weren't using my 3 months' free credit.

Click 'Create' and your instance will be up and running!

Enable Remote Desktop

Desktop setup

Click on 'SSH' to connect through a browser-based terminal.

Note the 'Upload File' and 'Download File' buttons that may come in handy later.

Moving on, the following commands will:

  • Find and apply updates.
  • install 'wget' and 'tasksel' to ... help install more programs.

Enter them into the prompt.

sudo apt update && sudo apt upgrade -y
sudo apt install wget tasksel -y

('-y' answers 'yes' to any questions and is equivalent to '--assume-yes')

Install Desktop Environments with Tasksel

If you know the package name, you can do this from the command line:

sudo tasksel install gnome

But I like to use the GUI. To do so, enter:

sudo tasksel

And make your selections before pressing 'OK'.

After some time you will be returned to a command prompt.

Remote Desktop setup

On your local/client PC, open the Chrome Remote Desktop website in your browser and go to 'Set Up Via SSH', then 'Begin'.

Note that you need to download a file. There are two ways to do this:

The quickest is to use wget through the command line:

wget https://dl.google.com/linux/direct/chrome-remote-desktop_current_amd64.deb

OR, click on the link to download it to your local PC, then use the 'Upload File' button to copy it into your home directory on the VM.

Either way, once downloaded enter this command to install it:

sudo apt install -y ./chrome-remote-desktop_current_amd64.deb

Choose (Remote) Desktop

To tell Remote Desktop which Environment to use, a file needs to be created/edited.

This can be done through the command line:

sudo bash -c ‘echo “exec /etc/X11/Xsession /usr/bin/gnome-session” > /etc/chrome-remote-desktop-session’

OR, create/edit the file '/etc/chrome-remote-desktop-session'. I use the 'pico' text editor.

sudo pico /etc/chrome-remote-desktop-session

Add the line:

exec /etc/X11/Xsession /usr/bin/gnome-session

CTRL-O-CTRL-X writes your changes and exits. 

But wait! What if you don't want to use Gnome? As you can see from tasksel, I also installed Xfce. So in my file, the line above would read:

exec /etc/X11/Xsession /usr/bin/xfce4-session

Similarly for Cinnamon, MATE, etc.

Once that's done, reboot the VM.

sudo reboot

... then connect to it again through a browser-based SSH session to continue.

Register Host with Remote Desktop

Back to the Remote Desktop site on your local PC browser, click 'Next' then 'Authorise'

Copy-paste the 'Debian Linux' command into your VM's command line.

You'll be asked to create a six-digit PIN. Don't be too concerned about any error messages.

At this point you might want to run:

sudo apt clean

... to clean packages and free up space.

Test (PC)

On your local PC browser your VM should now be listed in 'Remote Access'.

Click through, enter the PIN, and you're in!

Test (Android)

From Google Play Store, install two apps published by Google:

  • Google Cloud
  • Chrome Remote Desktop

Start and stop your instance using the Google Cloud app.

Use the Remote Desktop app to access your VM.



Cleanup

Password-less Superuser (sudo)

Google creates a username for your VM based on your Google account. As you can see, mine is 'dtcwee'.

While your username has near-unlimited access through the browser-based terminal (explained here), it is restricted in the remote desktop. For example, 'sudo' in a terminal window will ask you for a password.

Let's fix that.

In browser-based SSH, typing in 'groups' will show your username in the 'adm' group.

We're going to give it password-less access in sudo.

visudo

Will start the sudoers file editor. It also checks for errors, making it superior to directly editing the file.

Look for the line:

%sudo ALL=(ALL:ALL) ALL

and replace it with:

%sudo ALL=(ALL:ALL) NOPASSWD:ALL 
%adm ALL=(ALL:ALL) NOPASSWD:ALL

CTRL-O, CTRL-X saves and exits. 

This reduces reliance on the browser-based terminal for tasks like installing software.

Desktop Setup

Now is the time to set up your desktop as you like it. Set up all the programs you want, like browsers and mail clients, and sign in to your services.

Now let's 'move' the instance to Singapore. The steps are roughly:

  1. Create a machine image based on the VM instance in Japan
  2. Create an instance from the image in Singapore
  3. Set up remote desktop on the new instance

Move the VM

Create Machine Image

Just to be safe, shut down the VM.

From the VM list, select 'Create new machine image' from the actions menu. 

This creates a 'snapshot' of the instance, including your programs, and desktop.

I like to create the image in the destination zone/country.

Once you click 'Create', you will see it in a list of images.


Create Instance from Image

From the 'Actions' menu, choose 'Create instance' to create an instance from the image.


The instance will be created running.

Set up Remote Desktop

The new instance is a brand new VM. The final step is to re-register it with Chrome Remote Desktop.

Open up browser-based SSH again. To refresh your memory, here it is on the old VM. 

Follow the steps in 'Register Host in Remote Desktop' above. To jog your memory, open a local browser to Chrome Remote Desktop SSH setup.

Once that's done, it will appear as another machine in Chrome Remote Desktop.

And that's it!

Remote desktop between Tokyo and Singapore is possible, so I arguably could have created and configured the VM in Singapore and skip the whole imaging part. However, the connection is almost choppy enough to be annoying. Maybe next time.

Before I leave, I'm going to delete the Tokyo VM and shutdown the Singapore one.

See you when I get back!

Comments

Popular posts from this blog

Transcode to PSP using Handbrake

Source: Handbrake 0.9.9.5530 64-bit edition Target: (Phat) Playstation Portable PSP-1000 , System Software: 6.60 Many internet articles on how to transcode video to PSP using Handbrake have not worked for me. Even the most helpful are incomplete. I hope this post will help fill in the blanks. There is no longer any PSP preset for Handbrake, but from what I can gather, the preset had only limited success as the x264 encoder would change syntax and settings between versions. Other presets that may have worked before, like 'iPod' and 'Apple-Universal' now do not. Here is what worked for me, step by step:

Scatterbox - build an Android Tor Socks Proxy Server

Cloak your location and create a firewall bypass device with a smartphone. 🕵Uses the Tor network . Does not require root. 1 - from Google Play, download and install: Orbot Orweb browser Socks Server Ultimate (Optional)

Firefox History Statistics - Extracting from Places.sqlite

If you want to take a look at Firefox surfing activity, the about:me add-on is a good start. However, it presents only one view of data and is thus limited in its ability to present more detailed statistics. We will view that data in a different program. So let's first extract it from the browsing history stored in the Places.sqlite file into a CSV file using a Firefox add-on. Step 1 - Locate and copy Places.sqlite to a working location On Windows machines, Places.sqlite is found in a directory similar to: C:\Users\User1\AppData\Roaming\Mozilla\Firefox\Profiles\ .default\places.sqlite Copy the file to another location. The database will be locked while using Firefox, and the SQLite plugin we will use to open it.