GCP-CLI notebook

The First thing you need is, of course, to create a Google account and establish a cloud service.

On Windows

Assume than you install Ubuntu.

By WSL

  1. Install Linux subsystem.
  2. Install Ubuntu distro for WSL.
  3. Install Google Cloud CLI

By VirtualBox

If you don't feel like installing WSL, maybe VirtualBox is your friend.

  1. Download Ubuntu ISO.
  2. Install Ubuntu on VirtualBox by ISO file.
  3. Go Install Google Cloud CLI

Install Google Cloud CLI

  1. Wherever you install your Ubuntu, you should now be in a Ubuntu shell. If so, open the installation guide and select Debian/Ubuntu on the manual.
  2. After installing, log in by Google Cloud CLI with your account. When login succussed and entered the cloud shell, exit.
  3. Now type gcloud cloud-shell ssh --ssh-flag "-L 8080:localhost:80" --ssh-flag "-L 33306:localhost:3306" --ssh-flag "-L 2222:localhost:22"

Try Git and composer

There are two ways to upload/download files to Google Cloud Shell: Git or FTP. The former need to buy some books...

Actually, since the cloud shell SSH has installed git and composer, so...

How to Git

Test Git

  1. git clone https://github.com/Azure-Samples/html-docs-hello-world.git
  2. mv html-docs-hello-world html-test
  3. Access http://127.0.0.1:8080/html-test/

You should see the "Azure App Service" page even though it's not.

Test composer

  1. composer create-project laravel/laravel laravel-app --prefer-dist
  2. cd laravel-app
  3. sudo chmod -R ugo+rw storage
  4. Access http://127.0.0.1:8080/laravel-app/

You should see a Laravel page.


Oh, by the way, you can upload/download indirectly by pushing your app to Github, then pulling it from your Google Cloud Shell.

References