It has apt-transport-https and curl installed:
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates gnupg curl sudo
===============
.
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
sudo apt-get update && sudo apt-get install google-cloud-cli
gcloud version
gcloud init
gcloud config list
gcloud auth list
=====================
Installation
1) Add the gcloud CLI distribution URI as a package source.
If your distribution supports the signed-by option, run the following command
$ echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
2)Import the Google Cloud public key.
If your distribution's apt-key command supports the --keyring argument, run the following command:
$ curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
3) Update and install the gcloud CLI:
$ sudo apt-get update && sudo apt-get install google-cloud-cli
ketan@ketanvm1:~$
ketan@ketanvm1:~$ sudo apt-get update
Hit:1 http://azure.archive.ubuntu.com/ubuntu focal InRelease
Hit:2 http://azure.archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:3 http://azure.archive.ubuntu.com/ubuntu focal-backports InRelease
Hit:4 http://azure.archive.ubuntu.com/ubuntu focal-security InRelease
Hit:5 https://apt.releases.hashicorp.com focal InRelease
Hit:6 https://packages.microsoft.com/repos/azure-cli focal InRelease
Reading package lists... Done
ketan@ketanvm1:~$
ketan@ketanvm1:~$
ketan@ketanvm1:~$ sudo apt-get install apt-transport-https ca-certificates gnupg curl sudo
Reading package lists... Done
Building dependency tree
Reading state information... Done
ca-certificates is already the newest version (20230311ubuntu0.20.04.1).
ca-certificates set to manually installed.
curl is already the newest version (7.68.0-1ubuntu2.19).
gnupg is already the newest version (2.2.19-3ubuntu2.2).
sudo is already the newest version (1.8.31-1ubuntu1.5).
sudo set to manually installed.
apt-transport-https is already the newest version (2.0.9).
0 upgraded, 0 newly installed, 0 to remove and 14 not upgraded.
ketan@ketanvm1:~$ echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main
ketan@ketanvm1:~$ cd /etc/apt/sources.list.d/
ketan@ketanvm1:/etc/apt/sources.list.d$ ls -l
total 12
-rw-r--r-- 1 root root 76 Jun 23 17:27 azure-cli.list
-rw-r--r-- 1 root root 106 Aug 20 20:52 google-cloud-sdk.list
-rw-r--r-- 1 root root 112 Jun 23 18:07 hashicorp.list
ketan@ketanvm1:/etc/apt/sources.list.d$ cat google-cloud-sdk.list
deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main
ketan@ketanvm1:$ curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 2659 100 2659 0 0 40907 0 --:--:-- --:--:-- --:--:-- 40907
OK
ketan@ketanvm1:/etc/apt/sources.list.d$ sudo apt-get update && sudo apt-get install google-cloud-cli
Hit:1 https://apt.releases.hashicorp.com focal InRelease
Hit:2 https://packages.microsoft.com/repos/azure-cli focal InRelease
Get:3 https://packages.cloud.google.com/apt cloud-sdk InRelease [6361 B]
Hit:4 http://azure.archive.ubuntu.com/ubuntu focal InRelease
Hit:5 http://azure.archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:6 http://azure.archive.ubuntu.com/ubuntu focal-backports InRelease
Hit:7 http://azure.archive.ubuntu.com/ubuntu focal-security InRelease
Get:8 https://packages.cloud.google.com/apt cloud-sdk/main amd64 Packages [497 kB]
Fetched 503 kB in 1s (575 kB/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
google-cloud-cli-app-engine-java google-cloud-cli-app-engine-python
google-cloud-cli-pubsub-emulator google-cloud-cli-bigtable-emulator
google-cloud-cli-datastore-emulator kubectl
The following NEW packages will be installed:
google-cloud-cli
0 upgraded, 1 newly installed, 0 to remove and 14 not upgraded.
Need to get 153 MB of archives.
After this operation, 754 MB of additional disk space will be used.
Get:1 https://packages.cloud.google.com/apt cloud-sdk/main amd64 google-cloud-cli all 443.0.0-0 [153 MB]
Fetched 153 MB in 4s (40.7 MB/s)
Selecting previously unselected package google-cloud-cli.
(Reading database ... 157479 files and directories currently installed.)
Preparing to unpack .../google-cloud-cli_443.0.0-0_all.deb ...
Unpacking google-cloud-cli (443.0.0-0) ...
Setting up google-cloud-cli (443.0.0-0) ...
Processing triggers for man-db (2.9.1-1) ...
ketan@ketanvm1:/etc/apt/sources.list.d$
Initialize the Google Cloud environment
CONNECT TO GCP
GCLOUD INIT:
ketan@ketanvm1:$ 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)? Y
Go to the following link in your browser:
https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=32555940559.apps.googleusercontent.com&redirect_uri=https%3A%2F%2Fsdk.cloud.google.com%2Fauthcode.html&scope=openid+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%2Fsqlservice.login+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcompute+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Faccounts.reauth&state=HB8P9CYVuo1HZZexWhJkT3LWOPWDCS&prompt=consent&access_type=offline&code_challenge=4G42sXXXXXXXXXXXXXXXXXXXXXXdpZaBWI&code_challenge_method=S256
COPY AND PASTE ABOVE URL IN BROWSER AND GET AUTHORIZATION KEY:
Enter authorization code: 4/0AdeuxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxkunJW6TReCIPVxxxxxxxX
You are logged in as: [ketan@ABC.COM].
Pick cloud project to use:
[1] cosm
[2] dvs
[3] dv
[4] new-user
[5] sim-
[6] sim-p
[7] sim-s
[8] sp-g
[9] svo-m
[10] ucsd-b
[11] Enter a project ID
[12] Create a new project
Please enter numeric choice or text value (must exactly match list item): 4
Your current project has been set to: [new-user-learning].
Do you want to configure a default Compute Region and Zone? (Y/n)? Y
Which Google Compute Engine zone would you like to use as project default?
If you do not specify a zone via a command line flag while working with Compute Engine resources, the default is assumed.
[1] us-east1-b
[2] us-east1-c
[3] us-east1-d
[4] us-east4-c
[5] us-east4-b
[6] us-east4-a
[7] us-central1-c
[8] us-central1-a
[9] us-central1-f
[10] us-central1-b
[11] us-west1-b
[12] us-west1-c
[13] us-west1-a
[14] europe-west4-a
[15] europe-west4-b
[16] europe-west4-c
[17] europe-west1-b
[18] europe-west1-d
[19] europe-west1-c
[20] europe-west3-c
[21] europe-west3-a
[22] europe-west3-b
[23] europe-west2-c
[24] europe-west2-b
[25] europe-west2-a
[26] asia-east1-b
[27] asia-east1-a
[28] asia-east1-c
[29] asia-southeast1-b
[30] asia-southeast1-a
[31] asia-southeast1-c
[32] asia-northeast1-b
[33] asia-northeast1-c
[34] asia-northeast1-a
[35] asia-south1-c
[36] asia-south1-b
[37] asia-south1-a
[38] australia-southeast1-b
[39] australia-southeast1-c
[40] australia-southeast1-a
[41] southamerica-east1-b
[42] southamerica-east1-c
[43] southamerica-east1-a
[44] asia-east2-a
[45] asia-east2-b
[46] asia-east2-c
[47] asia-northeast2-a
[48] asia-northeast2-b
[49] asia-northeast2-c
[50] asia-northeast3-a
Did not print [66] options.
Too many options [116]. Enter "list" at prompt to print choices fully.
Please enter numeric choice or text value (must exactly match list item): 13
Your project default Compute Engine zone has been set to [us-west1-a].
You can change it by running [gcloud config set compute/zone NAME].
Your project default Compute Engine region has been set to [us-west1].
You can change it by running [gcloud config set compute/region NAME].
Created a default .boto configuration file at [/home/ketan/.boto]. See this file and
[https://cloud.google.com/storage/docs/gsutil/commands/config] for more
information about configuring Google Cloud Storage.
Your Google Cloud SDK is configured and ready to use!
* Commands that require authentication will use ketan.patel@supernal.aero by default
* Commands will reference project `new-user-learning` by default
* Compute Engine commands will use region `us-west1` by default
* Compute Engine commands will use zone `us-west1-a` 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
* Run `gcloud cheat-sheet` to see a roster of go-to `gcloud` commands.
ketan@ketanvm1:~$ gcloud auth list
Credentialed Accounts
ACTIVE ACCOUNT
* ketan@abc.com
To set the active account, run:
$ gcloud config set account `ACCOUNT`
ketan@ketanvm1:~$ gcloud config list
[compute]
region = us-west1
zone = us-west1-a
[core]
account = ketan@abc.com
disable_usage_reporting = True
project = new-user
Your active configuration is: [default]
ketan@ketanvm1:~$
GCLOUD CLI COMMANDS
ketan@ketanvm1:~$ echo `date` > ketandate
ketan@ketanvm1:~$ cat ketandate
Sun Aug 20 21:26:48 UTC 2023
ketan@ketanvm1:~$ gsutil ls
gs://ketanlearningbucket0818/
ketan@ketanvm1:~$ gsutil cp ketandate gs://ketanlearningbucket0818/
Copying file://ketandate [Content-Type=application/octet-stream]...
/ [1 files][ 29.0 B/ 29.0 B]
Operation completed over 1 objects/29.0 B.
ketan@ketanvm1:~$ gsutil ls gs://ketanlearningbucket0818/
gs://ketanlearningbucket0818/ketandate
ketan@ketanvm1:~$ gcloud compute networks list
NAME SUBNET_MODE BGP_ROUTING_MODE IPV4_RANGE GATEWAY_IPV4
default AUTO REGIONAL
ketan@ketanvm1:~$ gcloud components list
Your current Google Cloud CLI version is: 443.0.0
The latest available version is: 443.0.0
┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Components │
├───────────────┬──────────────────────────────────────────────────────┬──────────────────────────────┬──────────┤
│ Status │ Name │ ID │ Size │
├───────────────┼──────────────────────────────────────────────────────┼──────────────────────────────┼──────────┤
│ Not Installed │ App Engine Go Extensions │ app-engine-go │ 4.5 MiB │
│ Not Installed │ Appctl │ appctl │ 21.0 MiB │
│ Not Installed │ Artifact Registry Go Module Package Helper │ package-go-module │ < 1 MiB │
│ Not Installed │ Cloud Bigtable Command Line Tool │ cbt │ 11.4 MiB │
│ Not Installed │ Cloud Bigtable Emulator │ bigtable │ 7.0 MiB │
│ Not Installed │ Cloud Datastore Emulator │ cloud-datastore-emulator │ 36.2 MiB │
│ Not Installed │ Cloud Firestore Emulator │ cloud-firestore-emulator │ 42.5 MiB │
│ Not Installed │ Cloud Pub/Sub Emulator │ pubsub-emulator │ 61.2 MiB │
│ Not Installed │ Cloud Run Proxy │ cloud-run-proxy │ 13.4 MiB │
│ Not Installed │ Cloud SQL Proxy │ cloud_sql_proxy │ 7.8 MiB │
│ Not Installed │ Cloud Spanner Emulator │ cloud-spanner-emulator │ 31.4 MiB │
│ Not Installed │ Cloud Spanner Migration Tool │ harbourbridge │ 20.9 MiB │
│ Not Installed │ Google Container Registry's Docker credential helper │ docker-credential-gcr │ 1.8 MiB │
│ Not Installed │ Kustomize │ kustomize │ 4.3 MiB │
│ Not Installed │ Log Streaming │ log-streaming │ 13.9 MiB │
│ Not Installed │ Minikube │ minikube │ 34.6 MiB │
│ Not Installed │ Nomos CLI │ nomos │ 26.4 MiB │
│ Not Installed │ On-Demand Scanning API extraction helper │ local-extract │ 14.4 MiB │
│ Not Installed │ Skaffold │ skaffold │ 22.7 MiB │
│ Not Installed │ Spanner migration tool │ spanner-migration-tool │ 20.9 MiB │
│ Not Installed │ Terraform Tools │ terraform-tools │ 66.1 MiB │
│ Not Installed │ anthos-auth │ anthos-auth │ 20.4 MiB │
│ Not Installed │ config-connector │ config-connector │ 56.7 MiB │
│ Not Installed │ enterprise-certificate-proxy │ enterprise-certificate-proxy │ 8.2 MiB │
│ Not Installed │ gcloud app Java Extensions │ app-engine-java │ 64.9 MiB │
│ Not Installed │ gcloud app Python Extensions │ app-engine-python │ 8.5 MiB │
│ Not Installed │ gcloud app Python Extensions (Extra Libraries) │ app-engine-python-extras │ 27.3 MiB │
│ Not Installed │ gke-gcloud-auth-plugin │ gke-gcloud-auth-plugin │ 7.9 MiB │
│ Not Installed │ kpt │ kpt │ 14.5 MiB │
│ Not Installed │ kubectl │ kubectl │ < 1 MiB │
│ Not Installed │ kubectl-oidc │ kubectl-oidc │ 20.4 MiB │
│ Not Installed │ pkg │ pkg │ │
│ Installed │ BigQuery Command Line Tool │ bq │ 1.6 MiB │
│ Installed │ Bundled Python 3.9 │ bundled-python3-unix │ 63.6 MiB │
│ Installed │ Cloud Storage Command Line Tool │ gsutil │ 11.3 MiB │
│ Installed │ Google Cloud CLI Core Libraries │ core │ 21.5 MiB │
│ Installed │ Google Cloud CRC32C Hash Tool │ gcloud-crc32c │ 1.2 MiB │
│ Installed │ gcloud Alpha Commands │ alpha │ < 1 MiB │
│ Installed │ gcloud Beta Commands │ beta │ < 1 MiB │
└───────────────┴──────────────────────────────────────────────────────┴──────────────────────────────┴──────────┘
To install or remove components at your current SDK version [443.0.0], run:
$ gcloud components install COMPONENT_ID
$ gcloud components remove COMPONENT_ID
To update your SDK installation to the latest version [443.0.0], run:
$ gcloud components update
ketan@ketanvm1:~$ gcloud compute firewall-rules list
NAME NETWORK DIRECTION PRIORITY ALLOW DENY DISABLED
default-allow-icmp default INGRESS 65534 icmp False
default-allow-internal default INGRESS 65534 tcp:0-65535,udp:0-65535,icmp False
default-allow-rdp default INGRESS 65534 tcp:3389 False
default-allow-ssh default INGRESS 65534 tcp:22 False
To show all fields of the firewall, please show in JSON format: --format=json
To show all fields in table format, please see the examples in --help.
ketan@ketanvm1:~$ gcloud compute instances list
Listed 0 items.
ketan@ketanvm1:~$
No comments:
Post a Comment