How to run gcloud on Chromebook

UPDATE: per changes in gcloud

Ok – my new best friend is Chromebrew – a lightweight package manager that lets you run linux programs in Chromebook developer mode without having to install a whole operating system. 

I needed it because (a) I develop and deploy code from my chromebook using github and Google’s Cloudshell virtual linux machine and (b) lately, Cloudshell has not been reliably available.

Here is what I needed to learn and do:

  1. Get my chromebook into developer mode, which on my machine (Acer C740) requires holding esc-Refresh and hitting the power key. That gets you to the Recovery Screen. Hit Ctrl-D (there’s no prompt). It will ask you to confirm, then reboot into dev-mode. Eventually it will show the scary boot screen and you just hit Ctrl-D again.
  2. Enter crosh (the terminal) with Ctrl-Alt-T and type shell.
  3. Learn how to copy and paste – inside crosh you use Ctrl-Shift-C and V instead of just Ctrl-C and V.
  4. Install chromebrew via curl -Ls | bash
  5. Install gcloud via: > crew install google_cloud_sdk — this will take about 5 minutes and will ask you to run two commands – gcloud install and gcloud init which will ask you to login – which will require copying and pasting from the shell to the browser and back, which is why you need point 3 above.
  6. > gcloud components update
  7. Next I had to figure out where I could put my source code for my project. The only folders you can write in are either /usr/local and ~/Download. The latter has a huge advantage because the caret editor already installed will work in that area. I tried >crew install nano but nano was very “jumpy” running in the shell tab.
  8. I also loaded two nice Chrome extensions from the webstore – Secure Shell and an app that launches your crosh shell in a window.
  9. > cd ~/Downloads
  10. > git clone – which puts it in the folder ~/Downloads/yourproject
  11. >gcloud app deploy ./app.yaml
  12. Just for fun, I also tried >crew install php and chose the latest version. This is really handy because php includes its own webserver – you can do >php -S localhost:8000 which you can use to test your app from your chrome browser.  It includes sqlite which – if you code using PDO – you can even try out things you will later run in mysql.