Assumptions
- Netbook set up with SSH key pair
Create project
We need a Google Cloud project to own workstation VM instances. It’s helpful to make it independent of other projects.
Create instance
In Google Cloud console:
- Nav to Compute Engine and create new micro instance
- Name “ubuntu”
- Region “us-west”
- Size “custom (1 vCPU, 4 GB memory)”, so we have enough memory to install things like Ruby and IntelliJ
- OS Ubuntu LTS
- Start instance
- Copy external IP address
SSH access
Enable laptop to connect to cloud instance, as described in the project-wide SSH keys documentation. In Google Cloud console:
- Search for “SSH key” and select “metadata”
- Copy public key contents from local machine using Text and paste into Cloud console
- Open Secure Shell on local machine, select key, paste IP address and connect
GitHub
Define an SSH key pair to enable communication with GitHub:
- Define SSH key pair, per github SSH key generation docs:
ssh-keygen -t rsa -b 4096 -C '<project>.<instance>@<cloud provider>'
- Copy public key contents into GitHub settings
Vim
- Copy over `.vimrc` from dotfiles repo
- Launch vim and install plugins defined in vimrc: `:PlugInstall`
Desktop
The Chrome Remote Desktop (CRD) docs are pretty good, but assume you already have a desktop with Chrome running. For a cloud VM, we need a way to bootstrap without a desktop. A couple (1, 2) Chrome support threads were helpful. Steps:
- Install lightweight window manager:
sudo apt install -y xubuntu-desktop
- Download CRD:
wget https://dl.google.com/linux/direct/chrome-remote-desktop_current_amd64.deb
- Install CRD:
sudo dpkg -i chrome-remote-desktop_current_amd64.deb
- Define ~/.chrome-remote-desktop:
exec /usr/sbin/lightdm-session "startxfce4"
Note: misconfiguration of this file (including misnaming) results in “… Session process terminated … ” errors. - Restart CRD to load the config:
sudo /etc/init.d/chrome-remote-desktop restart
- Use http://remotedesktop.google.com/headless to generate the command required to register a host and set an access pin (credit), and then run this command on the workstationNote: we used to have to edit the Compute Engine instance firewall to enable udp:all and tcp:443,5222 open for ingress and egress, but this no longer seems required
- On the netbook, launch CRD app, select the host created above and enter the access pin you defined