Google Cloud SDK 설치/제거 메모 (공식 버전)

소개



Firebase와 Google Cloud Platform을 포함한 환경 구축/Google Cloud Platform용 CLI 설치 에서 gcloud 명령을 설치하는 절차를 정리했지만 brew cask 에서 하는 것보다 공식적인 것이 간단하고 좋았기 때문에, 그 쪽의 순서의 메모. . 그렇다고해도 거의 공식을 뒤쫓았다 정도입니다,,,,.

전제 환경


$ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.14.6
BuildVersion:   18G95
$

설치



h tps : // c ぉ d. 오, ぇ. 이 m / sdk / 도 cs / 도 w 응 아 ds - 엔테라 c 치 ゔ? hl = 그럼 을 참고로 실행해 갑니다.

$ curl https://sdk.cloud.google.com | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   443  100   443    0     0   1346      0 --:--:-- --:--:-- --:--:--  1346
Downloading Google Cloud SDK install script: https://dl.google.com/dl/cloudsdk/channels/rapid/install_google_cloud_sdk.bash
######################################################################## 100.0%
Running install script from: /var/folders/fp/ph0q_b6s64v9pmpbn8x547400000gp/T/tmp.XXXXXXXXXX.G4GMjyqO/install_google_cloud_sdk.bash
which curl
curl -# -f https://dl.google.com/dl/cloudsdk/channels/rapid/google-cloud-sdk.tar.gz
######################################################################## 100.0%

Installation directory (this will create a google-cloud-sdk subdirectory) (/Users/xxxxxx):   'インストール先の指定'

...ぶわーっとでるので省略...

/Users/xxxxxx/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)?   'とりあえずreturn'


This will install all the core command line tools necessary for working with
the Google Cloud Platform.



Your current Cloud SDK version is: 263.0.0
Installing components from version: 263.0.0

┌────────────────────────────────────────────────────────────────────────────┐
│                    These components will be installed.                     │
├─────────────────────────────────────────────────────┬────────────┬─────────┤
│                         Name                        │  Version   │   Size  │
├─────────────────────────────────────────────────────┼────────────┼─────────┤
│ BigQuery Command Line Tool                          │     2.0.47 │ < 1 MiB │
│ BigQuery Command Line Tool (Platform Specific)      │     2.0.46 │ < 1 MiB │
│ Cloud SDK Core Libraries (Platform Specific)        │ 2019.08.16 │ < 1 MiB │
│ Cloud Storage Command Line Tool                     │       4.42 │ 3.6 MiB │
│ Cloud Storage Command Line Tool (Platform Specific) │       4.42 │ < 1 MiB │
│ Default set of gcloud commands                      │            │         │
│ gcloud cli dependencies                             │ 2018.08.03 │ 1.5 MiB │
└─────────────────────────────────────────────────────┴────────────┴─────────┘

For the latest full release notes, please visit:
  https://cloud.google.com/sdk/release_notes

╔════════════════════════════════════════════════════════════╗
╠═ Creating update staging area                             ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: BigQuery Command Line Tool                   ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: BigQuery Command Line Tool (Platform Spec... ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: Cloud SDK Core Libraries (Platform Specific) ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: Cloud Storage Command Line Tool              ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: Cloud Storage Command Line Tool (Platform... ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: Default set of gcloud commands               ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: gcloud cli dependencies                      ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Creating backup and activating new installation          ═╣
╚════════════════════════════════════════════════════════════╝

Performing post processing steps...done.

Update done!



To take a quick anonymous survey, run:
  $ gcloud alpha survey


Modify profile to update your $PATH and enable shell command
completion?

Do you want to continue (Y/n)?   'とりあえずreturn'

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/xxxxxx/.bash_profile]:
Backing up [/Users/xxxxxx/.bash_profile] to [/Users/xxxxxx/.bash_profile.backup].
[/Users/xxxxxx/.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

~/.bash_profile 가 다시 작성된 것 같으므로 일단 확인.
$ cat ~/.bash_profile
...
# The next line updates PATH for the Google Cloud SDK.
if [ -f '/Users/xxxxxx/google-cloud-sdk/path.bash.inc' ]; then . '/Users/xxxxxx/google-cloud-sdk/path.bash.inc'; fi

# The next line enables shell command completion for gcloud.
if [ -f '/Users/xxxxxx/google-cloud-sdk/completion.bash.inc' ]; then . '/Users/xxxxxx/google-cloud-sdk/completion.bash.inc'; fi

$

패스를 통하는 처리가 추가되고 있네요.
계속해서, 쉘의 재기동을 실시.
$ exec -l $SHELL
$

사이고에, 환경의 초기화를 합니다. 예를 들어 Firebase 등을 함께 사용하면 해당 로그인 사용자(아래에서 [email protected] )와 프로젝트 이름( fb-samples-xxxxx 등)은 정해져 있다고 생각하므로, 그들을 지정합시다.
$ gcloud init
Welcome! This command will take you through the configuration of gcloud.

Your current configuration has been set to: [default]

You can skip diagnostics next time by using the following flag:
  gcloud init --skip-diagnostics

Network diagnostic detects and fixes local network connection issues.
Checking network connection...done.
Reachability Check passed.
Network diagnostic passed (1/1 checks passed).

You must log in to continue. Would you like to log in (Y/n)?

Your browser has been opened to visit:

    https://accounts.google.com/o/oauth2/auth?code_challenge=xxx&prompt=select_account&code_challenge_method=S256&access_type=offline&redirect_uri=http%3A%2F%2Flocalhost%3A8085%2F&response_type=code&client_id=32555940559.apps.googleusercontent.com&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fappengine.admin+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcompute+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Faccounts.reauth

'ブラウザでOAuthの認証画面が上がりますので、認証・認可してください'

You are logged in as: [[email protected]].

Pick cloud project to use:
 [1] fb-samples-xxxxx
 [2] spring-base-xxxxx
 [3] Create a new project
Please enter numeric choice or text value (must exactly match list
item):  1

Your current project has been set to: [fb-samples-xxxxx].

Not setting default zone/region (this feature makes it easier to use
[gcloud compute] by setting an appropriate default value for the
--zone and --region flag).
See https://cloud.google.com/compute/docs/gcloud-compute section on how to set
default compute region and zone manually. If you would like [gcloud init] to be
able to do this for you the next time you run it, make sure the
Compute Engine API is enabled for your project on the
https://console.developers.google.com/apis page.

Your Google Cloud SDK is configured and ready to use!

* Commands that require authentication will use [email protected] by default
* Commands will reference project `fb-samples-xxxxx` by default
Run `gcloud help config` to learn how to change individual settings

This gcloud configuration is called [default]. You can create additional configurations if you work with multiple accounts and/or projects.
Run `gcloud topic configurations` to learn more.

Some things to try next:

* Run `gcloud --help` to see the Cloud Platform services you can interact with. And run `gcloud help COMMAND` to get help on any gcloud command.
* Run `gcloud topic --help` to learn about advanced features of the SDK like arg files and output formatting
$

설치 완료군요. .

소통 확인.


$ gcloud projects describe fb-samples-xxxxx
createTime: '2019-09-01T11:33:55.627Z'
lifecycleState: ACTIVE
name: fb-samples
parent:
  id: 'xx'
  type: organization
projectId: fb-samples-xxxxx
projectNumber: 'xx'
$

그래, 뭔가 돌아왔다!

소통 확인 2



스케줄러를 봅니다.
$ gcloud  scheduler jobs list
ERROR: (gcloud.scheduler.jobs.list) User [[email protected]] does not have permission to access project [fb-samples-xxxxx] (or it may not exist):
 Cloud Scheduler API has not been used in project xx before or it is disabled. 
Enable it by visiting https://console.cloud.google.com/apis/api/cloudscheduler.googleapis.com/overview?project=xx then retry.
 If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.
- '@type': type.googleapis.com/google.rpc.Help
  links:
  - description: Google Cloud Console API activation
    url: https://console.cloud.google.com/apis/api/cloudscheduler.googleapis.com/overview?project=xx
$

뭔가 화가났다. 위 URL에 액세스하면 ,, 아, 스케줄러는 과금이 필요합니다.



따라서 필요에 따라 활성화하십시오.

그런 다음 다시 시도하면,
$ gcloud  scheduler jobs list
Listed 0 items.
$

그래, 스케줄을 설정하지 않았기 때문에 제로 건이었습니다. 좋아요.

제거



어쩌면 처음부터 다시 시작하거나 전부 지우고 싶은 경우. 이것도 htps : // c ぉ d. 오, ぇ. 이 m/sdk/도 cs/우닌 s 탓 lcぉdsdk? hl = 그럼 를 참고로.
$ gcloud info --format='value(installation.sdk_root)'
/Users/xxxxxx/google-cloud-sdk
$
$ gcloud info --format='value(config.paths.global_config_dir)'
/Users/xxxxxx/.config/gcloud
$

이것이 설치 디렉토리와 환경 설정 디렉토리를 표시하므로 제거하기 만하면됩니다.
$ rm -fr /Users/xxxxxx/google-cloud-sdk
$ rm -fr /Users/xxxxxx/.config/gcloud
$

미안해.

관련 링크



  • 공식 문서이 근처에서 확실히 명령을 배울 수 있습니다
  • 설치
  • 제거
  • 좋은 웹페이지 즐겨찾기