How to run gcloud on Chromebook

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
  6. > gcloud install
  7. > gcloud components update
  8. 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.
  9. I also loaded two nice Chrome extensions from the webstore – Secure Shell and an app that launches your crosh shell in a window.
  10. > cd ~/Download
  11. > git clone – which puts it in the folder ~/Download/yourproject
  12. Now if you try “gcloud deploy” it won’t work. You have to do
  13. cd yourproject
  14. > gcloud beta deploy ./app.yaml –project=yourproject –version=1
  15. The first time you run it it will load additional stuff into gcloud but not thereafter.
  16. 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.