Setting up a GCE based linux machine with multiple persistent disks & GUI

Create a Machine

Create a machine with your required specifications and label it “vnc-server”.

Your machine comes with a boot disk automatically but once you add an additional persistent data disk, you need to think about formatting and mounting as part of the process. Uncheck “delete boot disk when instance is deleted”  so you can cannot mistakenly delete your hard work.  You will probably find for some projects you will want to resize your machine for faster compilations.

Here are some useful links to help with that.  I will flesh this out over time but for now, here are my sources that helped get this going.

https://www.digitalocean.com/community/tutorials/how-to-partition-and-format-storage-devices-in-linux
https://askubuntu.com/questions/626353/how-to-list-unmounted-partition-of-a-harddisk-and-mount-themhttps://www.cyberciti.biz/faq/mount-drive-from-command-line-ubuntu-linux/

–This site describes the process.  Just be careful of the /etc/fstab update because following the instructions burnt me
https://cloud.google.com/compute/docs/disks/local-ssd

Now install a remote accessible GUI

–Added a 250 GB disk and mounted it under /mnt/disks/data

sudo apt-get install gnome-core

sudo apt-get install vnc4server
–open the GCE firewall to tag vnc-server and forward 5901
–install java https://tecadmin.net/install-oracle-java-8-ubuntu-via-ppa/#
–install eclipse http://www.krizna.com/ubuntu/install-eclipse-ubuntu-14-04/

Configure remote access

set the resolution of vncserver, when you run
  • vncserver :1 -geometry 1024×768 -depth 24
  • You can automatically run vnc on restart by following this link.
    Adding:
  • /etc/init.d/vncserver
    ~/.vnc/xstartup

Create a new cert locally if you dont have one using:

ssh-keygen -t rsa -C “{email address}”

Give the key pair a name so you dont mess with your defaults.

copy the public key up to the machine you want to connect to ({key pair name}.pub)

You will also need to run an ssh tunnel locally, to use your certificate to connect.

ssh -N -i ~/.ssh/{key pair name} -L 5902:127.0.0.1:5901 -2 {user name in cert}@{remote machine ip address}

Do the above for vnc access. 590x where x corresponds to the session number (normally 1).

You then just connect to localhost::5902 and you are in.

 


xstartup is slightly different for gnome.  Write this to xstartup

#!/bin/sh
# Uncomment the following two lines for normal desktop:

unset SESSION_MANAGER
#[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
#[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources

x-window-manager &
metacity &
gnome-settings-daemon &
gnome-panel &

——————————————————————–
–install node 9

curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash –

sudo apt-get install -y nodejs

When ssh’ing in remember that you need the public key on the target corresponding to a private key stored locally.

Use the -i parameter to tell ssh which cert to use:

ssh -i ~/.ssh/{key pair name}  {correponding user}@xxx.xxx.xxx.xxx

qualify with the user name from the certificate.

Install IntelliJ Idea

Download idea from the intellij web site

https://stackoverflow.com/questions/30130934/how-to-install-intellij-idea-on-ubuntu

 

 

What you now have is a cloud based development box that you could use from anywhere, including your slick new chrome book.  You can also dial in as much power as you require.  Just remember not to leave it running as you will start to pay real money for it.  I have been using my cloud dev box for a couple of months and I can get away with under $30 per month of costs.

 

Install Atom, for Python scripting

https://codeforgeek.com/2014/09/install-atom-editor-ubuntu-14-04/

 

Leave a comment

Your email address will not be published. Required fields are marked *

Bitnami