Cloud Shell is an interactive shell environment for Google Cloud that makes it easy for you to learn and experiment with Google Cloud and manage your projects and resources from your web browser.
Basically we get a Linux shell whenever you need it. :)
My Configuration
1. Change current user password
sudo su
passwd <user> # usually it's just your email prefix
2. Setup customized env
Add zsh installation into $HOME/.customize_environment so that we always have zsh installed for us.
3. Install ohmyzsh
- Use zsh as the default shell.
- For now, I found that I have to use the hack from this gist:
- Add this line to the end of
.bashrc:[ -f /usr/bin/zsh ] && exec /usr/bin/zsh
- Setup timezone in
.zshrc:export TZ=<local_timezone> - Install the plugins you'd like to use, my selection:
# Which plugins would you like to load? # Standard plugins can be found in $ZSH/plugins/ # Custom plugins may be added to $ZSH_CUSTOM/plugins/ # Example format: plugins=(rails git textmate ruby lighthouse) # Add wisely, as too many plugins slow down shell startup. plugins=( git brew docker docker-compose zsh-syntax-highlighting zsh-autosuggestions zsh-completions command-time yarn fasd )
4. Install Homebrew into the home directory
- Use Control-D when it prompts up.
- Set up Homebrew shell integration by appending the following line to your
~/.zshrc:FPATH=$(brew --prefix)/share/zsh/site-functions:$FPATH
5. Use docker in your local machine
I use iTerm2 to use Cloud Shell over SSH in Docker since personally I prefer to use my local Command line.
- First you need to configure the Google Cloud SDK for later use. Since I am using docker, so I'll install it in Docker.
- Then just follow the doc: https://cloud.google.com/sdk/docs/downloads-docker
docker pull gcr.io/google.com/cloudsdktool/cloud-sdk:latest
docker run -ti --name gcloud-config gcr.io/google.com/cloudsdktool/cloud-sdk gcloud auth login
docker run -i -t --name gcloud-instance --volumes-from gcloud-config gcr.io/google.com/cloudsdktool/cloud-sdk gcloud cloud-shell ssh
# From now on:
docker start gcloud-instance && docker exec -i -t gcloud-instance gcloud cloud-shell ssh --authorize-session