今回はmac bookにGoogle Cloud PlatformのSDKである、Cloud SDKをインストールしたいと思います。
手順
1.wgetコマンドでSDKをダウンロードします。
▼Mac OS X(x86_64)
wget https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-158.0.0-darwin-x86_64.tar.gz
▼Mac OS X(x86)
https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-158.0.0-darwin-x86.tar.gz
uname -aでどっちを入れればいいか確認できます。
uname -a Darwin xxxxxxx-Pro.local 16.7.0 Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64
2.ファイル解答
tar xvf google-cloud-sdk-158.0.0-darwin-x86_64.tar.gz
3.SDKインストール
cd google-cloud-sdk/ ./install.sh Welcome to the Google Cloud SDK! To help improve the quality of this product, we collect anonymized usage data and anonymized stacktraces when crashes are encountered; additional information is available at <https://cloud.google.com/sdk/usage-statistics>. You may choose to opt out of this collection now (by choosing 'N' at the below prompt), or at any time in the future by running the following command: gcloud config set disable_usage_reporting true Do you want to help improve the Google Cloud SDK (Y/n)? y Your current Cloud SDK version is: 158.0.0 The latest available version is: 172.0.1 ┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ Components │ ├──────────────────┬──────────────────────────────────────────────────────┬──────────────────────────┬───────────┤ │ Status │ Name │ ID │ Size │ ├──────────────────┼──────────────────────────────────────────────────────┼──────────────────────────┼───────────┤ │ Update Available │ BigQuery Command Line Tool │ bq │ < 1 MiB │ │ Update Available │ Cloud SDK Core Libraries │ core │ 6.7 MiB │ │ Update Available │ Cloud Storage Command Line Tool │ gsutil │ 3.0 MiB │ │ Not Installed │ App Engine Go Extensions │ app-engine-go │ 97.7 MiB │ │ Not Installed │ Cloud Bigtable Command Line Tool │ cbt │ 4.0 MiB │ │ Not Installed │ Cloud Bigtable Emulator │ bigtable │ 3.5 MiB │ │ Not Installed │ Cloud Datalab Command Line Tool │ datalab │ < 1 MiB │ │ Not Installed │ Cloud Datastore Emulator │ cloud-datastore-emulator │ 15.4 MiB │ │ Not Installed │ Cloud Datastore Emulator (Legacy) │ gcd-emulator │ 38.1 MiB │ │ Not Installed │ Cloud Pub/Sub Emulator │ pubsub-emulator │ 33.2 MiB │ │ Not Installed │ Emulator Reverse Proxy │ emulator-reverse-proxy │ 14.5 MiB │ │ Not Installed │ Google Container Local Builder │ container-builder-local │ 3.7 MiB │ │ Not Installed │ Google Container Registry's Docker credential helper │ docker-credential-gcr │ 2.2 MiB │ │ Not Installed │ gcloud Alpha Commands │ alpha │ < 1 MiB │ │ Not Installed │ gcloud Beta Commands │ beta │ < 1 MiB │ │ Not Installed │ gcloud app Java Extensions │ app-engine-java │ 130.9 MiB │ │ Not Installed │ gcloud app PHP Extensions │ app-engine-php │ 21.9 MiB │ │ Not Installed │ gcloud app Python Extensions │ app-engine-python │ 6.3 MiB │ │ Not Installed │ kubectl │ kubectl │ 15.9 MiB │ └──────────────────┴──────────────────────────────────────────────────────┴──────────────────────────┴───────────┘ To install or remove components at your current SDK version [158.0.0], run: $ gcloud components install COMPONENT_ID $ gcloud components remove COMPONENT_ID To update your SDK installation to the latest version [172.0.1], run: $ gcloud components update Modify profile to update your $PATH and enable shell command completion? Do you want to continue (Y/n)? y The Google Cloud SDK installer will now prompt you to update an rc file to bring the Google Cloud CLIs into your environment. Enter a path to an rc file to update, or leave blank to use [/Users/ishikawashougo/.bash_profile]: Backing up [/Users/xxxxxxx/.bash_profile] to [/Users/xxxxxxx/.bash_profile.backup]. [/Users/xxxxxxx/.bash_profile] has been updated. ==> Start a new shell for the changes to take effect. For more information on how to get started, please visit: https://cloud.google.com/sdk/docs/quickstarts
4.bash_profileを再読み込みします。
source ~/.bash_profile
5.SDKの初期化をします。
gcloud init
ブラウザが開かれるので、Cloud SDKを許可します。以下の画面表示されれば、OKです。
リポートコンソールからの作業だと、ブラウザを開けないので、そのときは、--console-onlyオプションを付けます。
gcloud init --console-only
さいごに
Cloud SDKを使って色々試してみようと思います。