Skip to content

Instantly share code, notes, and snippets.

@kenzo0107
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kenzo0107/1069bf81a884c71a746a to your computer and use it in GitHub Desktop.
Save kenzo0107/1069bf81a884c71a746a to your computer and use it in GitHub Desktop.

Google Cloud SDKインストール

参照: https://cloud.google.com/sdk/

環境

  • MacOSX Yosemite 10.10.3

インストール手順

1. 以下コマンド実行

$ curl https://sdk.cloud.google.com | bash
※zshを利用している場合、profile修正を.zshrcでする必要がある。

参照: http://dackdive.hateblo.jp/entry/2014/11/22/155020

以下のようにprofileを修正するか尋ねられる。

zshを利用している場合修正する必要があるのでYと入力しEnter

Modify profile to update your $PATH and enable bash completion? (Y/n)? Y (← Y と入力しEnter)
The Google Cloud SDK installer will now prompt you to update an rc
file to bring the Google Cloud CLIs into your environment.

Enter path to an rc file to update, or leave blank to use
[/Users/*****/.bash_profile]:  /Users/*****/.zshrc (利用している.zshrcのパスを入力しEnter )
Backing up [/Users/*****/.zshrc] to [/Users/*****/.zshrc.backup].
[/Users/*****/.zshrc] has been updated.
Start a new shell for the changes to take effect.

.zshrcに以下追記されたことを確認。

# The next line updates PATH for the Google Cloud SDK.
source '/Users/*****/google-cloud-sdk/path.bash.inc'

# The next line enables bash completion for gcloud.
source '/Users/*****/google-cloud-sdk/completion.bash.inc'

このままでは利用できません。

zsh用のファイルに変更してください。

# The next line updates PATH for the Google Cloud SDK.
source '/Users/*****/google-cloud-sdk/path.zsh.inc'

# The next line enables bash completion for gcloud.
source '/Users/*****/google-cloud-sdk/completion.zsh.inc'

上記修正後、再読込。

エラーなどないことを確認して完了。

$ source /Users/*****/.zshrc

2. インストール確認

$ gcloud --version
Google Cloud SDK 0.9.66

bq 2.0.18
bq-nix 2.0.18
compute 2015.06.22
core 2015.06.22
core-nix 2015.06.02
dns 2015.06.22
gcloud 2015.06.22
gcutil-msg 2015.06.09
gsutil 4.13
gsutil-nix 4.12
sql 2015.06.22

3. Google Cloud Platform 認証

以下コマンド実行するとブザウザが起動するの認証する。

$ gcloud auth login

認証ページ

認証すると以下のようにPROJECT_IDを設定する様、促される。

Saved Application Default Credentials.

You are now logged in as [kenzo.tanaka0107@gmail.com].
Your current project is [None].  You can change this setting by running:
  $ gcloud config set project PROJECT_ID

PROJECT_IDはDeveloper Consoleで確認する

Developer Console

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment