How to Install Debian 10 (Buster) or Ubuntu 18/19 Desktop on Google Cloud and access through VNC

Amit Shukla
6 min readSep 17, 2019

--

If you are a developer looking for high end Pro machine with out big initial investment. These cloud virtual machines could be a great alternative for you.

In this article, We will setup Debian 10 (buster) Virtual machine on Google Cloud with all goodies (Libreoffice, firefox, chrome etc.) and high end developers tools Like NodeJS, JAVA, VSCode, IntelliJ, Flutter/Dart, Python so that you can code for Web Apps, Java, Kotlin, Python, Dart/Flutter, Scala, AI and Big Data languages.

Let’s get started.

Before you begin
Make sure that billing is enabled for your Google Cloud Platform project.
Then, go to https://console.cloud.google.com
Browse to Computer Engine -> VM Instances -> New VM Instance

#1. Give this VM Machine a logical name.
#2. Chose the region
#3. and zone (#3) you want this machine to host.
#4. Pick a machine type depending on your computing need.
( My personal favorite is the one with ~8GB RAM)
#5. Please change boot disk type according to the size as per your need.
(My personal opinion is 12–15GB so that you can accommodate most of development tools like Android Studio, Anaconda etc.), if not 10GB is enough. and I assume, you will not use this VM as data storage
(Google/Cloud drive are more suitable for your data storage purpose)
#6. Now, chose VM type you want to pick (#6a or #6b or #6c).
All Linux options like Debian 10 (buster) or Ubuntu are great.
#6a. My personal opinion is, If I intend to use Linux for mostly free apps on a lightweight/fast UI, I would pick Debian 10.
#6b. and If, I must use lots of free and perhaps sometimes paid software on cool UI and don’t mind a little bit of size, Ubuntu is my preferred choice.
#6c. If you don’t like any of the hassle for setting up development/UI environment discussed below, Nothing beats old good windows environment. You don’t need to read any further, just pick Windows Server 2012 or 2019 and access your Windows desktop right away.

I will cover two different ways to access your Google Cloud Linux VM.

  1. Setting up Chrome Remote Desktop on Compute Engine to access Linux Debian Buster VM
    Google cloud now supports Debian/Linux access through Chrome Remote Desktop. Google article (Link) explains, how to setup Xfce or Cinnamon UI desktop.
  2. Setting up VNC to access Debian 10 / Ubuntu 18.04/19.04 Linux VM

In few minutes, you should be able to see your Linux VM instance ready.

After you start your VM Machine.
Clicking on SSH will open a terminal window in your browser.
Don’t forget to stop your VM Instance to avoid billing when you don’t need it.

Inside you SSH Terminal window, issue these commands one by one.

// check VM config
$ free -m
$ uname -a
$ lsb_release -a
// update the source list
$ sudo apt-get update
$ sudo apt-get upgrade

Install Chrome Remote Desktop (CRD) on Linux VM
(skip this step if you are planning to use only vncserver, however it doesn’t hurt to setup this option along with vncserver)

// download CRD installation package
$ wget https://dl.google.com/linux/direct/chrome-remote-desktop_current_amd64.deb
$ sudo apt update
// install package and dependencies
$ sudo dpkg --install chrome-remote-desktop_current_amd64.deb
$ sudo apt install --assume-yes --fix-broken

Option A. Install Linux UI — XFCE Desktop Interface
(Simple lightweight desktop UI, please skip this, if you want to use only Cinnamon Desktop UI)

$ sudo DEBIAN_FRONTEND=noninteractive \
apt install --assume-yes xfce4 desktop-base
// setup CRD to use xfce ui by default
$ sudo bash -c 'echo "exec /etc/X11/Xsession /usr/bin/xfce4-session" > /etc/chrome-remote-desktop-session'
// update screensaver to be used in CRD
$ sudo apt install --assume-yes xscreensaver
// install all goodies packages like (libreoffice and firefox etc)
$ sudo apt install --assume-yes task-xfce-desktop
// disable display service on your VM
$ sudo systemctl disable lightdm.service
// install chrome browser
$ wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
$ sudo dpkg --install google-chrome-stable_current_amd64.deb
$ sudo apt install --assume-yes --fix-broken

Option B. Install Linux UI — Cinnamon Desktop Interface
(full feature traditional desktop UI)

$ sudo DEBIAN_FRONTEND=noninteractive \
apt install --assume-yes cinnamon-core desktop-base
// setup CRD to use cinnamon in 2D mode
$ sudo bash -c 'echo "exec /etc/X11/Xsession /usr/bin/cinnamon-session-cinnamon2d" > /etc/chrome-remote-desktop-session'
// install all goodies packages like (libreoffice and firefox etc)
$ sudo apt install --assume-yes task-cinnamon-desktop
// disable display service on your VM
$ sudo systemctl disable lightdm.service
// install chrome browser
$ wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
$ sudo dpkg --install google-chrome-stable_current_amd64.deb
$ sudo apt install --assume-yes --fix-broken

Setup Chrome Remote Desktop Service
Reference: These steps are taken from Google Cloud document. Link

Install VNC Server
(This is an alternate way to access your Linux VM)

// install VNC4SERVER or TIGHTVCNSERVER for Linux SXFCE UI Interface
// Linux CINNAMON doesn't work well with above VNCSERVERs
// For CINNAMON install x11vnc server instead
$ sudo apt-get install tightvncserver// Start your VNCSERVER once to create xstartup file
// and setup default password
$ vncserver
// :1 means, VNCSERVER is listening at 5900+1=5901 port
// give appropriate password for vnc access
$ vncserver -kill :1
// kill your vncserver now, so that, can update xtartup config to start xfce interface automatically
$ vim .vnc/xstartup
// above command will open startup file in vi editor
// press (i) insert to
// comment everything else and add
startxfce4 &
// :wq// start vncserver again
vncserver -geometry 1920x1080
// Go to any vncviewer and type your external IP xx.xx.xx.xx:5901
// Provide password for vnc access
>> go to Google Cloud -> VM Instance > Default > Network
>> setup a new firewall rule

Install JAVA

// adding java 12$ sudo apt update
$ sudo apt upgrade
$ echo “deb http://ppa.launchpad.net/linuxuprising/java/ubuntu bionic main” | sudo tee /etc/apt/sources.list.d/linuxuprising-java.list
$ sudo apt install dirmngr
$ sudo apt-key adv — keyserver hkp://keyserver.ubuntu.com:80 — recv-keys 73C3DB2A
$ sudo apt update
$ sudo apt install oracle-java12-installer
$ java — version
$ sudo apt install oracle-java12-set-default
$ sudo update-alternatives — config java
// note path for java 12 and copy it over
// like /usr/lib/jvm/java-12-oracle/bin/java
// JAVA_HOME=”/usr/lib/jvm/java-12-oracle”
$ vim /etc/environment
add
JAVA_HOME=”/usr/lib/jvm/java-12-oracle/bin/java”
$ source /etc/environment
$ echo $JAVA_HOME

Install VSCode, Android Studio, IntelliJ, Python & NodeJS, Angular
& Setup IntelliJ to Code in kotlin, Java, Scala, Python, Dart & Flutter

$ sudo apt-get update
// if curl package is not installed
$ sudo apt-get install curl gnupg -y
// nodejs version 12
$ curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
$ sudo apt-get install -y nodejs
// Install Pycharm
$ sudo apt install snapd
// $ sudo snap install [pycharm-professional|pycharm-community] --classic
$ sudo snap install pycharm-community --classic
// Install IntelliJ IDE
$ sudo snap install intellij-idea-community --classic
// Install Angular CLI
$ npm install -g @angular/cli
// Install vscode
$ sudo apt update
$ sudo apt install software-properties-common apt-transport-https wget
$ wget -q https://packages.microsoft.com/keys/microsoft.asc -O- | sudo apt-key add -
$ sudo add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main"
$ sudo apt update
$ sudo apt install code
// Android Studio
// download latest .deb copy
// from https://developer.android.com/studio
// extract all zip file
// open terminal window and go to Android -> bin directory
$ ./studio.sh
// follow online instructions to install Android Studio
** Note - Android Sutdio emulators are NOT supported in Google Windows/Linux VMs

--

--

Amit Shukla
Amit Shukla

Written by Amit Shukla

Build and Share Quality code for Desktop and Mobile App Software development using Web, AI, Machine Learning, Deep Learning algorithms. Learn, Share & Grow.

Responses (2)